// Recreates dist/.gitkeep after a build. // // vite clears outDir (emptyOutDir: true in vite.config.ts), which deletes the // tracked placeholder. Without that file present, //go:embed all:dist in // web/embed.go fails to compile, so a fresh clone with no frontend build cannot // run `go build` at all - and a developer who ran `pnpm build` and then // committed the deletion would silently break every clone. // // Writing it here means the file survives a build instead of needing to be // restored by hand every time. import { mkdirSync, writeFileSync } from 'node:fs' mkdirSync('dist', { recursive: true }) writeFileSync( 'dist/.gitkeep', '# Generated by scripts/keep-dist.mjs after every build.\n' + '#\n' + '# Keeps web/dist present so //go:embed all:dist in web/embed.go compiles\n' + '# in a fresh clone, where the frontend has not been built. Without it the\n' + '# server logs "web UI not embedded" and serves the API only, which is the\n' + '# intended behaviour for a clone that has not run `pnpm build`.\n', )