From dbaa8eaa370701ca276fb105d0419fb27d666d77 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 4 Sep 2023 17:43:36 +0200 Subject: [PATCH 1/3] doc: update `corepack.md` to account for 0.20.0 changes --- doc/api/corepack.md | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/doc/api/corepack.md b/doc/api/corepack.md index c023a24183348e..906c3a8462a120 100644 --- a/doc/api/corepack.md +++ b/doc/api/corepack.md @@ -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,23 +52,31 @@ 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 pnpm@7.x # 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 yarn@x.y.z --activate +corepack install --global yarn@x.y.z ``` 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 @@ -76,11 +84,11 @@ corepack prepare yarn@stable --activate 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 install`][] 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,14 @@ 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 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 From 9b91684de5480813e035f5920bb17ef2e187d07e Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 11 Sep 2023 09:57:19 +0200 Subject: [PATCH 2/3] Update doc/api/corepack.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Maƫl Nison --- doc/api/corepack.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/corepack.md b/doc/api/corepack.md index 906c3a8462a120..66e9fb2b24c018 100644 --- a/doc/api/corepack.md +++ b/doc/api/corepack.md @@ -84,7 +84,7 @@ corepack install --global yarn@stable 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 install`][] 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. From 9a68661c16d189dd0b02b56e54c46cc31a115108 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 11 Sep 2023 09:59:02 +0200 Subject: [PATCH 3/3] Update doc/api/corepack.md --- doc/api/corepack.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/api/corepack.md b/doc/api/corepack.md index 66e9fb2b24c018..b9c3ddca09c78c 100644 --- a/doc/api/corepack.md +++ b/doc/api/corepack.md @@ -133,6 +133,7 @@ install. To avoid this problem, consider one of the following options: [`corepack disable`]: https://github.com/nodejs/corepack#corepack-disable--name [`corepack enable`]: https://github.com/nodejs/corepack#corepack-enable--name [`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