deno_install icon indicating copy to clipboard operation
deno_install copied to clipboard

Proposal: Rustup-like installer

Open bgub opened this issue 5 years ago • 4 comments

The recommended method to install Rust is by using the Rustup installer. Rustup allows you to update Rust, manage multiple Rust toolchains, and install projects associated with Rust (like the Rust Book).

There are tons of programs that manage concurrent versions of Node.js: nvm and n are two good examples. dvm is one solution for Deno users, but it lacks the simplicity and integration of something like Rustup.

I propose the creation of an installer similar to Rustup. It would have the following functionalities:

  • Manage the installation of multiple Deno versions at the same time
    • Allow setting a default Deno version
    • Allow setting a specific Deno version on the directory level
  • Add Deno to the user's $PATH
  • Install an offline version of the Deno manual

This would drastically simplify Deno version management, and make it much more appealing to all the users frustrated with the many compatibility problems of nvm and n.

bgub avatar Jul 24 '20 18:07 bgub

Does “deno upgrade” not solve this problem?

ry avatar Jul 24 '20 20:07 ry

As far as I understand, "deno upgrade" doesn't support working with multiple versions of Deno at the same time.

That would be a very useful feature, especially given that (with evolving JS standards) old versions of Deno may not be able to run the JS of the future.

bgub avatar Jul 24 '20 21:07 bgub

@nebrelbug You mentioned dvm by @justjavac. There exist other competing Deno Version Managers, of course - all with different features, designs, and properties. Here's a quick overview of version managers that I have personally used:

There are, of course, also general-purpose package managers that allow you to manage multiple deno versions, such as, scoop, brew, choco, asdf, yay, etc.

Another personal favorite of mine is MarkTiedemann/deno.mk, which is a cross-platform Makefile for installing and running Deno in a project.


I think there's a couple of non-trivial questions which we need to answer:

  • Should deno upgrade and/or deno_install do version management?
    • And if so, what properties are desirable? Which designs make sense? Which features should be implemented?
  • Or should there be a new, third official tool that does version management?
    • And if so, should it replace deno upgrade and/or deno_install?

There's also a related question of creating a GUI installer for Windows which came up a couple of times in the past, most recently in this issue: https://github.com/denoland/deno/issues/5640

I think this is a surprisingly large problem space. Personally, I'm fine with the current ecosystem of solutions, but I know it could benefit from being standardized and being more beginner-friendly.


Allow setting a specific Deno version on the directory level

I'm curious. How would that be implemented?

Add Deno to the user's $PATH

On Windows this can be done by editing the HKEY_CURRENT_USER\Environment\Path registry entry. How would that be done on Linux and MacOS (other than parsing and editing (or appending to) .bashrc (or similar), which I don't think is a solid solution)?

MarkTiedemann avatar Jul 25 '20 14:07 MarkTiedemann

Sorry for the late response! I've been out of town for a while.

@MarkTiedemann those all look like great options! I didn't realize so many people had created version managers.

Personally, I think the ideal solution would be a new tool to replace deno upgrade and probably deno_install. It could handle installation of Deno, Deno version management, and possibly local versions of the Deno docs (I love how you can just run rustup doc --book to view the Rust book offline).

I know it could benefit from being standardized and being more beginner-friendly.

I think this would be a huge benefit to users. Not having to do a lot of research to figure out which version manager was better could be a huge time saver, and a standardized solution could allow repositories to easily specify "pinned" Deno versions and directory overrides that would be recognized whether or not a user had installed a specific version manager.


Allow setting a specific Deno version on the directory level

I'm curious. How would that be implemented?

Here's how Rustup does it: https://github.com/rust-lang/rustup#directory-overrides

As far as adding to the user's $PATH, I believe Rustup appended to my ~/.profile. After a quick search I was able to find their tests checking $PATH updating here. It looks to me like they check several things to determine which file to edit, .bashrc, .profile, etc.

I think just appending to .profile on macOS and Linux would be easy to implement, and probably work perfectly in most cases.

bgub avatar Aug 14 '20 20:08 bgub