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

[FEATURE] Support jsr: registry/protocol #98

Open
darcyclarke opened this issue Jul 12, 2024 · 0 comments
Open

[FEATURE] Support jsr: registry/protocol #98

darcyclarke opened this issue Jul 12, 2024 · 0 comments
Labels
feature feature or request

Comments

@darcyclarke
Copy link
Member

darcyclarke commented Jul 12, 2024

Description

JSR is npm compatible by offering their packages as scoped packages (ie. @jsr/*) & modifying the package names to be transformed with underscores instead of forward slashes delimitating the scope+name (ex. @luca/cases becomes @jsr/luca__cases).

Currently, users need to create a .npmrc file with a scoped config (ex. @jsr:registry=https://npm.jsr.io) & this will allow users of npm, pnpm, bun etc. to install those packages (ex. npm install @jsr/luca__cases@1). We can do better.

Suggestion

We should support a jsr: protocol by default in Spec/DepID so that user's don't need to use the weird double underscore pattern & define a scoped registry config. This kind of first-class support can net us some good-will from the Deno community & also helps them tell a more cohesive story for managing JSR packages (since the Deno runtime itself & deno.json files let users reference JSR packages as jsr:@luca/cases).

Implementation

  • support jsr: by default in Spec
  • transform the scope+name to be compatible for fetching from https://npm.jsr.io (ie. the definition jsr:@luca/cases will result in us fetching a Packument for @jsr/luca__cases from https://npm.jsr.io/) in pick-manifest

Example Fetch Manifest Logic

if (spec.namedRegistry === 'jsr') {
  const isScoped = spec.name[1] === '@'
  const parts = spec.name.split('/')
  const path = isScoped ? `${parts[0].substring(1)}__${parts[1]}` : spec.name
  const manifest = `${spec.registry}/@jsr/${path}`
}
@darcyclarke darcyclarke added the feature feature or request label Jul 12, 2024
@isaacs isaacs added this to the Post NodeConf EU milestone Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature feature or request
Projects
None yet
Development

No branches or pull requests

2 participants