From 50a5754765be1bc7459dcc55d0c91872021dad47 Mon Sep 17 00:00:00 2001 From: YZH Date: Tue, 3 Sep 2024 13:08:32 +0800 Subject: [PATCH 1/2] RFC for uninstalling node --- text/0000-uninstall-node.md | 64 +++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 text/0000-uninstall-node.md diff --git a/text/0000-uninstall-node.md b/text/0000-uninstall-node.md new file mode 100644 index 0000000..e6357b9 --- /dev/null +++ b/text/0000-uninstall-node.md @@ -0,0 +1,64 @@ +- Feature Name: uninstall_node +- Start Date: 2024-08-21 +- RFC PR: +- 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. + +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? From ef73a3a2af890ff598fdf2ab2916e56c6620a63e Mon Sep 17 00:00:00 2001 From: YZH Date: Tue, 3 Sep 2024 13:20:20 +0800 Subject: [PATCH 2/2] update PR link --- text/0000-uninstall-node.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/0000-uninstall-node.md b/text/0000-uninstall-node.md index e6357b9..4337635 100644 --- a/text/0000-uninstall-node.md +++ b/text/0000-uninstall-node.md @@ -1,6 +1,6 @@ - Feature Name: uninstall_node - Start Date: 2024-08-21 -- RFC PR: +- RFC PR:[https://github.com/volta-cli/volta/pull/1882] - Volta Issue: # Summary