mirror of
https://github.com/pnpm/action-setup.git
synced 2026-05-14 14:23:32 +08:00
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:
76
dist/index.js
vendored
76
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -100,10 +100,10 @@ export async function runSelfInstaller(inputs: Inputs): Promise<SelfInstallerRes
|
||||
// `${steps.pnpm.outputs.bin_dest}/pnpm`) invoke the requested version.
|
||||
//
|
||||
// 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
|
||||
// pnpmHome, whose symlinks already point at the right version.
|
||||
const updatedBin = path.join(pnpmHome, 'bin', process.platform === 'win32' ? 'pnpm.exe' : 'pnpm')
|
||||
return { exitCode: 0, binDest: existsSync(updatedBin) ? path.join(pnpmHome, 'bin') : pnpmHome }
|
||||
// is a no-op and PNPM_HOME/bin is not created — fall back to pnpmHome,
|
||||
// whose symlinks already point at the right version.
|
||||
const updatedBinDir = path.join(pnpmHome, 'bin')
|
||||
return { exitCode: 0, binDest: existsSync(updatedBinDir) ? updatedBinDir : pnpmHome }
|
||||
}
|
||||
|
||||
// No exact target version we can self-update to (devEngines pins a
|
||||
|
||||
Reference in New Issue
Block a user