[BUG] workspace is not respected when updating package deps #4226
Labels
Bug
thing that needs fixing
Needs Triage
needs review for next steps
Release 8.x
work is associated with a specific npm 8 release
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
npm i
inside of a workspace folder, instead of updating the top-level package-lock a new one is created. This is the wrong behaviour for workspaces.I understand that this can be "fixed" by only running said command at the top-level but it's not ideal as its too-easy of a mistake to
npm i
on a package instead and end up committing the new package-lock.Yarn & pnpm's handling of this reduces potential bugs by detecting a workspace then updating the top-level package-lock.json only. It shouldn't be too much trouble to adopt that approach.
See below for an example:
$ cwd projectA
$ npm i
Undefined behavior
Expected Behavior
package-lock is updated inside the workspace folder
Steps To Reproduce
Environment
RFC: https://github.com/npm/rfcs/blob/main/implemented/0026-workspaces.md
Prior Art
pnpm - https://pnpm.io/workspaces#shared-workspace-lockfile
yarn - https://classic.yarnpkg.com/lang/en/docs/workspaces/#toc-why-would-you-want-to-do-this
The text was updated successfully, but these errors were encountered: