Private registries
Private registries are often used inside of companies to control access to packages, for example to ensure that only approved packages are used. JSR can integrate with NPM private registries so that you can use JSR packages inside of companies that require the use of an NPM private registry.
Note: JSR does not provide private registry functionality itself at this time. This means that it is currently not possible to publish private packages to JSR. This is a feature that is being tracked in issue #203.
Using JSR as an upstream for an NPM private registry
When JSR is used as an upstream for an NPM private registry, the private registry proxies requests to JSR for packages that are not found in the private registry to JSR. This allows the private registry to be used as a cache for JSR packages, and enforce rules about which packages may be used within the company.
To use JSR as an upstream for an NPM private registry, you need to configure the private registry to proxy requests to JSR. The exact steps to do this depend on the private registry software that you are using. Below are some examples of how to configure some popular private registry software to use JSR as an upstream.
Configuring a JSR upstream with Azure DevOps Artifacts
To use JSR as an upstream for Azure DevOps Artifacts, you need to create a new upstream source in Azure DevOps Artifacts that points to JSR. You can do this by following these steps:
- Go to the “Artifacts” section of your Azure DevOps project.
- Create a new feed or select an existing feed. When creating a new feed, the default options will work fine.
- Click on the “Feed Settings” button in the top right corner of the feed page. It is displayed as a gear icon.
- Click on the “Upstream sources” tab in the feed settings.
- Click on the “Add Upstream” button.
- Select “Public Source” when asked about the type of upstream source.
- In the “Public Source” dropdown, select “Custom registry”.
- Enter the URL of the JSR registry in the “Custom registry URL” field. The URL
of the JSR registry is
https://npm.jsr.io
. - Select “npm” as the “Package type”.
- Enter “JSR” as the “Upstream source name”.
- Click on “Save” to save the upstream source.
- Select the “JSR” upstream source in the list of upstream sources and press the “Move up” button until it is above the “npmjs” upstream source. This ensures that JSR is checked before the public NPM registry.
- Click on “Save” in the top right corner of the upstream sources page to save the changes to the upstream sources.
After you have configured JSR as an upstream for Azure DevOps Artifacts, you can add packages from JSR to your feed in Azure DevOps Artifacts. When a package is added to the feed, it is accessible to users of the feed. To do this, follow these steps:
- Go to the “Artifacts” section of your Azure DevOps project.
- Select the feed that you want to add the package to. This feed must have JSR configured as an upstream (see above).
- Click on “Search upstream sources” in the feed page.
- Select “npm” as the package type.
- Enter the name of the package that you want to add to the feed, in the form:
@jsr/scope__package
. For example, to add@luca/cases
, enter@jsr/luca__cases
. - Click on “Search”.
- Select the package and version you’d like to add to the feed, and select “Add to feed” from the dropdown menu (three vertical dots next to the package).
After you have added the package to the feed, it will be available to users of
the feed. Users can install the package using the npm install
command, and the
package will be fetched from JSR. Users do not have to configure JSR as an
upstream in their .npmrc
file, as the JSR packages will now be available from
the Azure DevOps Artifacts feed.
Configuring a JSR upstream with Google Artifact Registry
JSR can not yet be used as an upstream for Google Artifact Registry due to a differing layout of package tarball URLs between JSR and the layout that is expected by Google Artifact Registry.
Aligning JSRs package tarball URLs with the NPM upstream is being tracked in issue #405.
Configuring a JSR upstream with JFrog Artifactory
JSR can not yet be used as an upstream for JFrog Artifactory due to a differing layout of package tarball URLs between JSR and the layout that is expected by JFrog Artifactory.
Aligning JSRs package tarball URLs with the NPM upstream is being tracked in issue #405.