import fs from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; const root = path.dirname(fileURLToPath(import.meta.url)); const template = fs.readFileSync(path.join(root, 'site.template.html'), 'utf8'); const font = fs.readFileSync(path.join(root, '../fmode-landing-20261027/assets/fonts/geist-latin-wght-normal.woff2')).toString('base64'); const css = fs.readFileSync(path.join(root, 'site.css'), 'utf8').replace('__GEIST_FONT__', font); const js = fs.readFileSync(path.join(root, 'site.js'), 'utf8'); const qr = fs.readFileSync(path.join(root, 'vendor/qrcodegen.js'), 'utf8'); const html = template.replace('/* INJECT_STYLES */', () => css).replace('/* INJECT_SCRIPT */', () => qr + '\n' + js); fs.writeFileSync(path.join(root, 'index.html'), html); console.log('Built standalone index.html: ' + Math.round(Buffer.byteLength(html) / 1024) + ' KB. No external requests.');