Capture walkthroughs online in a separate tool, merge them in offline (Fixes #28)
build.js now also writes capture.html: no document, no payload, no storage. It captures walkthroughs and exports an encrypted .fwcapture bundle (magic FC, own passphrase). The main app's Import captures... opens a bundle and places each walkthrough in a chosen section or sub-tab; nothing is written until Save and the bundle is never modified. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
14
build.js
14
build.js
@@ -9,7 +9,7 @@
|
||||
import { readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { dirname, join, resolve } from 'node:path';
|
||||
import { assemble } from './src/template.js';
|
||||
import { assemble, assembleCapture } from './src/template.js';
|
||||
import { encrypt, passphraseProblem } from './src/crypto.js';
|
||||
import { assertValid } from './src/model.js';
|
||||
|
||||
@@ -17,11 +17,17 @@ const root = dirname(fileURLToPath(import.meta.url));
|
||||
const read = (p) => readFileSync(join(root, 'src', p), 'utf8');
|
||||
|
||||
// Modules are concatenated (ES `import` lines and `export` keywords dropped) ahead of app.js into one scope.
|
||||
const MODULES = ['crypto.js', 'images.js', 'model.js', 'ops.js', 'print.js', 'search.js', 'template.js', 'version.js'];
|
||||
const MODULES = ['crypto.js', 'images.js', 'model.js', 'ops.js', 'capture.js', 'print.js', 'search.js', 'template.js', 'version.js'];
|
||||
export function bundleJs() {
|
||||
return MODULES.map((f) => read(f).replace(/^import .*$/gm, '').replace(/^export /gm, '')).concat(read('app.js')).join('\n');
|
||||
}
|
||||
|
||||
// The separate online capture tool: only the modules it needs, and no document data.
|
||||
const CAPTURE_MODULES = ['crypto.js', 'images.js', 'capture.js', 'version.js'];
|
||||
export function captureJs() {
|
||||
return CAPTURE_MODULES.map((f) => read(f).replace(/^import .*$/gm, '').replace(/^export /gm, '')).concat(read('capture-app.js')).join('\n');
|
||||
}
|
||||
|
||||
function parseArgs(argv) {
|
||||
const a = {};
|
||||
for (let i = 0; i < argv.length; i++) {
|
||||
@@ -75,6 +81,10 @@ async function main() {
|
||||
const out = resolve(args.out || join(root, 'dist', 'final-wishes.html'));
|
||||
mkdirSync(dirname(out), { recursive: true });
|
||||
writeFileSync(out, html);
|
||||
const capOut = join(dirname(out), 'capture.html');
|
||||
const cap = assembleCapture({ css: read('style.css'), js: captureJs() });
|
||||
writeFileSync(capOut, cap);
|
||||
console.log(`Wrote ${capOut} (${cap.length} bytes, capture tool, no document)`);
|
||||
console.log(`Wrote ${out} (${html.length} bytes, ${payload ? 'encrypted data embedded' : 'no data embedded'})`);
|
||||
if (args.data) console.log(`Note: ${args.data} is still plaintext. Keep it out of git and delete it when done.`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user