Repository Public
1// Bundle the services into single ESM files (no node_modules needed at runtime). The web app is built by Vite.2import { execSync } from 'node:child_process';3import { build } from 'esbuild';45let commit = process.env.SPD_COMMIT ?? '';6if (!commit) { try { commit = execSync('git rev-parse --short HEAD', { stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim(); } catch { /* not a checkout */ } }7const banner = { js: "import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);" };8for (const [entry, out] of [['services/api/src/main.ts', 'dist/api.mjs'], ['services/api/src/worker-main.ts', 'dist/worker.mjs'], ['services/api/src/cli.ts', 'dist/cli.mjs'], ['services/api/src/sheet-child.ts', 'dist/sheet-child.mjs']])9 await build({ entryPoints: [entry], outfile: out, bundle: true, platform: 'node', target: 'node24', format: 'esm', banner, legalComments: 'none', logLevel: 'info',10 define: { 'process.env.SPD_BUILD_COMMIT': JSON.stringify(commit) } });11