clawdie-iso/docs/website/scripts/deploy.mjs
Sam & Claude fdd0d260d0 feat: version-aware docs built + staged on ISO
- Copy Astro landing page source into docs/website/ (20K, no node_modules)
- Add ISO version badge to LandingBody.astro (only shown when
  ASTRO_ISO_VERSION is set during build)
- Add build_and_stage_docs() to build.sh: builds the Astro site with
  the ISO version, stages output at /usr/local/share/clawdie-iso/docs/
- Skips gracefully when node/npm unavailable
- On the booted USB: open docs/index.html to see version-matched docs
2026-06-23 11:58:03 +02:00

22 lines
566 B
JavaScript

import fs from 'node:fs';
import path from 'node:path';
import { spawnSync } from 'node:child_process';
const localRoot = process.cwd();
const distDir = path.join(localRoot, 'dist');
const webroot = process.env.CMS_WEBROOT || '/usr/local/www/clawdie-si';
if (!fs.existsSync(distDir)) {
console.error(`Build output not found: ${distDir}`);
process.exit(1);
}
const result = spawnSync(
'rsync',
['-av', '--delete', `${distDir}/`, `${webroot}/`],
{ stdio: 'inherit', env: process.env },
);
if (result.status !== 0) {
process.exit(result.status ?? 1);
}