Files
pi/scripts/npm-command.mjs
Christian Klotz 23cf2b948d feat: unify package artifact validation (#10197)
* feat: unify package artifact validation

* fix: restrict local artifact output paths

* fix: clarify package artifact module names

* feat: support pnpm package artifact consumers

* fix: preserve local release package installs

Keep npm and Bun consumer installs as runnable release artifacts while retaining isolated validation for other packages. Simplify smoke fixtures and avoid redundant release work.
2026-10-06 13:30:02 +02:00

11 lines
518 B
JavaScript

import { execFileSync } from "node:child_process";
import { existsSync } from "node:fs";
export function execNpmSync(args, options = {}) {
if (process.platform !== "win32") return execFileSync("npm", args, options);
const npmCli = process.env.npm_execpath;
if (!npmCli) throw new Error("Cannot locate npm on Windows. Run this command through its npm script.");
if (!existsSync(npmCli)) throw new Error(`Cannot locate the npm CLI: ${npmCli}`);
return execFileSync(process.execPath, [npmCli, ...args], options);
}