Skip to content

Commit d316b32

Browse files
aduh95ruyadorno
authored andcommitted
doc: update corepack.md to account for 0.20.0 changes
PR-URL: #49486 Refs: nodejs/corepack#291 Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 142e256 commit d316b32

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

doc/api/corepack.md

+18-9
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ added:
1212

1313
> Stability: 1 - Experimental
1414
15-
_[Corepack][]_ is an experimental tool to help with
15+
_[Corepack][Corepack repository]_ is an experimental tool to help with
1616
managing versions of your package managers. It exposes binary proxies for
1717
each [supported package manager][] that, when called, will identify whatever
1818
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
5252
version, downloading it on demand if needed, and aborting if it cannot be
5353
successfully retrieved.
5454

55+
You can use [`corepack use`][] to ask Corepack to update your local
56+
`package.json` to use the package manager of your choice:
57+
58+
```bash
59+
corepack use pnpm@7.x # sets the latest 7.x version in the package.json
60+
corepack use yarn@* # sets the latest version in the package.json
61+
```
62+
5563
### Upgrading the global versions
5664

5765
When running outside of an existing project (for example when running
5866
`yarn init`), Corepack will by default use predefined versions roughly
5967
corresponding to the latest stable releases from each tool. Those versions can
60-
be overridden by running the [`corepack prepare`][] command along with the
68+
be overridden by running the [`corepack install`][] command along with the
6169
package manager version you wish to set:
6270

6371
```bash
64-
corepack prepare yarn@x.y.z --activate
72+
corepack install --global yarn@x.y.z
6573
```
6674

6775
Alternately, a tag or range may be used:
6876

6977
```bash
70-
corepack prepare pnpm@latest --activate
71-
corepack prepare yarn@stable --activate
78+
corepack install --global pnpm@*
79+
corepack install --global yarn@stable
7280
```
7381

7482
### Offline workflow
7583

7684
Many production environments don't have network access. Since Corepack
7785
usually downloads the package manager releases straight from their registries,
7886
it can conflict with such environments. To avoid that happening, call the
79-
[`corepack prepare`][] command while you still have network access (typically at
87+
[`corepack pack`][] command while you still have network access (typically at
8088
the same time you're preparing your deploy image). This will ensure that the
8189
required package managers are available even without network access.
8290

83-
The `prepare` command has [various flags][]. Consult the detailed
91+
The `pack` command has [various flags][]. Consult the detailed
8492
[Corepack documentation][] for more information.
8593

8694
## Supported package managers
@@ -118,14 +126,15 @@ install. To avoid this problem, consider one of the following options:
118126
override binaries, but you'll erase the Corepack ones in the process. (Run
119127
[`corepack enable`][] to add them back.)
120128

121-
[Corepack]: https://github.com/nodejs/corepack
122129
[Corepack documentation]: https://github.com/nodejs/corepack#readme
123130
[Corepack repository]: https://github.com/nodejs/corepack
124131
[Yarn]: https://yarnpkg.com
125132
[`"packageManager"`]: packages.md#packagemanager
126133
[`corepack disable`]: https://github.com/nodejs/corepack#corepack-disable--name
127134
[`corepack enable`]: https://github.com/nodejs/corepack#corepack-enable--name
128-
[`corepack prepare`]: https://github.com/nodejs/corepack#corepack-prepare--nameversion
135+
[`corepack install`]: https://github.com/nodejs/corepack#corepack-install--g--global---all--nameversion
136+
[`corepack pack`]: https://github.com/nodejs/corepack#corepack-pack---all--nameversion
137+
[`corepack use`]: https://github.com/nodejs/corepack#corepack-use-nameversion
129138
[`package.json`]: packages.md#nodejs-packagejson-field-definitions
130139
[pnpm]: https://pnpm.js.org
131140
[supported binaries]: #supported-package-managers

0 commit comments

Comments
 (0)