diff --git a/packages/platform/src/index.ts b/packages/platform/src/index.ts index 50a9a2119..9085d4ff5 100644 --- a/packages/platform/src/index.ts +++ b/packages/platform/src/index.ts @@ -641,9 +641,9 @@ export function createPackageManagerInvocation(args: string[], env: NodeJS.Proce return createCommandInvocation({ args, command: execPath, env }); } if (process.platform === "win32") { - return buildCmdShimInvocation("pnpm", args, env); + return buildCmdShimInvocation("corepack", ["pnpm", ...args], env); } - return { args, command: "pnpm" }; + return { args: ["pnpm", ...args], command: "corepack" }; } function createLoggedStdio(logFd?: number | null): StdioOptions { diff --git a/packages/platform/tests/index.test.ts b/packages/platform/tests/index.test.ts index f5e6b3563..7cf8f2f16 100644 --- a/packages/platform/tests/index.test.ts +++ b/packages/platform/tests/index.test.ts @@ -693,13 +693,13 @@ describe("createPackageManagerInvocation", () => { ]); }); - it("returns plain pnpm invocation on POSIX without npm_execpath", () => { + it("returns corepack pnpm invocation on POSIX without npm_execpath", () => { setPlatform("linux"); const invocation = createPackageManagerInvocation(["install"], {} as NodeJS.ProcessEnv); - expect(invocation).toEqual({ args: ["install"], command: "pnpm" }); + expect(invocation).toEqual({ args: ["pnpm", "install"], command: "corepack" }); }); - it("wraps pnpm through cmd.exe with verbatim arguments on Windows", () => { + it("wraps corepack pnpm through cmd.exe with verbatim arguments on Windows", () => { setPlatform("win32"); const invocation = createPackageManagerInvocation(["--filter", "@open-design/desktop", "build"], { ComSpec: "cmd.exe", @@ -710,7 +710,7 @@ describe("createPackageManagerInvocation", () => { "/d", "/s", "/c", - '"pnpm --filter @open-design/desktop build"', + '"corepack pnpm --filter @open-design/desktop build"', ]); }); });