Shield external portal jumps (keep EXTERNAL_* for later), serve /nav from static build, and proxy /book + /community to vertical Next apps with Caddy notes. Co-authored-by: Cursor <cursoragent@cursor.com>
30 lines
912 B
JavaScript
30 lines
912 B
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Build apps/navmini and sync dist → public/nav for same-origin /nav/ serving.
|
|
*/
|
|
const { spawnSync } = require("node:child_process");
|
|
const fs = require("node:fs");
|
|
const path = require("node:path");
|
|
|
|
const root = path.resolve(__dirname, "..");
|
|
const app = path.join(root, "apps", "navmini");
|
|
const dist = path.join(app, "dist");
|
|
const dest = path.join(root, "public", "nav");
|
|
|
|
function run(cmd, args, cwd) {
|
|
const r = spawnSync(cmd, args, { cwd, stdio: "inherit", shell: true });
|
|
if (r.status !== 0) process.exit(r.status || 1);
|
|
}
|
|
|
|
if (!fs.existsSync(path.join(app, "package.json"))) {
|
|
console.error("apps/navmini missing");
|
|
process.exit(1);
|
|
}
|
|
|
|
run("npm", ["run", "build"], app);
|
|
|
|
fs.rmSync(dest, { recursive: true, force: true });
|
|
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
fs.cpSync(dist, dest, { recursive: true });
|
|
console.log(`Synced ${dist} → ${dest}`);
|