Restore previously installed pnpm version (#35389)

This commit is contained in:
Roy Ho 2022-10-31 12:29:43 -07:00 committed by GitHub
parent 613be5a990
commit 20bb576fb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -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();
}