Multiple packages in monorepo
niklaskorz opened this issue · 2 comments
Maybe I just misunderstand how to use the resulting yarn-project.nix
, but from what I see it only generates a single derivation for the root package.json, instead of one derivation per package/workspace in the monorepo.
Ideally, a derivation should be generated for every package of a monorepo like dream2nix does for npm 8+ workspaces so they can be cached separately.
I currently have 2 projects with workspaces packaged using this plugin, but I guess I've not had the need for this because they only have one final runnable package. I've used it mostly to split off webpack builds and shared client/server libraries.
I don't really have a good idea what separate derivations would look like. Do you want to build each part of the workspace starting from a packaged version (yarn pack
)? But then in practice, yarn pack
is often preceded by build steps, which may need access to the entire workspace and dev dependencies, and we have to capture these in Nix code somehow.
yarn workspaces focus
in yarn v4 might be a way to let yarn resolve which packages are needed for which workspace members, if I understand the feature correctly.
Thanks for creating & maintaining this plugin. ❤️