From e2805aa8fd92bfc1411cd6259412327d65a351b7 Mon Sep 17 00:00:00 2001 From: Jeong Min O Date: Thu, 27 Jun 2024 11:14:44 +0900 Subject: [PATCH] Support wildcard for version --- src/install-pnpm/run.ts | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/install-pnpm/run.ts b/src/install-pnpm/run.ts index e02fb98..2ca998f 100644 --- a/src/install-pnpm/run.ts +++ b/src/install-pnpm/run.ts @@ -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}` }