-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC for uninstalling node #53
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
- Feature Name: uninstall_node | ||
- Start Date: 2024-08-21 | ||
- RFC PR:[https://github.com/volta-cli/volta/pull/1882] | ||
- Volta Issue: | ||
|
||
# Summary | ||
|
||
[summary]: #summary | ||
|
||
Add support for uninstalling node to `volta uninstall` | ||
|
||
# Motivation | ||
|
||
[motivation]: #motivation | ||
|
||
Currently, Volta doesn't support uninstalling node due to this main reasons(as discussed in [#327](!https://github.com/volta-cli/volta/issues/327)): Its main purpose is to save disk space, nowadays disk size is not a big problem in many cases. So this task is in a low priority.But community has this demand since 2019, they need to manually remove some files to achieve that.Add support for uninstalling node is more convinent in this case, btw since we have `install` here we should also have `uninstall` here. | ||
|
||
# Pedagogy | ||
|
||
[pedagogy]: #pedagogy | ||
|
||
The user's intuition and way of treating it are opposite to `install`. Since `install` fetch node image, unpack it and set it as default, `unintall` should remove those things. | ||
|
||
# Details | ||
|
||
[details]: #details | ||
|
||
The new command will have the structure: | ||
|
||
``` | ||
volta uninstall node@version | ||
``` | ||
|
||
totally the same with `install`. | ||
|
||
Some examples: | ||
|
||
``` | ||
volta uninstall node@20.16.0 | ||
``` | ||
|
||
``` | ||
volta uninstall node@lts | ||
``` | ||
|
||
By add a `uninstall` to `Tool` trait and move uninstall logic from `Spec` to `Node, Package, Npm, Yarn, Pnpm`, it would resolve version with `node::resolve` first, and then remove tar.gz file and npm file in `home.node_inventory_dir()` and node in `home.node_image_root_dir()` | ||
|
||
# Critique | ||
|
||
[critique]: #critique | ||
|
||
In fact we want `uninstall` to save disk space or just to remove those things we don't need , it seems like a command like `prune` or `clean` is more suitable, which tracks every tool's status, and when `prune` is runned, we can clean all those tools that is no longer used. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a good call out! I have a separate RFC up (which I'm going to be updating soon, hopefully today) to deprecate the In that context, would it be confusing to have a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In that case, since |
||
|
||
In this case, maybe we should use a file to track every tool. When `volta pin` or `volta install` | ||
is runned, the toolchain must be added to that file (means this toolchain is used in a project or is set as default), and removed outdated toolchain from that file. And we can delete all that we don't use anymore. | ||
|
||
But this way will make some big change in volta, and how to track a toolchain's status is complex. | ||
|
||
# Unresolved questions | ||
|
||
[unresolved]: #unresolved-questions | ||
|
||
1. What should `uninstall` do when uninstall a default node? | ||
Since `install` actually fetch (in background),unpack(in background), and set as default(in user's view), `uninstall` should at least remove tar.gz file, npm file and node dir. but what `uninstall` should do when uninstall a node version that is set as default? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is an important question to resolve, though it's tricky with the overloaded behavior of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You mean There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @charlespierce @karthest Yeah, I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One use-case for There seems to be less of a need for that in local projects, since the config is written into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently, the
install
command can accept a version "requirement", e.g.node@10
ornode@latest
—what it does is fetch the list of available Node versions and then resolve that to a single, specific, version before installing. How do you seeuninstall
working for those cases? I can see a couple of options:volta uninstall node@10
would remove all cached versions of Node with major version 10. Runningvolta uninstall node
would clean all cached versions of Node. This feels like the better user experience, though it's a bit more technically involved.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At that time I think
uninstall
should receive totally same args withinstall
and treat them the same way,That means:install
, we support no verison, semver version , exact version and tag version.(Of course whennode_index_file
expires and fetch the new version, those none version, semver version and tag version will be resolved to a different one with the one wheninstall
runs. But I don't think it's a big deal)But I agree with your second thought, that feels like a better user experience indeed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that “just support the same argument variants as
install
” makes a lot of sense. One note, though: it does feel like the kind of thing that might warrant a prompt, which we have yet to do anywhere. “This will remove [list all affected versions]; do you want to proceed?” It might be fine not to, but that could be a shockingly wide-ranging effect. 🤔There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I totally agree with you, a kind prompt like this is really important for users. You are soooo good at user experience.