BangSo/apps/desktop/scripts/copy-static.mjs

16 lines
643 B
JavaScript
Raw Permalink Normal View History

2026-09-01 16:51:19 +00:00
import { copyFile, mkdir } from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
// tsc only emits the TypeScript sources; the preload bridges and the setup
// window's static assets have to be copied into dist alongside them.
const STATIC_FILES = ["preload.cjs", "setup-preload.cjs", "setup.html", "setup.css", "setup.js"];
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const dist = path.join(root, "dist");
await mkdir(dist, { recursive: true });
await Promise.all(
STATIC_FILES.map((file) => copyFile(path.join(root, "src", file), path.join(dist, file))),
);