docs: add Deno to the package manager tabs#2395
Conversation
✅ Deploy Preview for expressjscom-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
- npx <pkg> -> deno x <pkg> (was deno run -A npm:<pkg>) - npm create <starter> -> deno create --npm <starter> (was omitted)
| // Deno adds to deno.json/package.json; it has no `--no-save`, and global | ||
| // tool installs use a different verb (`deno install -g`), so skip those. | ||
| deno: hasNoSave || isGlobal ? null : join('deno add', isDev && '--dev', pkgs, extras), |
There was a problem hiding this comment.
If deno has no --no-save then why do you return true instead of null (like you wrote in the description)1? For consistency it would be better to change this to chained ternary operators to match the structure used for other package managers (it would also fix the problem described in the previous sentence).
According to your docs deno add is an alias to deno install - using deno install would allow you to use this way of "assembling" the command using join to include global installs. And nothing prevents you from using deno install when isGlobal is true and deno add when it's false.
Footnotes
-
LLMs generating code frequently write one thing in description and something completely else in code. ↩
There was a problem hiding this comment.
Thanks for the review, I did another pass on this one and corrected the mistake here and in deno x invocation. I also removed the comment here since it's not really needed.
- Use chained ternary like pnpm/bun; global installs -> deno install -g <pkg> (deno add is an alias of deno install), instead of returning null - Drop the unnecessary exec ? ... : null conditional on the deno x mapping
| yarn: isGlobal ? join('yarn global remove', pkgs) : join('yarn remove', pkgs), | ||
| pnpm: join('pnpm remove', isGlobal && '--global', pkgs), | ||
| bun: join('bun remove', isGlobal && '--global', pkgs), | ||
| deno: isGlobal ? null : join('deno remove', pkgs), |
There was a problem hiding this comment.
I'm pretty sure that Deno allows uninstalling packages installed globally.
BTW Deno docs say that add is an alias of install and remove is an alias of uninstall, but aliases usually accept the same parameters.
There was a problem hiding this comment.
Thanks for the catch, actually it looks like deno remove doesn't accept --global. I'll fix it for Deno v2.9 and can open a follow up PR once it lands if that works for you.
There was a problem hiding this comment.
Good catch, thanks! Fixed — global removals now map to deno uninstall --global <pkg> (mirroring the yarn global remove branch) instead of being dropped. You're right that remove/uninstall are aliases, but only uninstall takes --global, so I used that for the global case.
bjohansebas
left a comment
There was a problem hiding this comment.
Does Deno now actually install the package into node_modules so it can be executed with Node? I'm asking because Bun does, and that's why it's listed there. I wasn't sure about Deno because I didn't know whether it does that now, and officially Express doesn't support it (even though we all know it runs fine).
@bjohansebas yes! You can use |
If I'm reading this correctly it can, but doesn't by default:
https://docs.deno.com/runtime/fundamentals/node/#control-node_modules |
Yes I wasn't precise. Currently |
bjohansebas
left a comment
There was a problem hiding this comment.
LGTM. An Express project naturally has a package.json, and if that automatically installs node_modules and can be run with Node, I'm more than happy with that.
I'll wait a bit to see if @expressjs/express-tc @expressjs/docs-wg has any thoughts on this, because right now I feel like I probably shouldn't have added Bun in the first place. That said, Bun is also a package manager, which is why I added it, and Deno is a package manager as well, so I feel comfortable adding it too.
If someone uses It works as a package manager only in already existing projects and can't be used to initialise one. |
|
Good distinction. The Deno tab here is the equivalent of the |

👋 Bartek from the Deno team here.
This adds Deno as a fifth option to the
<PackageManagerCommand>tabs, alongside npm / yarn / pnpm / bun. Since the equivalents are derived at build time from the authored npm command (viaconvertPackageManagerCommand), Deno now appears on every install snippet across the site and in every language, with no per-page changes.Mappings added (Deno is a drop-in package manager for the npm ecosystem):
npm install <pkg>→deno add <pkg>(e.g.deno add express)npm install(no packages) →deno installnpm uninstall <pkg>→deno remove <pkg>npm init→deno initnpm create <starter>→deno create --npm <starter>npm run <script>→deno task <script>npm exec <pkg>/npx <pkg>→deno x <pkg>Following the existing pattern, commands with no clean Deno equivalent return
null, so the Deno tab is simply omitted there (e.g.npm install <pkg> --no-save, global installs).I verified locally with
astro dev: the install page renders a Deno tab showingdeno add express(anddeno initfornpm init), the--no-savesnippet correctly omits Deno, andprettier --checkpasses. Every Deno command was checked against the Deno 2.8 CLI.Two files changed: the converter (
src/utils/package-manager.ts) and theMANAGERSlist in the component's tab-switching script.Totally fine to close this if you'd prefer not to add another tab. Happy to adjust any of the mappings.
Disclosure: I work on Deno, so I have an interest here. The goal is parity with the package managers you already list, not promotion. This PR was prepared with AI assistance under human supervision: I review every change myself and personally respond to any comments or review feedback.