Repository navigation
Conversation
A workspace member can become an implicit target of npm install and uninstall. Resolve the owning project before a root-only dependency edit, while keeping relative package arguments in the calling directory. Use npm to verify membership on early npm 8 and preserve explicit workspace selections. Cover member dependency and lockfile retention, including nested workspaces with the same package name.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
From
packages/app,vp remove -w testnpm2can remove the dependency from both the root and app. The command succeeds even if app still imports the package. Adding a dependency with-wcan also write an extra declaration to app.For npm dependency edits, keep the caller's directory so relative package paths still work. Resolve the owning project before passing its path to npm as
--prefix. On npm 8.5 and later, leave explicit workspace selections to npm. Earlier npm 8 versions need a membership check because a member can own another workspace with the same package names.vp remove -w testnpm2vp add -w --filter docs testnpm2Evidence
vpcommands passed with npm 8.1.0, 8.19.4 and 11.19.0. Checks covered package-bearing install, caller-relative tarballs, explicit selectors and user-selected npmrc files.just check,just testandjust lintpassed.Merge Danger
Door · Two-way. Blast radius · npm workspace dependency edits.
Root detection can start extra read-only npm processes. The prefix override also makes lifecycle scripts see the workspace root in
npm_config_prefixandnpm_config_global_prefix. A script that starts a global npm install can therefore target the project. An npm 8.1 global npmrc that changes its own prefix can also redirect the configuration lookup. These are open compatibility concerns for review.The early npm 8 fallback rejects a combined root and member add of a local package before it changes the manifests. Those npm versions save the root-relative file path in the member too, which breaks the next install. npm fixed that behavior in 8.19.0. npm/cli#5350