fix(FN-1243): add build-time dashboard stub fallback for CLI bundles

- Add resilient client asset staging in packages/cli/build.ts with automatic dist/client/index.html stub generation when dashboard assets are missing
- Update packages/cli/tsup.config.ts onSuccess hook to clear stale client output and emit the same minimal stub fallback in clean checkout builds
- Make bundle-output test build-aware by running pnpm build in beforeAll when bundle artifacts are absent, then assert client assets are present
- Preserve build output visibility by reporting whether real or stub client assets were staged
This commit is contained in:
gsxdsm
2026-04-08 09:44:42 -07:00
parent 108c3958ac
commit 8db7689f77
3 changed files with 94 additions and 35 deletions

View File

@@ -1,11 +1,25 @@
import { describe, it, expect } from "vitest";
import { describe, it, expect, beforeAll } from "vitest";
import { execSync } from "node:child_process";
import { readFileSync, existsSync, readdirSync } from "node:fs";
import { join } from "node:path";
const cliRoot = join(__dirname, "..", "..");
const bundlePath = join(cliRoot, "dist", "bin.js");
const clientIndexPath = join(cliRoot, "dist", "client", "index.html");
describe("CLI bundle output", () => {
beforeAll(() => {
if (existsSync(bundlePath) && existsSync(clientIndexPath)) {
return;
}
execSync("pnpm build", {
cwd: cliRoot,
stdio: "pipe",
timeout: 120_000,
});
}, 180_000);
it("dist/bin.js exists", () => {
expect(existsSync(bundlePath)).toBe(true);
});
@@ -31,8 +45,7 @@ describe("CLI bundle output", () => {
});
it("dashboard client assets are included", () => {
const clientIndex = join(cliRoot, "dist", "client", "index.html");
expect(existsSync(clientIndex)).toBe(true);
expect(existsSync(clientIndexPath)).toBe(true);
});
it("runtime native assets are staged after build:exe", () => {