import { readFile, writeFile } from "node:fs/promises"; import path from "node:path"; import { fileURLToPath } from "node:url"; import { PUBLIC_ROUTES } from "./routes.mjs"; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); const indexPath = path.resolve(__dirname, "../index.html"); const LIST_INDENT = " "; const WRAPPER_INDENT = " "; const generateListItems = () => PUBLIC_ROUTES.map( ({ path, href, label }) => { const targetHref = href ?? path; return `${LIST_INDENT}
  • ${label}
  • `; } ).join("\n"); async function main() { const originalContent = await readFile(indexPath, "utf8"); const navPattern = new RegExp( `${WRAPPER_INDENT}