Skip to content

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

@broksonic21

Description

@broksonic21

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions