volta-cli / volta

Volta: JS Toolchains as Code. ⚡
https://volta.sh
Other
11.1k stars 235 forks source link

Idea: Rename `volta install` to a different verb #994

Open charlespierce opened 3 years ago

charlespierce commented 3 years ago

The volta install command is a fairly common point of confusion for new users in two ways:

  1. It's overloaded: volta install both fetches a new version and changes the user's default. This may be unexpected or it may be difficult to discover when you're only looking for the latter behavior.
  2. It complicates teaching Volta's mental model of "install on demand". Strictly speaking, there's no reason we need to actually fetch a new Node version when setting the default - new versions are downloaded as soon as they're needed. We do it as a convenience, but by using install as the verb, it gives the impression that "installing" is a necessary step. That impression is compounded by the fact that in most of the other Node version management tools, users do have to manually install a version in order to use it.

Changing the command verb to something else (e.g. volta default, volta global, etc.) could help alleviate both of these concerns. It makes it more clear that the important part of the command is changing the default, rather than fetching the version. It also separates the commands from the other managers, helping make the mental model (Declare Your Tools, Don't Install Them) more grokkable.

It may result in an increase of questions like "How do I install a version?", but then we can answer those questions in a way that leads more directly to teaching the Volta paradigm: "You don't have to, you tell Volta which version you want to use and it will automatically install it"

chriskrycho commented 3 years ago

I'd be in support of this, and I've thought it off and on since we discussed something similar a few years ago, given that we do have volta fetch as a separate command for if you want to do the downloading manually (e.g. for offline operation).

Tactically, we could make install just be a deprecated alias of default, and otherwise keep the behavior exactly the same. That would match the volta pin behavior quite nicely, too: you select a version to use in a given context, and Volta fetches it for you if it doesn't already have it.

charlespierce commented 3 years ago

Tactically, we could make install just be a deprecated alias of default, and otherwise keep the behavior exactly the same. That would match the volta pin behavior quite nicely, too: you select a version to use in a given context, and Volta fetches it for you if it doesn't already have it.

Yep, though I didn't mention the technical details, this is exactly what I was thinking the implementation would look like. That way it's not a breaking change but we can update the docs to direct people to the new commands. Then at some point if we decide to release a 2.0, we can drop the old install command as part of that set of changes.

abhijit-hota commented 2 years ago

+1 to this.

I just uninstalled NVM in favour of Volta. I installed Node v16 and then v14. I wanted to change the Node version to 16 again. I looked for a volta use by intuition but found out that volta install was the way to go. It is a bit confusing in my opinion given that I've already "installed" it.

chriskrycho commented 2 years ago

@abhijit-hota we'd absolutely welcome an RFC and implementation! It isn’t remotely near the top of any of the maintainers’ priority lists right now, but I don’t think there’s any objection from any of us—just a lack of time!

abhijit-hota commented 2 years ago

@chriskrycho

I'm not sure if I can help much as I don't know a lot about drafting RFCs. (I went through the instructions here: volta-cli/rfcs). I can try, though.

I think a single line in the documentation in the Installing Node Engines section here might be helpful for now. We can also make it a call-out. I can work on a PR for the same.

As for the lack of time, I totally get it! Volta is evolving and I'm very thankful to the maintainers for working on that. :heart::zap: