mirror of
https://github.com/pnpm/action-setup.git
synced 2026-04-04 11:20:11 +08:00
fix: address review feedback — PATH ordering and regex anchoring
- Swap addPath order so pnpmHome (with pnpm.exe) is prepended last and has highest precedence over pnpmHome/bin. - Anchor version regex with $ and allow prerelease suffixes.
This commit is contained in:
@@ -40,12 +40,13 @@ export async function runSelfInstaller(inputs: Inputs): Promise<number> {
|
||||
const pnpmHome = standalone && process.platform === 'win32'
|
||||
? path.join(dest, 'node_modules', '@pnpm', 'exe')
|
||||
: path.join(dest, 'node_modules', '.bin')
|
||||
// pnpm expects PNPM_HOME/bin in PATH for global binaries (e.g. node
|
||||
// installed via `pnpm runtime`). Add it first so the next addPath
|
||||
// (pnpmHome itself, which contains pnpm.exe) has higher precedence.
|
||||
addPath(path.join(pnpmHome, 'bin'))
|
||||
addPath(pnpmHome)
|
||||
exportVariable('PNPM_HOME', pnpmHome)
|
||||
|
||||
// pnpm expects PNPM_HOME/bin in PATH for global binaries
|
||||
addPath(path.join(pnpmHome, 'bin'))
|
||||
|
||||
// Ensure pnpm bin link exists — npm ci sometimes doesn't create it
|
||||
if (process.platform !== 'win32') {
|
||||
const pnpmBinLink = path.join(dest, 'node_modules', '.bin', 'pnpm')
|
||||
|
||||
Reference in New Issue
Block a user