mirror of
https://github.com/nexu-io/open-design.git
synced 2026-06-01 03:14:35 +07:00
fix(platform): resolve pnpm via corepack when npm_execpath is absent
Nested tools-dev daemon/desktop builds no longer assume a global pnpm binary on PATH. Fall back to `corepack pnpm …` on Windows and POSIX so the documented Corepack startup flow works end-to-end.
This commit is contained in:
parent
f27fbfb3f1
commit
33f99b1a18
2 changed files with 6 additions and 6 deletions
|
|
@ -295,9 +295,9 @@ export function createPackageManagerInvocation(args: string[], env: NodeJS.Proce
|
||||||
return createCommandInvocation({ args, command: execPath, env });
|
return createCommandInvocation({ args, command: execPath, env });
|
||||||
}
|
}
|
||||||
if (process.platform === "win32") {
|
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 {
|
function createLoggedStdio(logFd?: number | null): StdioOptions {
|
||||||
|
|
|
||||||
|
|
@ -370,13 +370,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");
|
setPlatform("linux");
|
||||||
const invocation = createPackageManagerInvocation(["install"], {} as NodeJS.ProcessEnv);
|
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");
|
setPlatform("win32");
|
||||||
const invocation = createPackageManagerInvocation(["--filter", "@open-design/desktop", "build"], {
|
const invocation = createPackageManagerInvocation(["--filter", "@open-design/desktop", "build"], {
|
||||||
ComSpec: "cmd.exe",
|
ComSpec: "cmd.exe",
|
||||||
|
|
@ -387,7 +387,7 @@ describe("createPackageManagerInvocation", () => {
|
||||||
"/d",
|
"/d",
|
||||||
"/s",
|
"/s",
|
||||||
"/c",
|
"/c",
|
||||||
'"pnpm --filter @open-design/desktop build"',
|
'"corepack pnpm --filter @open-design/desktop build"',
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue