Fix commands when used in a workspace#4583
Conversation
|
This change will increase the build size from 9.83 MB to 9.84 MB, an increase of 5.74 KB (0%)
|
src/package-linker.js
Outdated
| } | ||
| // look for extraneous packages in workspaces too | ||
| if (this.config.lockfileFolder !== this.config.cwd) { | ||
| await this._readRegistryFolders(this.config.cwd, possibleExtraneous, scopedPaths); |
There was a problem hiding this comment.
Shouldn't this be a while loop that would iterate on each workspace?
There was a problem hiding this comment.
Yes, I think that would make sense. Do you see any value including cwd in addition to lockfileFolder and all of the workspaces?
There was a problem hiding this comment.
I don't think it's necessary, all the node_modules should be guaranteed to be in these folders.
Ensures "outdated" and "upgrade" commands in workspace packages operate on the correct dependencies and preserve unrelated lockfile entries. Also ensures commands that run in the workspace root
2bb9f5b to
a2baddb
Compare
|
@arcanis Please note that the scope of this PR increased somewhat as I continued testing commands that could not be executed previously. I have updated the description accordingly. In order to properly test the now-available commands, my other fix from #4584 had to be included here. @kaylieEB, I would greatly appreciate your insight on this PR because it deviates from the approach you took in #4278. |
|
Closing because of #4630 |
Summary
Fixes #4334
Fixes #4328
Fixes #4348
Closes #4584
Previously,
remove,outdatedand several related commands would fail when used inside of a workspace package, either directly or viayarn workspaces <pkg> <cmd> [args]. These failures were caused by incorrect lockfile resolution, specifically usingconfig.cwdrather thanconfig.lockfileFolder.Also fixed:
removeinside a workspace,reinstallwould not clean up extraneous packages.outdated,upgradeorupgrade-interactiveinside of a workspace root or child, the wrong dependencies were often listed and the lockfile was being saved incorrectly after completing an upgradeTest plan