Skip to content

Commit f868dc1

Browse files
committed
fix(release): invoke pnpm portably on Windows
1 parent dcd8b9f commit f868dc1

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

β€Žscripts/prepare-standalone.mjsβ€Ž

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,21 @@ writeFileSync(standalonePackageFile, `${JSON.stringify(standalonePackage, null,
3131
// pnpm to fetch a missing store tarball on clean or partially-pruned builders.
3232
rmSync(join(standalone, "node_modules"), { recursive: true, force: true });
3333
const pnpm = process.platform === "win32" ? "pnpm.cmd" : "pnpm";
34-
const install = spawnSync(pnpm, [
34+
const installArgs = [
3535
"install",
3636
"--dir", standalone,
3737
"--prod",
3838
"--prefer-offline",
3939
"--ignore-scripts",
4040
"--ignore-workspace",
4141
"--no-lockfile",
42-
], { cwd: root, stdio: "inherit" });
42+
];
43+
const pnpmCli = process.env.npm_execpath;
44+
const install = spawnSync(
45+
pnpmCli ? process.execPath : pnpm,
46+
pnpmCli ? [pnpmCli, ...installArgs] : installArgs,
47+
{ cwd: root, stdio: "inherit", shell: process.platform === "win32" && !pnpmCli },
48+
);
4349
if (install.status !== 0) throw new Error(`Standalone production install failed (${install.status ?? "unknown"}).`);
4450

4551
const destinationNext = realpathSync(join(standalone, "node_modules", "next"));

0 commit comments

Comments
Β (0)