Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow 3-word install with npm, pnpm, yarn, bun (w. fallback to npm registry) #29

Open
karlhorky opened this issue Mar 1, 2024 · 2 comments
Labels
question Further information is requested

Comments

@karlhorky
Copy link

karlhorky commented Mar 1, 2024

Problem

If I take @mxdvl/valibot as an example, the commands are varied in DX:

Deno: nice, 3 words, just like using npm registry packages with npm/Yarn/pnpm

deno add @mxdvl/valibot

All other package managers: verbose and hard to remember:

# 4 words
npx jsr add @mxdvl/valibot
bunx jsr add @mxdvl/valibot

# 5 words
pnpm dlx jsr add @mxdvl/valibot
yarn dlx jsr add @mxdvl/valibot

Proposal

Contribute / propose features to all common package managers npm, pnpm, yarn, bun to allow for simple 3-word commands with better DX:

# 3 words
npm add @mxdvl/valibot
pnpm add @mxdvl/valibot
bun add @mxdvl/valibot
yarn add @mxdvl/valibot

Fallback to npm feature: If the package is not found in jsr.io's registry, then the npm registry will be searched, using the rules that jsr currently uses

This may require some sort of:

  1. multiple registry support
  2. prioritization of registry order (eg. jsr first, then npm)
  3. option to exclude a registry (eg. jsr first, npm never)

...or maybe package managers already have both these features? If so, maybe that should be suggested as the first way to install the package instead of the npx, bunx, dlx commands above...? 🤔

Alternatives considered

Add a small global jsr binary that will add/update/remove the package with your current package manager, similar to Corepack

jsr add @mxdvl/valibot

Relevant discussion is happening recently about Corepack's "packageManager" field:

  1. Enable Corepack by default (issue) enable corepack by default nodejs/node#50963
  2. Enable Corepack yarn and pnpm by default (PR) build: enable yarn and pnpm Corepack binaries by default nodejs/node#51886
  3. "packageManager" doesn't support npm "packageManager" field doesn’t support npm nodejs/node#51888
  4. "packagemanager" field is too limited packageManager field is too limited nodejs/corepack#402
  5. Define spec for development environment field Define spec for development environment field openjs-foundation/package-metadata-interoperability-collab-space#15
@marvinhagemeister
Copy link
Collaborator

Agree, would be cool to see direct integration with JSR in other package managers. We provided this tiny cli here to start from somewhere and to show what the workflow can look like. Now that JSR is out to the public we're hoping that other package managers would be open to consider supporting JSR directly. Happy to see that some discussions are already happening on how to support multiple registries.

@marvinhagemeister marvinhagemeister added the question Further information is requested label Mar 4, 2024
@marvinhagemeister
Copy link
Collaborator

marvinhagemeister commented Mar 4, 2024

Marking as question, because there is nothing to do on our end for now in JSR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants