[RFC] How should contributors manage node versions in local environments? #23909
Replies: 3 comments 1 reply
-
Hey @johnhunter, thank you so much for writing this nicely detailed RFC! We agree that it would bring much more value to the contributors if we had a solution for this. Seems like Unresolved questions:
Anything that supports
Seems like volta would, but
NVM is! Additional tasks: For the node version, we need to keep using 16.x until we drop support for it. Thanks once again! Looking forward to hearing back from you. |
Beta Was this translation helpful? Give feedback.
-
PR raised #24015 Driving the Node version from config in CI is challenging for the CircleCI workflows as it uses cimg images with specific node versions. It might be possible to use configuration with Dynamic configs although there is no guarantee of a 1:1 mapping of Node versions to CircleCI cimgs. |
Beta Was this translation helpful? Give feedback.
-
PR merged |
Beta Was this translation helpful? Give feedback.
-
Summary
Contributors are advised to use Node 16 when developing locally. There are various Node version managers available and Storybook has not prescribed a specific tool or approach. I recently raised a PR #23709 to use Volta https://volta.sh/ but configuring it to work correctly with large monorepos isn't ideal as each package.json needs an additional field. I'm considering reversing the changes in that PR but also think some form of node version management might be helpful for contributor onboarding.
Problem Statement
Non-goals
Implementation
I propose we recommend a node version manager tool to contributors and include the configuration to ensure the specified version is used in development. This configuration should be in sync with the CI test, build and publish tasks.
My original proposal was to use Volta as I have used it successfully on other projects. However, I'm not sure it is the right solution for Storybook and am therefore calling for alternative proposals.
Volta is installed locally and shims node, automatically installing a specific node (and yarn) version based on configuration within the project's package.json file. e.g:
However, Volta treats each project (i.e. a folder containing an package.json file) as a separate entity and if it does not find a
"volta"
setting for that package it uses the user's default. Currently Volta addresses this by using an extends to reference an ancestor package, e.g:In the Storybook monorepo we have a lot of package.json files. There are currently 100 that contain a scripts object and therefore potentially run node scripts. We could update all the packages to reference the root package.json file giving us a single source for configuration. But it is a lot of change for specific tooling and I'm not Volta is something that everyone will want to use.
There is a long running issue on the Volta github about this approach to configuration volta-cli/volta#282 and they do not appear to have reached any consensus.
Prior Art
There are other node package managers out there, Volta is a relative newcomer.
NVM uses a configuration file
.nvmrc
that may be better suited to Storybook.There may be other alternatives we could propose?
Deliverables
Risks
Unresolved Questions
Alternatives considered / Abandoned Ideas
I've proposed Volta as a personal preference but I'm not sure its right for Storybook. I'm keen to hear alternatives.
Beta Was this translation helpful? Give feedback.
All reactions