import { readFile, writeFile, mkdir } from 'node:fs/promises';
import { render } from '../.ssr/render.js';
import { pages, headTags } from './seo.mjs';
const template = await readFile('dist/index.html', 'utf8');
for (const path of Object.keys(pages)) {
const html = template.replace('', render(path))
.replace(/
.*?<\/title>/, headTags(path));
if (path === '/') await writeFile('dist/index.html', html);
else if (path === '/404') await writeFile('dist/404.html', html);
else { await writeFile(`dist${path}.html`, html); await mkdir(`dist${path}`, { recursive: true }); await writeFile(`dist${path}/index.html`, html); }
}
await mkdir('dist/waitlist', { recursive: true });
await writeFile('dist/waitlist/index.html', 'InkspringInkspring has moved to the homepage.');
console.log('Prerendered homepage, download, help, compare, privacy, app notices, 404, and legacy waitlist redirect as static HTML.');