lemon-noon-33245
05/25/2023, 3:00 PMpackage_json
here. I noticed that the node_build_script
target does not have all the node_modules
of the package’s pnpm workspace dependencies copied to its sandbox. Is that expected?worried-painter-31382
05/25/2023, 3:00 PMlemon-noon-33245
05/25/2023, 3:01 PMkeep-sandboxes=always
I can see that the sandbox for the install step have all the node_modules of the other workspaces installed.lemon-noon-33245
05/25/2023, 3:01 PMworried-painter-31382
05/25/2023, 3:03 PMInstalledNodePackage
rule is doing something wrongworried-painter-31382
05/25/2023, 3:06 PMlemon-noon-33245
05/25/2023, 3:06 PMworried-painter-31382
05/25/2023, 3:06 PMThe intention was to not copy node_modules for unrelated workspacesThis because the amount of IO is obscene as is
worried-painter-31382
05/25/2023, 3:07 PMMight it be because since I’m using typescript pants can’t infer the dependencies from code?I mean, possible? I'm not confident it works in complex workspace setups, my org uses this feature sparingly
worried-painter-31382
05/25/2023, 3:08 PMlemon-noon-33245
05/25/2023, 3:10 PMpnpm
it’s creating a node_modules for each package in the workspace that the one we’re filtering has dependencies on.
So if pkg1 depends on pkg2 and pkg3, when we run pnpm install --filter=pkg1
it’s installing all three of them and symlinking the folders where needed.lemon-noon-33245
05/25/2023, 3:11 PMpackage.json
just via code imports I’m guessing that is where the issue lies for melemon-noon-33245
05/25/2023, 4:55 PMìnstall_node_packages_for_address
rule, the digest only includes project_env.node_modules_directories
. So it will never pass on the other node_modules for its dependencies.
I think there’s a use case for copying all installed node_modules of dependencies, in particular for monorepos that share non-compiled libs between appsworried-painter-31382
05/25/2023, 7:12 PMworried-painter-31382
05/25/2023, 7:15 PMworried-painter-31382
05/25/2023, 7:15 PMlemon-noon-33245
05/25/2023, 7:19 PMpkg2:package-json
as a dependency to pkg1
, it does install it. However, it will fail if there are common packages in a “package.json” in a parent folder saying that it can’t merge folders due to duplcate files.
In my example I have a package.json in the root that has eslint as a dependency. Since both pnpm installs
would create node_modules/.bin/eslint in the root, the merge will failworried-painter-31382
05/25/2023, 7:21 PMwhich might be really bad for pnpm if it always installs everythingis very true then. I think maybe the approach is poor to begin with for pnpm, and possibly not worth the complexity in npm and yarns case
worried-painter-31382
05/25/2023, 7:22 PMlemon-noon-33245
05/25/2023, 7:37 PMnode_modules/.bin
bc both of the packages are installing eslint.lemon-noon-33245
05/25/2023, 7:39 PMit’s much simpler to install the entire workspace once as a baseline, and optimize by subsetting based on deps. That rules out the bad merge behaviour as well 🤔Technically, if we set up
node-linker=hoisted
pnpm will install a “flat” node_modules meaning all of the packages would install in the same folder all of the dependencies that are common between them and only have a local node_modules for dependencies that are exclusive to that package or that have version conflicts.lemon-noon-33245
05/25/2023, 7:40 PMproject_env.node_modules_directories
(or guarantee it’s only used once)