feat(HAI-071): add Bun single-binary compile support for CLI
- Create build script (packages/cli/build.ts) using Bun.build compile target - Update asset resolution in dashboard server for bundled context - Add npm scripts to wire up the build process - Add build-exe tests to verify compiled binary output - Fix pre-existing build errors in engine and core packages - Document build and compile workflow in README
This commit is contained in:
@@ -21,11 +21,22 @@ export function createServer(store: TaskStore, options?: ServerOptions): ReturnT
|
||||
app.use(express.json());
|
||||
|
||||
// Serve built React app
|
||||
const clientDir = existsSync(join(__dirname, "..", "dist", "client"))
|
||||
? join(__dirname, "..", "dist", "client")
|
||||
: existsSync(join(__dirname, "..", "client"))
|
||||
? join(__dirname, "..", "client")
|
||||
: join(__dirname, "..", "public");
|
||||
// Resolution order:
|
||||
// 1. HAI_CLIENT_DIR env override (explicit)
|
||||
// 2. Next to process.execPath (bun-compiled binary: dist/hai + dist/client/)
|
||||
// 3. __dirname/../dist/client (running from src/ via tsx/ts-node)
|
||||
// 4. __dirname/../client (running from dist/ after tsc)
|
||||
// 5. __dirname/../public (fallback for dev)
|
||||
const execDir = dirname(process.execPath);
|
||||
const clientDir = process.env.HAI_CLIENT_DIR
|
||||
? process.env.HAI_CLIENT_DIR
|
||||
: existsSync(join(execDir, "client", "index.html"))
|
||||
? join(execDir, "client")
|
||||
: existsSync(join(__dirname, "..", "dist", "client"))
|
||||
? join(__dirname, "..", "dist", "client")
|
||||
: existsSync(join(__dirname, "..", "client"))
|
||||
? join(__dirname, "..", "client")
|
||||
: join(__dirname, "..", "public");
|
||||
|
||||
app.use(express.static(clientDir));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user