Open bajtos opened 5 years ago
We're having this problem with the lock file...
Having in the package.json postinstall: "lerna bootstrap --no-ci"
doesn't work, and the hoisted dependencies aren't included in the package-lock file. We have to npm run postinstall
manually to get it updated, after npm i
.
In loopback-next, we have a pretty standard Lerna monorepo setup:
packages/core
andexamples/hello-world
lerna
creates symlinks)npm
to install dependenciesAn important aspect of this setup (as of
lerna@3.13.2
andnpm@6.9.0
): package-lock files MUST EXCLUDE monorepo-local dependencies, otherwisenpm ci
replaces symlinks created bylerna
with package content downloaded from the npm registry.When greenkeeper detects a new dependency version in one of the subpackages, it creates two commits:
package.json
(see e.g. https://github.com/strongloop/loopback-next/commit/279881b9cc8bfe6aebdfd21248870ed47e8fc647)package-lock.json
file (see e.g. https://github.com/strongloop/loopback-next/commit/f26e7e8607a7222397f0fb36bf1d1695ccff16f0)Actual behavior
The commit updating
package-lock.json
file is incorrectly adding monorepo-local dependencies to the lock file.Expected behavior
The commit updating
package-lock.json
file keeps monorepo-local dependencies out of the lock file.Proposed solution
I assume GreenKeeper is running
npm install
in the package to update the lock file. This does not work inlerna
monorepos.To correctly update package locks, we are running the following two commands in monorepo's root:
I think the first command
lerna clean
should not be necessary in principle, unfortunately it's needed in practice - at least in my experience.(Possibly related: https://github.com/lerna/lerna/issues/2015).It makes me wonder - can Greenkeeper use the same approach?
My main concern is that I am not sure what will happen when we run
lerna bootstrap --no-ci
and there are more out-of-date dependencies. Will the new package lock contain updates only for the dependency that was updated inpackage.json
or will it update all dependencies to the latest in-range versions available?