denoland / deno_install

Deno Binary Installer
https://deno.land/
MIT License
968 stars 180 forks source link

Proposal: Rustup-like installer #156

Open nebrelbug opened 4 years ago

nebrelbug commented 4 years ago

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:

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.

ry commented 4 years ago

Does “deno upgrade” not solve this problem?

nebrelbug commented 4 years ago

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.

MarkTiedemann commented 4 years ago

@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:

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)?

nebrelbug commented 4 years ago

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.