generate-entry-points.ts
1 import { routeTree } from "../src/routeTree.gen.ts"; 2 3 // Slice off the leading slash for each path and remove the index route. 4 export const entryPoints = Object.values(routeTree.children || {}) 5 .map((r) => r.options.path.slice(1)) 6 .slice(1); 7 8 // usually run by deno task generate, as part of the production pipeline 9 if (import.meta.main) { 10 console.log("Copying index.html for each entry point..."); 11 for (const entry of entryPoints) { 12 await Deno.mkdir(`dist/${entry}`, { recursive: true }); 13 await Deno.copyFile("dist/index.html", `dist/${entry}/index.html`); 14 } 15 }