diff --git a/tools/code-analyzer/src/lib/scan-changes.ts b/tools/code-analyzer/src/lib/scan-changes.ts index 5042db58785..4ed137f97d3 100644 --- a/tools/code-analyzer/src/lib/scan-changes.ts +++ b/tools/code-analyzer/src/lib/scan-changes.ts @@ -70,6 +70,9 @@ export const scanForChanges = async ( ); const packageJSON = JSON.parse( fileStr ); + // Temporarily save the current PNPM version. + await execAsync( `tmpgPNPM="$(pnpm --version)"` ); + if ( packageJSON.engines && packageJSON.engines.pnpm ) { await execAsync( `npm i -g pnpm@${ packageJSON.engines.pnpm }`, @@ -101,6 +104,9 @@ export const scanForChanges = async ( schemaChanges = schemaDiff || []; + // Restore the previously saved PNPM version + await execAsync( `npm i -g pnpm@"$tmpgPNPM"` ); + Logger.endTask(); }