fix: address review feedback — PATH ordering and regex anchoring
Some checks are pending
Test Action / Test with default inputs (macos-latest, 9.15.5) (push) Waiting to run
Test Action / Test with default inputs (ubuntu-latest, 9.15.5) (push) Waiting to run
Test Action / Test with default inputs (windows-latest, 9.15.5) (push) Waiting to run
Test Action / Test with dest (macos-latest, 9.15.5) (push) Waiting to run
Test Action / Test with dest (ubuntu-latest, 9.15.5) (push) Waiting to run
Test Action / Test with dest (windows-latest, 9.15.5) (push) Waiting to run
Test Action / Test with standalone (ubuntu-latest) (push) Waiting to run
Test Action / Test with standalone (windows-latest) (push) Waiting to run
Test Action / Test with devEngines.packageManager (macos-latest, 9.15.5) (push) Waiting to run
Test Action / Test with devEngines.packageManager (macos-latest, >=9.15.0) (push) Waiting to run
Test Action / Test with devEngines.packageManager (ubuntu-latest, 9.15.5) (push) Waiting to run
Test Action / Test with devEngines.packageManager (ubuntu-latest, >=9.15.0) (push) Waiting to run
Test Action / Test with devEngines.packageManager (windows-latest, 9.15.5) (push) Waiting to run
Test Action / Test with devEngines.packageManager (windows-latest, >=9.15.0) (push) Waiting to run
Test Action / Test with run_install (global, macos-latest) (push) Waiting to run
Test Action / Test with run_install (null, macos-latest) (push) Waiting to run
Test Action / Test with run_install (global, ubuntu-latest) (push) Waiting to run
Test Action / Test with run_install (null, ubuntu-latest) (push) Waiting to run
Test Action / Test with run_install (global, windows-latest) (push) Waiting to run
Test Action / Test with run_install (null, windows-latest) (push) Waiting to run

- 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:
Zoltan Kochan 2026-03-27 20:38:35 +01:00
parent 825c5d3936
commit 19566048c2
No known key found for this signature in database
GPG Key ID: 649E4D4AF74E7DEC
3 changed files with 9 additions and 8 deletions

View File

@ -36,7 +36,7 @@ jobs:
run: |
actual="$(pnpm --version)"
echo "pnpm version: ${actual}"
if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.+)?$ ]]; then
echo "ERROR: pnpm --version did not produce valid output"
exit 1
fi
@ -81,7 +81,7 @@ jobs:
run: |
actual="$(pnpm --version)"
echo "pnpm version: ${actual}"
if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.+)?$ ]]; then
echo "ERROR: pnpm --version did not produce valid output"
exit 1
fi
@ -115,7 +115,7 @@ jobs:
run: |
actual="$(pnpm --version)"
echo "pnpm version: ${actual}"
if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.+)?$ ]]; then
echo "ERROR: pnpm --version did not produce valid output"
exit 1
fi
@ -220,7 +220,7 @@ jobs:
run: |
actual="$(pnpm --version)"
echo "pnpm version: ${actual}"
if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
if [[ ! "${actual}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-.+)?$ ]]; then
echo "ERROR: pnpm --version did not produce valid output"
exit 1
fi

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -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')