`.bashrc` lines should be added by default in the install one-liner
josephrocca opened this issue · 9 comments
TL;DR: Rust, Bun, and many other tools add .bashrc
lines automatically, and this makes it a lot easier to quickly get up and running with a tool, especially for newbies. I really think Deno should add .bashrc
lines automatically.
Each time I have to install Deno on a new machine (not often), I'm re-surprised that a one-liner install is made into a multi-step, newbie-confusing process. It's not that it's hard/annoying for me, because I very rarely have to do it and I'm an experienced dev, but I'm just surprised that this very obvious friction is sitting there, year after year.
I find it hard to believe that the team hasn't considered reducing the friction by the install experience one-step, so I'm (wildly) guessing someone on the team has a kind of ~ideological/"correctness"/theoretical position against it or something, but, again, I'm wildly guessing here and could be completely off-base on that assumption.
I guess another possibility here is that the team has a kind of "curse of knowledge", and so doesn't actually perceive this as friction for newer devs. I've tutored in coding so it's painful for me to see such plain and fixable friction, knowing how hard it can be for newer devs to deal with "simple" stuff like this, especially when the full instruction given to them is just this blob of unformatted/unspaced text:
Archive: /home/joe/.deno/bin/deno.zip
inflating: /home/joe/.deno/bin/deno
Deno was installed successfully to /home/joe/.deno/bin/deno
Manually add the directory to your $HOME/.bashrc (or similar)
export DENO_INSTALL="/home/joe/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"
Run '/home/joe/.deno/bin/deno --help' to get started
- Experienced devs are experienced, they can read the text
Added "~/.deno" to $PATH in "~/.bashrc"
in the install logs and remove it if they want to, and they can then go to the docs and find the flag to add to the one-liner which disables auto-adding to bashrc for future installs. - Common things should be easy. People who want to do uncommon / off-the-beaten-track stuff (like not adding Deno to bashrc) should (and can easily) shoulder the burden, rather than lumping that burden on newbies - the ones who are least likely to be able to deal with extra burden. (bolded for skimming, since I think this is the crux of the overall argument)
I installed Bun just now, and they add it automatically. Rust does too. Also, another thing to take inspiration from Bun is the formatting of the install text:
(Deno's kinda makes my eyes defocus. But that's just an aside - not super important.)
Please, for the benefit of newbies and the growth of Deno, add the bashrc lines automatically 🙏
Thank you for coming to my ted talk.
Additionally also environment variables (DENO_INSTALL
, PATH
) in the current shell session could be updated so users can start using deno
directly without the need to restart shell or rerun ~/.bashrc
.
Unfortunately I don't think that part is possible (though I could be wrong), so there should instead be a clear instruction like in Bun/Rust/etc.
+1
@mmastrac Any chance this could could be fixed for v2.0?
PRs welcome.
Historically we keep rejecting this suggestion. ref #52 #157 #177 #178 #231 #268
One reason is that proper shell detection is more difficult in *nix system (there are many shells and they use different profile paths) than on windows. Another reason is that we'd like to keep the script easily understandable & auditable by the users.
I'm not sure I'll say anything to convince you here that you haven't already heard, assuming you read at least the bold parts of my original post, but: Deno install experience could be delightful, and other projects realise how important this is, and are willing to trade away (legitimately important) things for that (like install script simplicity, as you say). MacOS+Windows+Ubuntu would be enough. No need to dump *nix burdens on newbies - just add one new flag, and add that to the default install command on the install docs page. Or add even add a dropdown to select OS. Or almost literally anything other than making people manually add stuff to their bashrc. Newbies will suffer less, can't save souls in an empty church, etc.
If you are unmoved, please feel free to close this issue - painful, but no hard feelings.
Bun, for example, does the detection of bash, zsh, fish, and it takes ~116 lines for it https://github.com/oven-sh/bun/blob/ba5dd63eb6d2855fd814fbc92589f796b5b8adf5/src/cli/install.sh#L179-L295, which is almost double of our current install.sh (60 lines). I'm not sure it's worth it
@ry Do you still feel strongly about this policy?
+1 on adding those by default. This removes a point of friction for new users. We should do this and the benefits for new users far outweighs concerns over lines of code of the install script to me.