Open brentbahry opened 5 months ago
Yarn does not currently support lockfiles in workspaces. See #1223
The yarn.lock
inside proteinjs/packages/reflection
splits the worktree and causes inconsistent views. When going down from proteinjs
to find workspaces, it can find proteinjs/packages/reflection/packages/reflection-build/test/examples/source-repository/b
. But when going up from that workspace (e.g. running a script in it), it will find the said yarn.lock
and treat proteinjs/packages/reflection
as the project root.
Once you remove the nested lockfiles, you will see yarn workspaces foreach --all --topological-dev --exclude typescript-parser run build
runs successfully.
Thanks for the explanation, I appreciate the time you took to look into this.
Just as a small data point, it is a requirement for us to have lock files in sub workspaces as the meta workspace in question is a developer convenience and not part of our deployment pipelines. So we ended up moving away from yarn workspaces to solve the problem.
Out of curiosity, what did you use instead?
Oh I just wrote some small reusable utilities that satisfied our use cases, working directly with npm instead of yarn.
Self-service
Describe the bug
I could just have a bug in my configuration, but nested yarn workspaces seem to result in incomplete dependency installs.
I'm in the process of setting up a meta repo (proteinjs) with git submodules (reflection, util). reflection and util are both workspaces themselves, and leverage yarn for their own build/publish pipelines.
When I run
yarn install
in proteinjs, dependencies seem to be mapped appropriately across the nested workspaces (verified withyarn workspaces list
). However, when I look at the node_modules/ of packages, they seem to be missing local dependencies.An example of an issue in my workspace hierarchy looks like this:
proteinjs/
To reproduce
git clone --recurse-submodules https://github.com/proteinjs/proteinjs
cd proteinjs
yarn install
yarn workspaces list -v --json
yarn workspaces foreach --all --topological --exclude typescript-parser run build
ls packages/reflection/packages/reflection-build/node_modules
Environment
Additional context
No response