denoland / deno_install

Deno Binary Installer
https://deno.land/
MIT License
966 stars 179 forks source link

feat: Add a script to set up the PATH and install shell completions #295

Closed nathanwhit closed 3 weeks ago

nathanwhit commented 4 weeks ago

Ref https://github.com/denoland/deno/issues/24157

Written in typescript for maintainability and ease of contribution (I am not good at bash scripts, and I think most people are more comfortable with TS than bash). The downside is that we only support this for deno 1.42 and above. I think this is fine because most people installing deno interactively are likely to be installing new deno versions.

The actual PATH setup logic and general shape is largely adapted from rustup.

Here's what it looks like currently:

https://github.com/user-attachments/assets/1fb4200f-538b-4237-a90c-55849e870a3a

Some features:

Things I am unsure about:

bartlomieju commented 4 weeks ago

Whether to prompt for writing to outside of the install dir currently I only allow-write for the install dir (~/.deno) I thought it was a nice opportunity to show of the permission system, and so users know what we're modifying, but it may be more noise than it's worth

That seems undesirable IMO - running installation script shouldn't prompt at all - we should add entry to .bashrc by default and print information about it. Power users who don't want that we'll be able to remove it.

littledivy commented 4 weeks ago

That seems undesirable IMO - running installation script shouldn't prompt at all

I agree. The shell script writes out deno binary to file system anyways so asking for permission doesn't make sense.

lucacasonato commented 4 weeks ago

It would be nice if we bundled the code here into a single JS file and ran that. Pulling in dax in the installer is kinda annoying.

nathanwhit commented 3 weeks ago

Okay, I updated this to bundle into one entrypoint, and also removed the dependency on dax (I was just using it for prompts, and it's overkill. Instead I just adapted some of the code from dax, replacing the rust WASM dependencies with js, and published a little library https://jsr.io/@nathanwhit/promptly). That brings the bundled size down to 20KB.

Also updated to avoid permission prompts, as suggested.


All that's left is to publish to JSR, and then this should be good to go.

nathanwhit commented 3 weeks ago

Published to JSR, this should be ready to go.

Just need to merge this PR and update deno.land/install.sh