26 lines
883 B
JavaScript
26 lines
883 B
JavaScript
import fs from "node:fs";
|
|
import path from "node:path";
|
|
|
|
const repoRoot = process.cwd();
|
|
const distRoot = path.join(repoRoot, "dist");
|
|
const staticDirs = ["assets", "css", "js"];
|
|
|
|
function copyDir(source, destination) {
|
|
fs.rmSync(destination, { recursive: true, force: true });
|
|
fs.mkdirSync(path.dirname(destination), { recursive: true });
|
|
fs.cpSync(source, destination, { recursive: true });
|
|
}
|
|
|
|
for (const dir of staticDirs) {
|
|
copyDir(path.join(repoRoot, dir), path.join(distRoot, dir));
|
|
}
|
|
|
|
const speechIndexSource = path.join(distRoot, "speeches.html");
|
|
const speechIndexDestination = path.join(distRoot, "speeches", "index.html");
|
|
|
|
if (fs.existsSync(speechIndexSource)) {
|
|
fs.mkdirSync(path.dirname(speechIndexDestination), { recursive: true });
|
|
fs.copyFileSync(speechIndexSource, speechIndexDestination);
|
|
}
|
|
|
|
console.log(`Copied ${staticDirs.join(", ")} into dist/.`);
|