Single-file ink-painting wuxia sect-survival RPG. Lead a sect through 100 days: martial arts combos, cultivation, tactical combat, faction war, chronicle endings. - src/ 13 modules (data, sim, combat, render, UI, app shell) - wuxia.html self-contained build (no dependencies) - tools/build.js bundler - tests: headless 100-day sims + jsdom UI smoke + real-browser Chromium click-through (playwright)
42 lines
1.6 KiB
JavaScript
42 lines
1.6 KiB
JavaScript
#!/usr/bin/env node
|
|
/* Build: bundle src/*.js + style.css into a single self-contained wuxia.html */
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const SRC = path.join(__dirname, '..', 'src');
|
|
const OUT = path.join(__dirname, '..', 'wuxia.html');
|
|
|
|
const files = fs.readdirSync(SRC).filter(f => f.endsWith('.js')).sort();
|
|
let js = [];
|
|
for (const f of files) {
|
|
const code = fs.readFileSync(path.join(SRC, f), 'utf8');
|
|
js.push(`/* ==== ${f} ==== */\n` + code);
|
|
}
|
|
const css = fs.readFileSync(path.join(SRC, 'style.css'), 'utf8');
|
|
|
|
const html = `<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
|
<title>Wuxia: 100 Days After — 武林百日后</title>
|
|
<link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect width='64' height='64' rx='10' fill='%23a33327'/%3E%3Ctext x='32' y='46' font-size='38' font-family='Kaiti SC,KaiTi,serif' text-anchor='middle' fill='%23efe6d4'%3E百%3C/text%3E%3C/svg%3E">
|
|
<style>
|
|
${css}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="app">
|
|
<canvas id="cv"></canvas>
|
|
<div id="ui"></div>
|
|
</div>
|
|
<script>
|
|
${js.join('\n\n')}
|
|
</script>
|
|
<script>window.addEventListener('load', function(){ try { W.app.boot(); } catch(e){ console.error(e); document.body.insertAdjacentHTML('beforeend', '<pre style="color:#c86a52;padding:20px;white-space:pre-wrap">'+e.stack+'</pre>'); } });</script>
|
|
</body>
|
|
</html>`;
|
|
|
|
fs.writeFileSync(OUT, html);
|
|
console.log('Built', OUT, (html.length / 1024).toFixed(0) + ' KB', '| modules:', files.join(', '));
|