-
Notifications
You must be signed in to change notification settings - Fork 139
docs: update docs for Yarn and pnpm built-in JSR support #1029
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
fa06b28
docs: update docs for Yarn and pnpm built-in JSR support
lucacasonato 3671e32
Apply suggestions from code review
lucacasonato c194845
Apply suggestions from code review
lucacasonato 2560988
fix yarn commands
lucacasonato fd4b7ea
fmt
crowlKats aea7fa1
Merge branch 'main' into pnpm_yarn_ootb_support
crowlKats bca9fd0
Update api/src/docs.rs
crowlKats e0b855c
Update api/src/docs.rs
crowlKats c711d4c
ci
crowlKats ab72c97
Merge remote-tracking branch 'origin/pnpm_yarn_ootb_support' into pnp…
crowlKats File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,14 +15,16 @@ example below will add the most recent version of | |
[`@luca/cases`](https://jsr.io/@luca/cases) to your project. | ||
|
||
```bash | ||
# deno | ||
# deno, pnpm 10.9+, and yarn 4.9+ with first class JSR support | ||
deno add jsr:@luca/cases | ||
pnpm add jsr:@luca/cases | ||
yarn add jsr:@luca/cases | ||
|
||
# npm (one of the below, depending on your package manager) | ||
# npm, bun, and older versions of yarn or pnpm | ||
npx jsr add @luca/cases | ||
bunx jsr add @luca/cases | ||
yarn dlx jsr add @luca/cases | ||
pnpm dlx jsr add @luca/cases | ||
bunx jsr add @luca/cases | ||
``` | ||
|
||
If you're using Deno, the `deno add` command will add an | ||
|
@@ -38,24 +40,41 @@ something like this: | |
} | ||
``` | ||
|
||
For npm and npm-compatible package managers, the `jsr` command will add the | ||
dependency to your `package.json` file, along with a `.npmrc` file to your | ||
project root with the necessary config to use JSR with npm. Learn more about | ||
For npm compatible package managers, the dependency will be added to your | ||
`package.json` file, and the package will be installed to your `node_modules` | ||
directory. | ||
|
||
For npm, older versions of pnpm and Yarn, and for Bun, the `jsr` command will | ||
additionally add a `.npmrc` file to your project root with the necessary config | ||
to use JSR with npm. Learn more about | ||
[JSR's npm compatibility layer](/docs/npm-compatibility). | ||
|
||
After installation with `npx jsr add`, your package.json will contain a | ||
dependency entry that looks something like this: | ||
After installation with any npm compatible package manager, your package.json | ||
will contain a dependency entry that looks like one of these configurations: | ||
|
||
```json | ||
// pnpm 10.9+ and yarn 4.9+ | ||
{ | ||
"dependencies": { | ||
"@luca/cases": "jsr:@luca/cases@^1.0.1" | ||
} | ||
} | ||
``` | ||
|
||
or | ||
|
||
```json | ||
// npm, bun, and older versions of yarn or pnpm | ||
{ | ||
"dependencies": { | ||
"@luca/cases": "npm:@jsr/luca__cases@^1.0.1" | ||
} | ||
} | ||
``` | ||
|
||
This npm dependency configuration makes use of a special custom scope called | ||
`@jsr`, which is now configured for you in `.npmrc`: | ||
In npm, Bun, and older versions of yarn or pnpm the dependency configuration | ||
makes use of a special custom scope called `@jsr`, which is configured for you | ||
in `.npmrc`: | ||
|
||
``` | ||
@jsr:registry=https://npm.jsr.io | ||
|
@@ -99,41 +118,49 @@ If you only care about the major version, you can specify just the major | |
version: | ||
|
||
```bash | ||
# deno | ||
# deno, pnpm 10.9+ and yarn 4.9+ | ||
deno add jsr:@luca/cases@1 | ||
pnpm add jsr:@luca/cases@1 | ||
yarn add jsr:@luca/cases@1 | ||
|
||
# npm (and npm-like systems) | ||
# npm (and bun, and older versions of yarn or pnpm) | ||
npx jsr add @luca/cases@1 | ||
``` | ||
|
||
If you want to use a specific minor version, you can specify the minor version: | ||
|
||
```bash | ||
# deno | ||
# deno, pnpm 10.9+ and yarn 4.9+ | ||
deno add jsr:@luca/[email protected] | ||
pnpm add jsr:@luca/[email protected] | ||
yarn add jsr:@luca/[email protected] | ||
|
||
# npm (and npm-like systems) | ||
# npm (and bun, and older versions of yarn or pnpm) | ||
npx jsr add @luca/[email protected] | ||
``` | ||
|
||
If you want to use a specific patch version, you can specify the patch version: | ||
|
||
```bash | ||
# deno | ||
# deno, pnpm 10.9+ and yarn 4.9+ | ||
deno add jsr:@luca/[email protected] | ||
pnpm add jsr:@luca/[email protected] | ||
yarn add jsr:@luca/[email protected] | ||
|
||
# npm (and npm-like systems) | ||
# npm (and bun, and older versions of yarn or pnpm) | ||
npx jsr add @luca/[email protected] | ||
``` | ||
|
||
If you want to use at least a specific patch version, but do want to allow\ | ||
updates, you can specify the patch version with a `^` prefix: | ||
|
||
```bash | ||
# deno | ||
# deno, pnpm 10.9+ and yarn 4.9+ | ||
deno add jsr:@luca/cases@^1.0.1 | ||
pnpm add jsr:@luca/cases@^1.0.1 | ||
yarn add jsr:@luca/cases@^1.0.1 | ||
|
||
# npm (and npm-like systems) | ||
# npm (and bun, and older versions of yarn or pnpm) | ||
npx jsr add @luca/cases@^1.0.1 | ||
``` | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.