From f300a8f883ee49f3629d862c37772fb8d3be8c78 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Fri, 25 Oct 2024 10:56:55 +0200 Subject: [PATCH] repo-tools: fix yarn version check for generate-patch Signed-off-by: Patrik Oldsberg --- .../src/commands/generate-patch/generate-patch.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/repo-tools/src/commands/generate-patch/generate-patch.ts b/packages/repo-tools/src/commands/generate-patch/generate-patch.ts index 0388e42b59..e5d9928cea 100644 --- a/packages/repo-tools/src/commands/generate-patch/generate-patch.ts +++ b/packages/repo-tools/src/commands/generate-patch/generate-patch.ts @@ -234,16 +234,10 @@ async function loadTrimmedRootPkg(ctx: PatchContext, query?: string) { // Verify that a repo is using a supported Yarn version async function verifyYarnVersion(cwd: string) { - const { stdout } = await exec('yarn', ['--version'], { - cwd, - }); - const version = stdout.toString('utf8').trim(); - - if (version.startsWith('1.')) { + const exists = await fs.pathExists(joinPath(cwd, '.yarnrc.yml')); + if (!exists) { throw new Error( - `Unsupported Yarn version in target repository, got ${stdout - .toString('utf8') - .trim()} but 2+ is required`, + `Missing .yarnrc.yml in ${cwd}, Yarn v1 (classic) is not support by this command`, ); } }