Skip to content
New issue

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

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

Already on GitHub? # to your account

[BUG] npm pkg fix repository.url updates don't match documentation #6891

Closed
2 tasks done
broksonic21 opened this issue Oct 9, 2023 · 2 comments
Closed
2 tasks done
Labels
Bug thing that needs fixing Documentation documentation related issue Priority 2 secondary priority issue Release 10.x

Comments

@broksonic21
Copy link

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

If you have a package.json with this:
See https://github.com/broksonic21/npm-pkg-fix/blob/main/package.json

  "repository": {
    "type": "git",
    "url": "https://github.com/broksonic21/npm-pkg-fix.git"
  },

then npm pkg fix converts it to:

 "repository": {
     "type": "git",
     "url": "git+https://github.com/broksonic21/npm-pkg-fix.git"
   },

(see https://github.com/broksonic21/npm-pkg-fix/pull/2/files )

Expected Behavior

That doesn't match the v10 docs at https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository which has the example canonical format to not include git+

{
  "repository": {
    "type": "git",
    "url": "https://github.com/npm/cli.git"
  }
}

I'd expect docs and npm pkg fix to match

Steps To Reproduce

  1. with npm 10
  2. with this package.json: https://github.com/broksonic21/npm-pkg-fix
  3. Run npm pkg fix
  4. See the package.json change

Environment

  • npm: 10.2.0
  • Node.js: v18.18.0
  • OS Name: Mac Sonoma 14.0
@broksonic21 broksonic21 added Bug thing that needs fixing Needs Triage needs review for next steps Release 10.x labels Oct 9, 2023
@wraithgar wraithgar added Documentation documentation related issue Priority 2 secondary priority issue and removed Needs Triage needs review for next steps labels Oct 12, 2023
@simonhaenisch
Copy link

It also converts broksonic21/npm-pkg-fix or github:broksonic21/npm-pkg-fix the same way, which is inconsistent with the CLI docs as well:

For GitHub, GitHub gist, Bitbucket, or GitLab repositories you can use the same shortcut syntax you use for npm install:

{
  "repository": "npm/npm",
  "repository": "github:user/repo",
  "repository": "gist:11081aaa281",
  "repository": "bitbucket:user/repo",
  "repository": "gitlab:user/repo"
}

https://docs.npmjs.com/cli/v10/configuring-npm/package-json#repository

@milaninfy
Copy link
Contributor

Documentation Example Fixed in #7615

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Bug thing that needs fixing Documentation documentation related issue Priority 2 secondary priority issue Release 10.x
Projects
None yet
Development

No branches or pull requests

4 participants