Files
Cyrene_v2/frontend/web/copy-dist.mjs
T

16 lines
737 B
JavaScript

// Copies the freshly built SPA (frontend/web/dist) into internal/webui/dist so
// the Go package can //go:embed it into the single Cyrene binary. It runs as the
// last step of `npm run build`. The source dist is the canonical build output,
// so it also serves as the external deploy-override directory.
import { cp, rm } from "node:fs/promises";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
const here = dirname(fileURLToPath(import.meta.url));
const src = resolve(here, "dist");
const dest = resolve(here, "..", "..", "internal", "webui", "dist");
await rm(dest, { recursive: true, force: true });
await cp(src, dest, { recursive: true });
console.log(`webui: copied ${src} -> ${dest}`);