Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
collapsed reference link as per @aduh95
Sorted reference links using this pattern:
`/^\[[^\w]*(.+?)\]: /`
  • Loading branch information
mrienstra committed Sep 15, 2022
commit 850a30d2fdb25b1064f64d8fed4e485331cf8e08
11 changes: 6 additions & 5 deletions doc/api/corepack.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ package manager version you wish to set:
corepack prepare yarn@x.y.z --activate
```

Alternately, a [`dist-tag`](https://docs.npmjs.com/downloading-and-installing-packages-locally#installing-a-package-with-dist-tags) may be used:
Alternately, a [`dist-tag`][] may be used:

```bash
corepack prepare yarn@latest --activate
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
corepack prepare yarn@latest --activate
corepack prepare yarn@stable --activate

@latest is not a valid tag for yarn.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean? @latest is always a valid tag on npm (it cannot be deleted).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yarn Berry is not on npm:

$ corepack prepare yarn@latest           
(node:96490) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Usage Error: Tag not found (latest)

$ corepack prepare yarn@stable
(node:96513) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Preparing yarn@stable...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, it would be confusing to point to the npmjs documentation about dist-tags, no?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, using a link is probably not necessary. And maybe better not to use Yarn in the example since it's the odd one out?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also have several examples, e.g.:

```bash
corepack prepare pnpm@latest --activate
corepack prepare yarn@stable --activate
```

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aduh95, I like that ("several examples"), just pushed a commit to change it to that.

FYI, when I run prepare with yarn stable & latest (node v18.9.0, corepack 0.14.0, starting with Yarn 3.2.3), I get:
corepack prepare yarn@stable --activate --> Preparing yarn@stable for immediate activation..., still on Yarn 3.2.3 after.
corepack prepare yarn@latest --activate --> Usage Error: Tag not found (latest), still on Yarn 3.2.3 after (of course).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it to say "a tag or range may be used" instead of "a dist-tag may be used", since dist-tag is rarely specified in docs for npm, Yarn or pnpm. I think I was being too specific / low-level. Dropped the link as well.

Tempted to link to https://github.com/npm/node-semver#ranges, that's where /cli/v8/configuring-npm/package-json#dependencies links to.

There aren't any really great high-level docs for tags. /cli/v8/configuring-npm/package-json#dependencies links to /cli/v8/commands/npm-dist-tag, which isn't ideal (focused on modification, not usage), though I guess /cli/v8/commands/npm-dist-tag#purpose is nice. Considering expanding /downloading-and-installing-packages-locally#installing-a-package-with-dist-tags, maybe pulling some content from /cli/v8/commands/npm-dist-tag#purpose. Maybe I'll open an issue for that next week.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tempted to link to https://github.com/npm/node-semver#ranges, that's where /cli/v8/configuring-npm/package-json#dependencies links to.

npm being one of the package managers, I think linking to SemVer rather than to npm would be preferable to not give a competitive adventage to one rather the others.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aduh95, I'll be out until Monday, feel free to link out to docs for tag and / or range if you think that would be helpful.

Still a little tempted to clarify when Corepack added support for using a tag or range (Corepack v0.120, which shipped with Node.js v18.6.0 and v16.17.0), but not sure if that should be formatted in a special way.

Expand Down Expand Up @@ -118,15 +118,16 @@ install. To avoid this problem, consider one of the following options:
[`corepack enable`][] to add them back.)

[Corepack]: https://github.com/nodejs/corepack
[Corepack documentation]: https://github.com/nodejs/corepack#readme
[Corepack repository]: https://github.com/nodejs/corepack
[Yarn]: https://yarnpkg.com
[`"packageManager"`]: packages.md#packagemanager
[`corepack disable`]: https://github.com/nodejs/corepack#corepack-disable--name
[Corepack documentation]: https://github.com/nodejs/corepack#readme
[`corepack enable`]: https://github.com/nodejs/corepack#corepack-enable--name
[`corepack prepare`]: https://github.com/nodejs/corepack#corepack-prepare--nameversion
[Corepack repository]: https://github.com/nodejs/corepack
[`dist-tag`]: https://docs.npmjs.com/downloading-and-installing-packages-locally#installing-a-package-with-dist-tags
[`package.json`]: packages.md#nodejs-packagejson-field-definitions
[`"packageManager"`]: packages.md#packagemanager
[pnpm]: https://pnpm.js.org
[supported binaries]: #supported-package-managers
[supported package manager]: #supported-package-managers
[various flags]: https://github.com/nodejs/corepack#utility-commands
[Yarn]: https://yarnpkg.com