| import fs from "node:fs/promises"; | |
| import path from "node:path"; | |
| const root = process.cwd(); | |
| const distRoot = path.join(root, "dist"); | |
| const sourceHtml = path.join(distRoot, "src", "index.template.html"); | |
| const targetHtml = path.join(root, "index.html"); | |
| const targetAssets = path.join(root, "assets"); | |
| const html = await fs.readFile(sourceHtml, "utf8"); | |
| await fs.writeFile(targetHtml, html.replaceAll("../assets/", "./assets/")); | |
| await fs.rm(targetAssets, { recursive: true, force: true }); | |
| await fs.cp(path.join(distRoot, "assets"), targetAssets, { recursive: true }); | |
| console.log("Synced prebuilt static Space to index.html and assets/"); | |