fix: correct corepack self-update instructions (#9101)

* fix: correct corepack self-update instructions

The previous instructions did not actually update the pnpm version used
by corepack in the local project.

See https://github.com/nodejs/corepack/issues/587
This commit is contained in:
Thomas Scholtes
2025-02-14 00:01:23 +01:00
committed by GitHub
parent 4aa6d45e5c
commit 7b9a9af38f
3 changed files with 8 additions and 2 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/default-reporter": patch
"pnpm": patch
---
Fix instruction for updating pnpm with corepack [#9101](https://github.com/pnpm/pnpm/pull/9101).

View File

@@ -50,7 +50,7 @@ function renderUpdateMessage (opts: UpdateMessageOptions): string {
function renderUpdateCommand (opts: UpdateMessageOptions): string {
if (isExecutedByCorepack(opts.env)) {
return `corepack install -g pnpm@${opts.latestVersion}`
return `corepack use pnpm@${opts.latestVersion}`
}
if (opts.env.PNPM_HOME) {
return 'pnpm self-update'

View File

@@ -6,7 +6,7 @@ exports[`print update notification for Corepack if the latest version is greater
│ │
│ Update available! 10.0.0 → 11.0.0. │
│ Changelog: https://github.com/pnpm/pnpm/releases/tag/v11.0.0 │
│ Run "corepack install -g pnpm@11.0.0" to update. │
Run "corepack use pnpm@11.0.0" to update.
│ │
╰──────────────────────────────────────────────────────────────────╯
"