-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
doc: update corepack.md
to account for 0.20.0 changes
#49486
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
3 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ added: | |
|
||
> Stability: 1 - Experimental | ||
|
||
_[Corepack][]_ is an experimental tool to help with | ||
_[Corepack][Corepack repository]_ is an experimental tool to help with | ||
managing versions of your package managers. It exposes binary proxies for | ||
each [supported package manager][] that, when called, will identify whatever | ||
package manager is configured for the current project, transparently install | ||
|
@@ -52,35 +52,43 @@ sure that all calls to the relevant binaries are run against the requested | |
version, downloading it on demand if needed, and aborting if it cannot be | ||
successfully retrieved. | ||
|
||
You can use [`corepack use`][] to ask Corepack to update your local | ||
`package.json` to use the package manager of your choice: | ||
|
||
```bash | ||
corepack use [email protected] # sets the latest 7.x version in the package.json | ||
corepack use yarn@* # sets the latest version in the package.json | ||
``` | ||
|
||
### Upgrading the global versions | ||
|
||
When running outside of an existing project (for example when running | ||
`yarn init`), Corepack will by default use predefined versions roughly | ||
corresponding to the latest stable releases from each tool. Those versions can | ||
be overridden by running the [`corepack prepare`][] command along with the | ||
be overridden by running the [`corepack install`][] command along with the | ||
package manager version you wish to set: | ||
|
||
```bash | ||
corepack prepare [email protected] --activate | ||
corepack install --global [email protected] | ||
``` | ||
|
||
Alternately, a tag or range may be used: | ||
|
||
```bash | ||
corepack prepare pnpm@latest --activate | ||
corepack prepare yarn@stable --activate | ||
corepack install --global pnpm@* | ||
corepack install --global yarn@stable | ||
``` | ||
|
||
### Offline workflow | ||
|
||
Many production environments don't have network access. Since Corepack | ||
usually downloads the package manager releases straight from their registries, | ||
it can conflict with such environments. To avoid that happening, call the | ||
[`corepack prepare`][] command while you still have network access (typically at | ||
[`corepack pack`][] command while you still have network access (typically at | ||
the same time you're preparing your deploy image). This will ensure that the | ||
required package managers are available even without network access. | ||
|
||
The `prepare` command has [various flags][]. Consult the detailed | ||
The `pack` command has [various flags][]. Consult the detailed | ||
[Corepack documentation][] for more information. | ||
|
||
## Supported package managers | ||
|
@@ -118,14 +126,15 @@ install. To avoid this problem, consider one of the following options: | |
override binaries, but you'll erase the Corepack ones in the process. (Run | ||
[`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 enable`]: https://github.com/nodejs/corepack#corepack-enable--name | ||
[`corepack prepare`]: https://github.com/nodejs/corepack#corepack-prepare--nameversion | ||
[`corepack install`]: https://github.com/nodejs/corepack#corepack-install--g--global---all--nameversion | ||
[`corepack pack`]: https://github.com/nodejs/corepack#corepack-pack---all--nameversion | ||
[`corepack use`]: https://github.com/nodejs/corepack#corepack-use-nameversion | ||
[`package.json`]: packages.md#nodejs-packagejson-field-definitions | ||
[pnpm]: https://pnpm.js.org | ||
[supported binaries]: #supported-package-managers | ||
|
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.