mirror of
https://github.com/pnpm/action-setup.git
synced 2026-05-14 14:23:32 +08:00
refactor: scope pm_on_fail override to the no-target-version branch
Only export `pnpm_config_pm_on_fail=download` when the action is relying on bootstrap pnpm's runtime switch. When the user passes an explicit `version:` input, self-update aligns the binary and we should not silently override their `devEngines.packageManager.onFail = "error"` policy.
This commit is contained in:
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -67,11 +67,6 @@ export async function runSelfInstaller(inputs: Inputs): Promise<SelfInstallerRes
|
|||||||
addPath(pnpmHome)
|
addPath(pnpmHome)
|
||||||
addPath(path.join(pnpmHome, 'bin'))
|
addPath(path.join(pnpmHome, 'bin'))
|
||||||
exportVariable('PNPM_HOME', pnpmHome)
|
exportVariable('PNPM_HOME', pnpmHome)
|
||||||
// Force pnpm to honor manage-package-manager-versions even when the project
|
|
||||||
// pins `devEngines.packageManager.onFail = "error"`. Without this override
|
|
||||||
// the bootstrap pnpm errors with BAD_PM_VERSION instead of switching to the
|
|
||||||
// requested version on the user's first invocation (issue #252).
|
|
||||||
exportVariable('pnpm_config_pm_on_fail', 'download')
|
|
||||||
|
|
||||||
// Ensure pnpm bin link exists — npm ci sometimes doesn't create it
|
// Ensure pnpm bin link exists — npm ci sometimes doesn't create it
|
||||||
if (process.platform !== 'win32') {
|
if (process.platform !== 'win32') {
|
||||||
@@ -107,7 +102,12 @@ export async function runSelfInstaller(inputs: Inputs): Promise<SelfInstallerRes
|
|||||||
}
|
}
|
||||||
|
|
||||||
// No explicit target version: rely on the bootstrap pnpm to switch to
|
// No explicit target version: rely on the bootstrap pnpm to switch to
|
||||||
// the version declared in packageManager/devEngines at runtime.
|
// the version declared in packageManager/devEngines at runtime. Force
|
||||||
|
// `pmOnFail=download` so a project that pins
|
||||||
|
// `devEngines.packageManager.onFail = "error"` doesn't trip BAD_PM_VERSION
|
||||||
|
// before the switch can happen (issue #252). Scoped to this branch so users
|
||||||
|
// who pass an explicit `version:` input keep strict onFail behavior.
|
||||||
|
exportVariable('pnpm_config_pm_on_fail', 'download')
|
||||||
return { exitCode: 0, binDest: pnpmHome }
|
return { exitCode: 0, binDest: pnpmHome }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user