Skip to content

Commit

Permalink
Support wildcard for version
Browse files Browse the repository at this point in the history
  • Loading branch information
owjs3901 authored Jun 27, 2024
1 parent 23657c8 commit e2805aa
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/install-pnpm/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,15 @@ async function readTarget(opts: {
}

if (version) {
if (
typeof packageManager === 'string' &&
packageManager.replace('pnpm@', '') !== version
) {
throw new Error(`Multiple versions of pnpm specified:
- version ${version} in the GitHub Action config with the key "version"
- version ${packageManager} in the package.json with the key "packageManager"
Remove one of these versions to avoid version mismatch errors like ERR_PNPM_BAD_PM_VERSION`)
if (typeof packageManager === 'string') {
const packageManagerVersion = packageManager.replace('pnpm@', '')
if(packageManagerVersion !== version && packageManagerVersion !== '*')
throw new Error(`Multiple versions of pnpm specified:
- version ${version} in the GitHub Action config with the key "version"
- version ${packageManager} in the package.json with the key "packageManager"
Remove one of these versions to avoid version mismatch errors like ERR_PNPM_BAD_PM_VERSION`)
return `${ standalone ? '@pnpm/exe' : 'pnpm' }@${packageManagerVersion}`
}

return `${ standalone ? '@pnpm/exe' : 'pnpm' }@${version}`
}

Expand Down

0 comments on commit e2805aa

Please sign in to comment.