cli icon indicating copy to clipboard operation
cli copied to clipboard

fix: clear non-exist workspace part in package-lock.json when npm install (fix #5463)

Open sun0day opened this issue 3 years ago • 6 comments

Clear non-exist workspace part in package-lock.json when npm install

fix #5463

After rm -rf packages/b && npm install , package-lock.json looks like

  • Before PR:
{
 "packages": {
    "": {
      "name": "npm-workspace-remove",
      "version": "1.0.0",
      "license": "ISC",
      "workspaces": [
        "packages/a",
        "packages/b"
      ]
    },
    "node_modules/a": {
      "resolved": "packages/a",
      "link": true
    },
    "packages/a": {
      "version": "1.0.0",
      "license": "ISC"
    },
    "packages/b": {
      "version": "1.0.0",
      "extraneous": true,
      "license": "ISC",
      "devDependencies": {}
    }
  }
}
  • After PR:
{
 "packages": {
    "": {
      "name": "npm-workspace-remove",
      "version": "1.0.0",
      "license": "ISC",
      "workspaces": [
        "packages/a"
      ]
    },
    "node_modules/a": {
      "resolved": "packages/a",
      "link": true
    },
    "packages/a": {
      "version": "1.0.0",
      "license": "ISC"
    }
  }
}

sun0day avatar Sep 07 '22 13:09 sun0day

@sun0day please add a test that covers this feature

fritzy avatar Sep 14 '22 22:09 fritzy

@sun0day please add a test that covers this feature

Done.@fritzy

sun0day avatar Sep 16 '22 03:09 sun0day

@sun0day it looks like this change broke some existing tests. I may attempt to look into this in the coming weeks, but if you can take a look that would help this get merged. ping me if you need any assistance with it.

lukekarrys avatar Sep 21 '22 20:09 lukekarrys

@sun0day it looks like this change broke some existing tests. I may attempt to look into this in the coming weeks, but if you can take a look that would help this get merged. ping me if you need any assistance with it.

Help needed. I can't figure out why the e workspace node become extraneous: true. Once e is extraneous, this pr addition code will remove it from workspaces. @lukekarrys

image

sun0day avatar Sep 22 '22 03:09 sun0day

Apologies for the delay here @sun0day. I'm going to be out for a few weeks so I've unassigned myself in case one of the next CLI Release Managers can unblock this during a future release.

lukekarrys avatar Nov 12 '22 22:11 lukekarrys

It seems like this issue has not yet been resolved in NPM v10.2.4 and this PR is 2 years old. Is this still a known issue and should the branch conflicts in this PR be resolved in order to fix this problem?

christopher1986 avatar Jul 08 '24 08:07 christopher1986