// Renders every template + variant to previews/*.html and a gallery at previews/index.html. // pnpm preview → uses the production site for images and links // SITE_URL=http://localhost:3000 pnpm preview import { mkdirSync, rmSync, writeFileSync } from 'node:fs'; import { catalog, escapeHtml } from '../src/index.js'; const ctx = { siteUrl: process.env.SITE_URL ?? 'https://grv.ethiopiatrustfund.org', adminUrl: process.env.ADMIN_URL ?? 'https://admin.grv.ethiopiatrustfund.org', }; const out = 'previews'; rmSync(out, { recursive: true, force: true }); mkdirSync(out, { recursive: true }); const links: string[] = []; let lastGroup = ''; let count = 0; for (const entry of catalog(ctx)) { if (entry.group !== lastGroup) { links.push(`