#!/usr/bin/env node /** * Copies non-TypeScript assets into dist/. * * tsc emits only .js, so the .sql migrations would be missing at runtime — and * the failure is quiet, because the store degrades to live-only mode rather * than crashing. Keeping this in the build avoids that confusing outcome. */ import { cp, mkdir } from 'node:fs/promises'; const assets = [ ['src/store/migrations', 'dist/store/migrations'], // The web app's HTML, CSS and script. Real files rather than strings in a // module, so an editor and a linter can read them — which only works if the // build puts them next to the module that serves them. ['src/http/app', 'dist/http/app'], ]; for (const [from, to] of assets) { await mkdir(to, { recursive: true }); await cp(from, to, { recursive: true }); console.log(`copied ${from} -> ${to}`); }