From 776fe96a4e1b94e4c31b54a951fcdab347ab8e2f Mon Sep 17 00:00:00 2001 From: Bryan Wain <3982094+bdwain@users.noreply.github.com> Date: Mon, 12 Dec 2022 08:23:51 +0000 Subject: [PATCH] Copy .yarn directory to temporary directory --- src/makePatch.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/makePatch.ts b/src/makePatch.ts index ec67b2bb..d51465d3 100644 --- a/src/makePatch.ts +++ b/src/makePatch.ts @@ -110,14 +110,15 @@ export function makePatch({ join(resolve(packageDetails.path), "package.json"), ) - // copy .npmrc/.yarnrc in case packages are hosted in private registry - // tslint:disable-next-line:align - ;[".npmrc", ".yarnrc"].forEach((rcFile) => { - const rcPath = join(appPath, rcFile) - if (existsSync(rcPath)) { - copySync(rcPath, join(tmpRepo.name, rcFile), { dereference: true }) - } - }) + // copy .npmrc/.yarnrc in case packages are hosted in private registry + // copy .yarn directory as well to ensure installations work in yarn 2 + // tslint:disable-next-line:align + ;[".npmrc", ".yarnrc", ".yarn"].forEach((rcFile) => { + const rcPath = join(appPath, rcFile) + if (existsSync(rcPath)) { + copySync(rcPath, join(tmpRepo.name, rcFile), { dereference: true }) + } + }) if (packageManager === "yarn") { console.info(