volta-cli / rfcs

RFCs for changes to Volta
Other
17 stars 14 forks source link

Installing/pinning npm #40

Closed charlespierce closed 4 years ago

charlespierce commented 4 years ago

Support installation and pinning of arbitrary npm versions, decoupled from the selected Node version.

Rendered RFC

charlespierce commented 4 years ago

Thanks for the comments @rwjblue, they definitely helped clarify the thinking / plans on several points. I'll update the RFC soon with changes to reflect the improved process.

To answer your other questions:

  1. The behavior of volta install node wouldn't change, you would still have npm available because it was bundled with node (unless you had previously selected a specific version with volta install npm, then you would retain that specific version).
  2. The "default installed npm" would be special-cased, in that it would be treated as "no custom npm". We already have logic for that in the data structures (volta key in package.json, etc.).
    • If the pinned version of npm exactly matches the bundled default version (which it currently always will), then we treat it the same as if no version is specified.
    • If the pinned version is different from the bundled default version (after this RFC), then we would create a tools/image/npm/{npm_version} directory for it.
    • This could potentially lead to some duplication, if you install a newer version of npm and then upgrade your node to one that has that version pinned, you will have 2 copies of it, however since npm is always bundled with Node anyway, there's no real way to avoid that duplication.
  3. I'll add a mention of it, but volta list would include npm in the list of package managers, along-side Yarn. I believe @chriskrycho's architecture of that command can already handle npm with little adjustment needed, so it should be a smooth migration on that front.
rwjblue commented 4 years ago

Awesome, thank you

charlespierce commented 4 years ago

@rwjblue Updated based on the above discussions and further thought, thanks again!