dream2nix icon indicating copy to clipboard operation
dream2nix copied to clipboard

Look for hoisted dependencies in yarn monorepos

Open tgunnoe opened this issue 3 years ago • 4 comments

Some monorepos have hoisted dependencies and require many dream2nix injections. I would say dream2nix can look upwards in a monorepo for the root package.json after it cannot locate missing dependencies.

tgunnoe avatar Sep 30 '22 19:09 tgunnoe

Could you provide an example project that demonstrates the issue?

DavHau avatar Oct 01 '22 19:10 DavHau

Potentially fixed. Also we don't have an example that triggers that issue. Therefore closing

DavHau avatar Oct 28 '22 16:10 DavHau

@DavHau I was wrong. apologies.

Here's a minimal repository that demonstrates the issue. Basically, in yarn v1 workspaces the dependencies can be "hoisted" to the root package.json so that all subpackages match versions on the same dependency. Dream2nix's translator wont define root dependencies in the subpackages if the tooling is missing.

But what's the solution? yarn v1 was obviously a mess. I don't think it would be good design to just include all root packages in the subpackage's dependencies either.

https://github.com/tgunnoe/d2n-hoisted-deps-example

tgunnoe avatar Nov 02 '22 22:11 tgunnoe

I just pushed 5c227d036c3ecdf428e27310d2e64fc50747fdd2 which introduces a new option workspacesInheritParentDeps. I needed this for https://github.com/nix-community/ethereum.nix/pull/222 and it seemed like the most straight forward solution.

DavHau avatar Apr 20 '23 17:04 DavHau