From d5ef940ec5b3a88880c07b71cd87356893a69cdd Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Fri, 19 May 2023 10:16:48 +0200 Subject: [PATCH] chore(docs): document how to use aliases instead of jumper binaries (#244) Co-authored-by: Kristoffer K. --- README.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 39d55d2..0fdf143 100644 --- a/README.md +++ b/README.md @@ -131,12 +131,37 @@ on a project where the `packageManager` field references `pnpm`). | --------------------- | --------------------------------------- | | `--install-directory` | Add the shims to the specified location | -This command will detect where Node.js is installed and will create shims next +This command will detect where Corepack is installed and will create shims next to it for each of the specified package managers (or all of them if the command is called without parameters). Note that the npm shims will not be installed unless explicitly requested, as npm is currently distributed with Node.js through other means. +If the file system where the `corepack` binary is located is read-only, this +command will fail. A workaround is to add the binaries as alias in your +shell configuration file (e.g. in `~/.bash_aliases`): + +```sh +alias yarn="corepack yarn" +alias yarnpkg="corepack yarnpkg" +alias pnpm="corepack pnpm" +alias pnpx="corepack pnpx" +alias npm="corepack npm" +alias npx="corepack npx" +``` + +On Windows PowerShell, you can add functions using the `$PROFILE` automatic +variable: + +```powershell +echo "function yarn { corepack yarn `$args }" >> $PROFILE +echo "function yarnpkg { corepack yarnpkg `$args }" >> $PROFILE +echo "function pnpm { corepack pnpm `$args }" >> $PROFILE +echo "function pnpx { corepack pnpx `$args }" >> $PROFILE +echo "function npm { corepack npm `$args }" >> $PROFILE +echo "function npx { corepack npx `$args }" >> $PROFILE +``` + ### `corepack disable [... name]` | Option | Description |