fuzzyworld

explodorama / files / tools / balance / run.mjs

run.mjs

695 B · history · blame

1/**
2 * The balance lab's launcher (PLAN.md §19.1): bundles tools/balance/lab.ts with the game's sim
3 * (TypeScript) into .balance/lab.mjs with Vite, then runs it with the same arguments.
4 *
5 * npm run balance -- <command> [options] (npm run balance -- help)
6 */
7import { build } from 'vite'
8import { pathToFileURL } from 'node:url'
9import { resolve } from 'node:path'
10
11await build({
12 configFile: false,
13 logLevel: 'warn',
14 build: {
15 ssr: 'tools/balance/lab.ts',
16 outDir: '.balance',
17 emptyOutDir: true,
18 target: 'node22',
19 minify: false,
20 rollupOptions: { output: { entryFileNames: 'lab.mjs' } },
21 },
22})
23await import(pathToFileURL(resolve('.balance/lab.mjs')).href)