mirror of
https://github.com/pnpm/action-setup.git
synced 2026-04-03 19:00:10 +08:00
fix: run setup.js after self-update to create pn/pnx hardlinks
self-update replaces the @pnpm/exe package files but does not re-run
preinstall scripts. This leaves pn/pnpx/pnx as placeholder files
("This file intentionally left blank") instead of hardlinks to the
actual binary. Run setup.js explicitly after self-update to fix this.
This commit is contained in:
236
dist/index.js
vendored
236
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -59,9 +59,20 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
||||
if (exitCode !== 0) {
|
||||
return exitCode
|
||||
}
|
||||
|
||||
// self-update replaces package files but does not re-run preinstall
|
||||
// scripts, so setup.js (which hardlinks pn/pnpx/pnx to the binary)
|
||||
// needs to be run explicitly.
|
||||
if (standalone) {
|
||||
const exeDir = path.join(dest, 'node_modules', '@pnpm', 'exe')
|
||||
const setupScript = path.join(exeDir, 'setup.js')
|
||||
if (existsSync(setupScript)) {
|
||||
await runCommand(process.execPath, [setupScript], { cwd: exeDir })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create pn/pnx alias symlinks if the installed version supports them
|
||||
// Create pn/pnx alias bin links if the installed version supports them
|
||||
// (pnpm v11+ adds pn and pnx as short aliases)
|
||||
await ensureAliasLinks(pnpmHome, standalone)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user