Skip to content
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

[DOCS] package.json#repository should clarify normalization steps and future plans. #7299

Open
2 tasks done
JoshuaKGoldberg opened this issue Mar 19, 2024 · 1 comment
Open
2 tasks done
Labels
Bug thing that needs fixing Documentation documentation related issue Priority 2 secondary priority issue

Comments

@JoshuaKGoldberg
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

My repo's package.json file has a "repository" field set to "JoshuaKGoldberg/emojipedia" as a shorthand. npm publish still works, but gives this complaint:

ERROR npm WARN publish npm auto-corrected some errors in your package.json when publishing.  Please run "npm pkg fix" to address these errors.
npm WARN publish errors corrected:
npm WARN publish "repository" was changed from a string to an object
npm WARN publish "repository.url" was normalized to "git+https://github.com/JoshuaKGoldberg/emojipedia.git"

https://github.com/JoshuaKGoldberg/emojipedia/blob/7b67fe1986852fb271c2eab59fe536ee3476322f/package.json#L5

Expected Behavior

Per npm/npm#3783 -> https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository, using a repository shorthand like "JoshuaKGoldberg/emojipedia" should be allowed.

Steps To Reproduce

  1. Create a project whose package.json's "repository" value is a GitHub string shorthand
  2. npm publish

Environment

  • npm: 10.2.4 and 10.5.0
  • Node.js: v20.11.0
  • OS Name: macOS
  • System Model Name: Mac Studio
  • npm config:
//registry.npmjs.org/:_authToken = (protected) 
provenance = true
@wraithgar
Copy link
Member

Historically npm has normalized that entry when publishing a package, which lead to a discrepancy between what was in the package.json and what was in the manifest on the registry. This warning is showing that change happening. At some point in the future we are hoping to stop allowing those fields to differ, so the warning is letting folks clean things up now.

The docs will likely need to be updated on this to reflect the new reality.

@wraithgar wraithgar changed the title [BUG] npm publish erroneously reporting on repository shorthand [DOCS] package.json#repository should clarify normalization steps and future plans. Mar 20, 2024
@wraithgar wraithgar added Documentation documentation related issue Priority 2 secondary priority issue and removed Needs Triage needs review for next steps labels Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Documentation documentation related issue Priority 2 secondary priority issue
Projects
None yet
Development

No branches or pull requests

3 participants