fix: check bin/ dir instead of pnpm.exe for self-update detection

On Windows pnpm self-update writes `.bin/bin/pnpm` (a JS launcher),
not `.bin/bin/pnpm.exe`, so the previous existsSync probe always
fell back to pnpmHome and the bin_dest output pointed at the
bootstrap pnpm. Check whether the `bin` directory itself exists.
This commit is contained in:
Zoltan Kochan
2026-05-11 13:41:06 +02:00
parent 6f51e58a4c
commit 29b3fcd571
2 changed files with 42 additions and 42 deletions

76
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -100,10 +100,10 @@ export async function runSelfInstaller(inputs: Inputs): Promise<SelfInstallerRes
// `${steps.pnpm.outputs.bin_dest}/pnpm`) invoke the requested version. // `${steps.pnpm.outputs.bin_dest}/pnpm`) invoke the requested version.
// //
// When the requested version equals the bootstrap version, self-update // When the requested version equals the bootstrap version, self-update
// is a no-op and PNPM_HOME/bin/pnpm is not created — fall back to // is a no-op and PNPM_HOME/bin is not created — fall back to pnpmHome,
// pnpmHome, whose symlinks already point at the right version. // whose symlinks already point at the right version.
const updatedBin = path.join(pnpmHome, 'bin', process.platform === 'win32' ? 'pnpm.exe' : 'pnpm') const updatedBinDir = path.join(pnpmHome, 'bin')
return { exitCode: 0, binDest: existsSync(updatedBin) ? path.join(pnpmHome, 'bin') : pnpmHome } return { exitCode: 0, binDest: existsSync(updatedBinDir) ? updatedBinDir : pnpmHome }
} }
// No exact target version we can self-update to (devEngines pins a // No exact target version we can self-update to (devEngines pins a