|
12 | 12 |
|
13 | 13 | > Stability: 1 - Experimental
|
14 | 14 |
|
15 |
| -_[Corepack][]_ is an experimental tool to help with |
| 15 | +_[Corepack][Corepack repository]_ is an experimental tool to help with |
16 | 16 | managing versions of your package managers. It exposes binary proxies for
|
17 | 17 | each [supported package manager][] that, when called, will identify whatever
|
18 | 18 | 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
|
52 | 52 | version, downloading it on demand if needed, and aborting if it cannot be
|
53 | 53 | successfully retrieved.
|
54 | 54 |
|
| 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 | + |
55 | 63 | ### Upgrading the global versions
|
56 | 64 |
|
57 | 65 | When running outside of an existing project (for example when running
|
58 | 66 | `yarn init`), Corepack will by default use predefined versions roughly
|
59 | 67 | 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 |
61 | 69 | package manager version you wish to set:
|
62 | 70 |
|
63 | 71 | ```bash
|
64 |
| -corepack prepare yarn@x.y.z --activate |
| 72 | +corepack install --global yarn@x.y.z |
65 | 73 | ```
|
66 | 74 |
|
67 | 75 | Alternately, a tag or range may be used:
|
68 | 76 |
|
69 | 77 | ```bash
|
70 |
| -corepack prepare pnpm@latest --activate |
71 |
| -corepack prepare yarn@stable --activate |
| 78 | +corepack install --global pnpm@* |
| 79 | +corepack install --global yarn@stable |
72 | 80 | ```
|
73 | 81 |
|
74 | 82 | ### Offline workflow
|
75 | 83 |
|
76 | 84 | Many production environments don't have network access. Since Corepack
|
77 | 85 | usually downloads the package manager releases straight from their registries,
|
78 | 86 | 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 |
80 | 88 | the same time you're preparing your deploy image). This will ensure that the
|
81 | 89 | required package managers are available even without network access.
|
82 | 90 |
|
83 |
| -The `prepare` command has [various flags][]. Consult the detailed |
| 91 | +The `pack` command has [various flags][]. Consult the detailed |
84 | 92 | [Corepack documentation][] for more information.
|
85 | 93 |
|
86 | 94 | ## Supported package managers
|
@@ -118,14 +126,15 @@ install. To avoid this problem, consider one of the following options:
|
118 | 126 | override binaries, but you'll erase the Corepack ones in the process. (Run
|
119 | 127 | [`corepack enable`][] to add them back.)
|
120 | 128 |
|
121 |
| -[Corepack]: https://github.com/nodejs/corepack |
122 | 129 | [Corepack documentation]: https://github.com/nodejs/corepack#readme
|
123 | 130 | [Corepack repository]: https://github.com/nodejs/corepack
|
124 | 131 | [Yarn]: https://yarnpkg.com
|
125 | 132 | [`"packageManager"`]: packages.md#packagemanager
|
126 | 133 | [`corepack disable`]: https://github.com/nodejs/corepack#corepack-disable--name
|
127 | 134 | [`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 |
129 | 138 | [`package.json`]: packages.md#nodejs-packagejson-field-definitions
|
130 | 139 | [pnpm]: https://pnpm.js.org
|
131 | 140 | [supported binaries]: #supported-package-managers
|
|
0 commit comments