fields added to package.json #1630

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
3 participants
@lkisac

lkisac commented Jan 26, 2017

I've added/modified a few fields in the package.json file: repository, keywords and bugs, so they validate with http://package-json-validator.com.

Let me know if these changes are ok and if you would like anything modified with them.

@dougwilson

This comment has been minimized.

Show comment
Hide comment
@dougwilson

dougwilson Jan 26, 2017

Member

Thanks for the effort, but unfortunately unnecessary. Npm automatically populates the github info from the short string field, which is nicer and the new npm search no longer uses the keywords array in the search.

You may want to report the issues to the validator tool.

Member

dougwilson commented Jan 26, 2017

Thanks for the effort, but unfortunately unnecessary. Npm automatically populates the github info from the short string field, which is nicer and the new npm search no longer uses the keywords array in the search.

You may want to report the issues to the validator tool.

@dougwilson dougwilson closed this Jan 26, 2017

@lkisac

This comment has been minimized.

Show comment
Hide comment
@lkisac

lkisac Jan 26, 2017

Ok, I will check with them. Thanks.

lkisac commented Jan 26, 2017

Ok, I will check with them. Thanks.

@dougwilson

This comment has been minimized.

Show comment
Hide comment
@dougwilson

dougwilson Jan 26, 2017

Member

Awesome! Npm itself uses https://npmjs.org/package/read-package-json to read the file, so that would probably be a good reference implementation. Npm itself will throw errors for invalid fields, warnings for missing / wrong fields on publish or package read and this module is currently clean for that as well, so I don't understand what the validator is validating against, as I would assume it should work like npm.

Member

dougwilson commented Jan 26, 2017

Awesome! Npm itself uses https://npmjs.org/package/read-package-json to read the file, so that would probably be a good reference implementation. Npm itself will throw errors for invalid fields, warnings for missing / wrong fields on publish or package read and this module is currently clean for that as well, so I don't understand what the validator is validating against, as I would assume it should work like npm.

@dougwilson

This comment has been minimized.

Show comment
Hide comment
@dougwilson

dougwilson Jan 26, 2017

Member

Looking through the GitHub repo for that validator tool, there at lots of open issues regarding the issues I noted above regarding incorrect validation for npm packages like gorillamania/package.json-validator#29 and gorillamania/package.json-validator#44

Member

dougwilson commented Jan 26, 2017

Looking through the GitHub repo for that validator tool, there at lots of open issues regarding the issues I noted above regarding incorrect validation for npm packages like gorillamania/package.json-validator#29 and gorillamania/package.json-validator#44

@lkisac

This comment has been minimized.

Show comment
Hide comment
@lkisac

lkisac Jan 26, 2017

I should note that the only non-valid field was the repository url. keywords and bugs were only at warning level. There is also a recommendation for the 'homepage' field, which I left alone.

package-json-validator
Results:

{
  "valid": false,
  "errors": [
    "Url not valid for repository: mysqljs/mysql"
  ],
  "warnings": [
    "Missing recommended field: keywords",
    "Missing recommended field: bugs"
  ],
  "recommendations": [
    "Missing optional field: homepage"
  ]
}

Looking at the open issues you provided, it seems that the normalization rules are different between https://www.npmjs.com/package/normalize-package-data and https://www.npmjs.com/package/read-package-json

lkisac commented Jan 26, 2017

I should note that the only non-valid field was the repository url. keywords and bugs were only at warning level. There is also a recommendation for the 'homepage' field, which I left alone.

package-json-validator
Results:

{
  "valid": false,
  "errors": [
    "Url not valid for repository: mysqljs/mysql"
  ],
  "warnings": [
    "Missing recommended field: keywords",
    "Missing recommended field: bugs"
  ],
  "recommendations": [
    "Missing optional field: homepage"
  ]
}

Looking at the open issues you provided, it seems that the normalization rules are different between https://www.npmjs.com/package/normalize-package-data and https://www.npmjs.com/package/read-package-json

@dougwilson

This comment has been minimized.

Show comment
Hide comment
@dougwilson

dougwilson Jan 26, 2017

Member

The repository field in our repo is definitely valid. I liked you to the issue reporting that the validator is incorrectly thinking it is invalid. Also the bugs and homepage URLs are auto populated from the repository short string to their GitHub addresses, which is why we don't need to specify them yet they show up on the npmjs.com site and in the npm repository just fine, so there is nothing to change here, I think you just accidentally stumbled across some bugs in that validator tools, which is why I suggested to file issues there and hopefully they'll get it fixed.

Member

dougwilson commented Jan 26, 2017

The repository field in our repo is definitely valid. I liked you to the issue reporting that the validator is incorrectly thinking it is invalid. Also the bugs and homepage URLs are auto populated from the repository short string to their GitHub addresses, which is why we don't need to specify them yet they show up on the npmjs.com site and in the npm repository just fine, so there is nothing to change here, I think you just accidentally stumbled across some bugs in that validator tools, which is why I suggested to file issues there and hopefully they'll get it fixed.

@LinusU

This comment has been minimized.

Show comment
Hide comment
@LinusU

LinusU Jan 27, 2017

Contributor

Yes it's valid, it's the validator that is a bit outdated. I hope to get a weekend to give it some love soon :)

Contributor

LinusU commented Jan 27, 2017

Yes it's valid, it's the validator that is a bit outdated. I hope to get a weekend to give it some love soon :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment