Files
final-wishes/build.js
Eric Bell e291ee75b6 Add print layout
Print dialog with withhold/include secrets modes, cover page with
contents, one section per page, non-splitting record blocks, TBD
highlighting that survives black and white, tick boxes on steps and
checklist items, and a per-page footer. Print content is built on demand
and cleared after printing. Pure display helpers live in print.js with
tests.

Closes #5

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 08:13:11 -05:00

19 lines
1.0 KiB
JavaScript

// Inlines src/ into a single self-contained dist/final-wishes.html.
// The encrypted payload is a placeholder until the crypto module exists (#2, #6).
import { readFileSync, writeFileSync, mkdirSync } from 'node:fs';
import { fileURLToPath } from 'node:url';
import { dirname, join } from 'node:path';
const root = dirname(fileURLToPath(import.meta.url));
const read = (p) => readFileSync(join(root, 'src', p), 'utf8');
// Function replacers avoid '$' pattern interpretation in replacement text.
const out = read('index.html')
.replace('/*__CSS__*/', () => read('style.css'))
// Plain-script bundle: drop ES `export` so modules concatenate into one scope.
.replace('/*__JS__*/', () => ['crypto.js', 'model.js', 'ops.js', 'print.js'].map((f) => read(f).replace(/^export /gm, '')).concat(read('app.js')).join('\n'))
.replace('/*__PAYLOAD__*/', () => '');
mkdirSync(join(root, 'dist'), { recursive: true });
writeFileSync(join(root, 'dist', 'final-wishes.html'), out);
console.log('Wrote dist/final-wishes.html (' + out.length + ' bytes)');