chore(repo): set lerna npmClient to pnpm when necessary (#17505)

This commit is contained in:
Jason Jean 2023-06-08 14:17:20 -04:00 committed by GitHub
parent 32ef811cc4
commit 332f6605ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -449,6 +449,14 @@ export function newLernaWorkspace({
encoding: 'utf-8',
});
if (packageManager === 'pnpm') {
// pnpm doesn't use the normal package.json packages field so lerna needs to be told that pnpm is the client.
updateJson('lerna.json', (json) => {
json.npmClient = 'pnpm';
return json;
});
}
execSync(pm.install, {
cwd: tmpProjPath(),
stdio: isVerbose() ? 'inherit' : 'pipe',
@ -456,6 +464,12 @@ export function newLernaWorkspace({
encoding: 'utf-8',
});
// Format files to ensure no changes are made during lerna repair
execSync(`${pm.runUninstalledPackage} prettier . --write`, {
cwd: tmpProjPath(),
stdio: 'ignore',
});
return projScope;
} catch (e) {
logError(`Failed to set up lerna workspace for e2e tests.`, e.message);