`lerna add --scope` does not update package-lock file
See original GitHub issueWhen adding a new dependency to a single package using lerna add --scope {name} {dep}
, the file packages/{name}/package-lock.json
is not updated.
Strangely enough, when adding the same dependency to all packages (omitting --scope
argument), package locks are updated correctly.
Expected Behavior
When npm’s package-lock feature is enabled, then lerna add
should always update corresponding package-lock.json
files, regardless of whether --scope
argument was used or not.
Current Behavior
lerna add --scope {name} {dep}
does not updatepackages/name/package-lock.json
file.
Possible Solution
The same solution that’s already in place for lerna add
with no scope?
Steps to Reproduce (for bugs)
-
Create a simple monorepo. I created a sandbox you can use yourself:
https://github.com/bajtos/lerna-package-locks/tree/lerna-add
-
Run the following command:
$ lerna add --scope app p-event
-
Run
git status
to see what has changed:$ git status (...) modified: packages/app/package.json
lerna.json
{
"lerna": "3.3.0",
"packages": [
"packages/*"
],
"version": "independent"
}
Context
I ran into this issue after we have recently enabled package-lock feature in https://github.com/strongloop/loopback-next and found out that we don’t know how correctly add new dependencies to our packages.
Your Environment
Executable | Version |
---|---|
lerna --version |
3.13.1 |
npm --version |
6.9.0 |
yarn --version |
n/a |
node --version |
v10.15.0 |
OS | Version |
---|---|
macOS Mojave | 10.14.3 |
Please note my global npm config in ~/.npmrc
is disabling the package-lock feature. The sandbox in https://github.com/bajtos/lerna-package-locks/tree/lerna-add is explicitly enabling it by including .npmrc
files in all places where it’s needed.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:9 (4 by maintainers)
Top GitHub Comments
@bajtos Shouldn’t this issue be reopened? I just encountered this issue with
yarn
in lerna@3.21.0Same here with
lerna@3.22.1
. Usingnpm
and notyarn