33 lines
976 B
JavaScript
33 lines
976 B
JavaScript
import fs from "node:fs";
|
|
import path from "node:path";
|
|
|
|
const rootDir = path.resolve(path.dirname(new URL(import.meta.url).pathname), "..");
|
|
const distDir = path.resolve(rootDir, "dist");
|
|
fs.mkdirSync(distDir, { recursive: true });
|
|
|
|
const runtimeFiles = [
|
|
"index.html",
|
|
"styles.css",
|
|
"app.mjs",
|
|
"gate-summary.mjs",
|
|
"runtime.mjs",
|
|
"workbench-hardware-panel.mjs",
|
|
"help.md",
|
|
"third_party/marked/marked.esm.js",
|
|
"third_party/marked/LICENSE"
|
|
];
|
|
|
|
for (const file of runtimeFiles) {
|
|
const targetPath = path.resolve(distDir, file);
|
|
fs.mkdirSync(path.dirname(targetPath), { recursive: true });
|
|
fs.copyFileSync(path.resolve(rootDir, file), targetPath);
|
|
}
|
|
|
|
for (const alias of ["gate", "diagnostics/gate"]) {
|
|
const targetPath = path.resolve(distDir, alias, "index.html");
|
|
fs.mkdirSync(path.dirname(targetPath), { recursive: true });
|
|
fs.copyFileSync(path.resolve(rootDir, "index.html"), targetPath);
|
|
}
|
|
|
|
console.log(`hwlab-cloud-web build ok: ${distDir}`);
|