16 lines
643 B
JavaScript
16 lines
643 B
JavaScript
|
|
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))),
|
||
|
|
);
|