Scaffold project
Add src/ shell, build.js single-file bundler, package.json and .gitignore (excludes PDFs, data/, dist/). Closes #1 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
17
build.js
Normal file
17
build.js
Normal file
@@ -0,0 +1,17 @@
|
||||
// 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'))
|
||||
.replace('/*__JS__*/', () => read('app.js'))
|
||||
.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)');
|
||||
Reference in New Issue
Block a user