Files
16gagent/output/warehouse-mgmt/scripts/build.mjs
T
2026-06-06 10:40:48 +08:00

27 lines
605 B
JavaScript

#!/usr/bin/env node
/**
* Build script — builds both web and api.
* Usage: node scripts/build.mjs
*/
import { execSync } from "node:child_process";
const ROOT = new URL("..", import.meta.url).pathname;
function run(cmd, cwd) {
console.log(`\n🔨 ${cmd} (in ${cwd})`);
execSync(cmd, { cwd, stdio: "inherit" });
}
console.log("🏗️ Building fullstack project...\n");
try {
run("npm run build", `${ROOT}/apps/api`);
run("npm run build", `${ROOT}/apps/web`);
console.log("\n✅ Build complete!");
} catch (e) {
console.error("\n❌ Build failed:", e.message);
process.exit(1);
}