-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
support per-package node version specification in workspaces #6720
Description
- I'd be willing to implement this feature (contributing guide)
Describe the user story
Reference to the original discussion - #6569.
Considering pnpm now has its own Node Version Manager - working in a multi-package workspace environment, I want the ability to specify individual Node.js versions for each package within the workspace. Currently, the use-node-version option in the .npmrc file is only recognized at the root level. This would enhance pnpm by allowing seamless, per-project version switching, eliminating the need for other tools.
Describe the solution you'd like
I gave a couple of potential solutions in the discussions, with the one enabling pnpm to read .npmrc files from individual packages being the favorite. This is likely the solution I'm looking to implement.
Describe the drawbacks of your solution
- It may introduce compatibility issues for existing workflows that rely on current behavior
It's probably minor, I don't think many would have multi-package.npmrcanduse-node-versiondefined for other than the root. - Performance would suffer a little as we will load configurations for all selected packages
- It may have unexpected implications for other commands besides
run, but I'll see during the implementation
Perhaps to mitigate drawbacks, we could feature-flag it?
Describe alternatives you've considered
We could modify @pnpm/npm-conf to resolve the version from the individual package in a workspace instead of the workspace's root. But after some digging, I figured it was probably not worth it. We would need to modify the @pnpm/npm-conf and change in what order configurations and projects graphs are loaded, which is trickier to implement. Also, that library should probably stay unconcerned about workspace support specifics.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status