Files
santifer--career-ops/build-dashboard.mjs
T
wehub-resource-sync d083df1fdb
CodeQL Analysis / Analyze (javascript-typescript) (push) Failing after 2s
Web CI / web typecheck + build (push) Failing after 1s
Release Please / release-please (push) Failing after 1s
CodeQL Analysis / Analyze (go) (push) Failing after 16s
chore: import upstream snapshot with attribution
2026-07-13 12:02:43 +08:00

35 lines
1.2 KiB
JavaScript

#!/usr/bin/env node
// build-dashboard.mjs — cross-platform build for the Go TUI dashboard.
//
// `go build -o career-dashboard .` writes an extension-less binary on Windows
// (Go only auto-appends .exe when -o is omitted), which breaks bare-name/PATH
// lookup there. This wrapper picks the platform-correct output name instead:
// dashboard/career-dashboard on Unix, dashboard/career-dashboard.exe on Windows.
import { spawnSync } from 'node:child_process';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
const root = dirname(fileURLToPath(import.meta.url));
const out = process.platform === 'win32' ? 'career-dashboard.exe' : 'career-dashboard';
const result = spawnSync('go', ['build', '-o', out, '.'], {
cwd: join(root, 'dashboard'),
stdio: 'inherit',
});
if (result.error) {
if (result.error.code === 'ENOENT') {
console.error('Go toolchain not found. Install Go 1.24+ from https://go.dev/dl/ and retry.');
} else {
console.error(`Build failed to start: ${result.error.message}`);
}
process.exit(1);
}
if (result.status !== 0) {
process.exit(result.status ?? 1);
}
console.log(`Built dashboard/${out} — run it with: npm run serve:dashboard (or dashboard/${out} --path .)`);