Skip to content

fields added to package.json #1630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

fields added to package.json #1630

wants to merge 2 commits into from

Conversation

lkisac
Copy link

@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
Copy link
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.

@dougwilson dougwilson closed this Jan 26, 2017
@lkisac
Copy link
Author

lkisac commented Jan 26, 2017

Ok, I will check with them. Thanks.

@dougwilson
Copy link
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.

@dougwilson
Copy link
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 JoshuaKGoldberg/package-json-validator#29 and JoshuaKGoldberg/package-json-validator#44

@lkisac
Copy link
Author

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
Copy link
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.

@LinusU
Copy link
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
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants