first-commit
ci / Validate workspace (push) Has been cancelled
landing-page-ci / Validate landing page (push) Has been cancelled
landing-page-deploy / Deploy landing page (push) Has been cancelled
github-metrics / Generate repository metrics SVG (push) Has been cancelled
refresh-contributors-wall / Refresh contributors wall cache bust (push) Waiting to run
ci / Validate workspace (push) Has been cancelled
landing-page-ci / Validate landing page (push) Has been cancelled
landing-page-deploy / Deploy landing page (push) Has been cancelled
github-metrics / Generate repository metrics SVG (push) Has been cancelled
refresh-contributors-wall / Refresh contributors wall cache bust (push) Waiting to run
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { dirname, extname, resolve } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const scriptDir = dirname(fileURLToPath(import.meta.url));
|
||||
const repoRoot = resolve(scriptDir, "..");
|
||||
|
||||
const buildTargets = [
|
||||
"packages/sidecar-proto",
|
||||
"packages/sidecar",
|
||||
"packages/platform",
|
||||
"tools/dev",
|
||||
"tools/pack",
|
||||
];
|
||||
|
||||
const jsExtensions = new Set([".js", ".cjs", ".mjs"]);
|
||||
|
||||
function resolvePackageManagerInvocation() {
|
||||
const pnpmExecPath = process.env.npm_execpath;
|
||||
if (pnpmExecPath != null && pnpmExecPath.length > 0) {
|
||||
if (jsExtensions.has(extname(pnpmExecPath).toLowerCase())) {
|
||||
return { argsPrefix: [pnpmExecPath], command: process.execPath };
|
||||
}
|
||||
return { argsPrefix: [], command: pnpmExecPath };
|
||||
}
|
||||
|
||||
return { argsPrefix: [], command: process.platform === "win32" ? "pnpm.cmd" : "pnpm" };
|
||||
}
|
||||
|
||||
const packageManager = resolvePackageManagerInvocation();
|
||||
|
||||
for (const target of buildTargets) {
|
||||
const result = spawnSync(
|
||||
packageManager.command,
|
||||
[...packageManager.argsPrefix, "-C", target, "run", "build"],
|
||||
{
|
||||
cwd: repoRoot,
|
||||
stdio: "inherit",
|
||||
},
|
||||
);
|
||||
|
||||
if (result.error != null) {
|
||||
throw result.error;
|
||||
}
|
||||
|
||||
if (result.status !== 0) {
|
||||
process.exit(result.status ?? 1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user