We have an existing Lerna mono-repo that has a structure like:
/
/packages
/package1
/package2
/package3
...
We currently use Yarn for our project, and actually only have a top-level yarn.lock
file, with no per-package yarn.lock
since we never used Workspaces.
We are trying to switch to npm, and would like to generate a package-lock.json
file for every package in the mono-repo, not just the top-level. How can we do this? Running npm run lerna bootstrap --hoist
creates a top-level lock file, but does not include any "dev": true
tags and doesn't include any local packages. The best I've been able to do is to do npm run lerna add somePackage --scope=package1
, which even though somePackage
already exists in package
, causes a package-lock.json
file to be generated for every package in the mono repo except package1
. Further, the generated package-lock.json
files do not have any dev dependencies.
Further, I can't go into each package and run npm install
because npm
doesn't know about many of the local packages we have in the mono-repo that other local packages depend on. Strange enough, even in the package-lock.json
files generated from npm via the lerna add
, those files don't include any references to local packages, only external ones.
So: how to I generate a package-lock.json
file for every package in the mono-repo that also includes devDependencies?