/** * `npm run app:dev` — boot the content-feed app and leave it running. * * The whole point of this app is that a human clicks Like and watches the order * change, so there has to be a one-command way to open it. It drives the exact * same `startApp()` lifecycle the assertions use, so what you click is what the * spec ran against. */ import { rmSync } from 'node:fs'; import { startApp } from './harness.ts'; const app = await startApp({ verbose: true }); /** * Synchronous last resort. The graceful path below removes the data dir, but an * `exit` handler is the only thing that still runs if that path throws part-way * — and a stale multi-megabyte index dir in $TMPDIR is exactly the kind of litter * nobody goes looking for. (Nothing survives SIGKILL; that is the OS's problem.) */ process.on('exit', () => rmSync(app.dataDir, { recursive: true, force: true })); console.log(''); console.log(` content feed ${app.url}`); console.log(` tidalDB node ${app.nodeUrl}`); console.log(` catalog ${Object.keys(app.groundTruth.neighboursByItem).length} items seeded`); console.log(''); console.log(' Ctrl-C to tear down the node and remove its data dir.'); console.log(''); const shutdown = async (signal: string) => { console.log(`\n[app] ${signal} — closing`); await app.close(); process.exit(0); }; process.once('SIGINT', () => void shutdown('SIGINT')); process.once('SIGTERM', () => void shutdown('SIGTERM'));