fix: clear non-exist workspace part in package-lock.json when npm install (fix #5463)
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 please add a test that covers this feature
@sun0day please add a test that covers this feature
Done.@fritzy
@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.
@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
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.
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?