varsis / generate-lockfile

BSD 3-Clause "New" or "Revised" License
26 stars 6 forks source link

how to add the version information of the workspace project to the yarn.lock file in the root directory #5

Open nongcundeshifu opened 3 years ago

nongcundeshifu commented 3 years ago

Hello, I am using yarn+lerna to implement monorepo.I want to generate the lock file in the workspace with the lock of the root directory.But I ran into a problem.

My workspace project A depends on B in the workspace, but the lock of the root directory does not contain the version information of project B. Caused me to execute in the workspace project A: generate-lockfile --lockfile ../../yarn.lock --package package.json An error was reported

Error: Error: Could not find: @abc/lib@^1.0.11 (Package name of B project:@abc/lib)

The yarn.lock file in the root directory does not have the project information of @abc/lib, what should I do? For example, how to add the version information of the workspace project to the yarn.lock file in the root directory?

Thank you!

varsis commented 3 years ago

@nongcundeshifu This package only supports external dependencies. If you wish to lock a local package to a fixed version you will need to yarn install it pointing to your published package on your choice of registry instead of using package B locally in the monorepo.