fix: fixed stats dashboard asset serving for bundled CLI distributions

- Fixed npm CLI bundling by invoking `generate-client-bundle.ts --generate` before build and `--reset` after.
- Added `PI_BUNDLED` handling in `packages/stats/src/server.ts` and switched bundled distributions to embedded assets.
- Decoded embedded archives via `decodeEmbeddedClientArchive` and treated legacy placeholder content as missing.
- Handled missing dashboard source/build directories as ENOENT during mtime scans to avoid startup crashes.
- Extended `--smoke-test` to start the stats server and validate dashboard HTML contains expected asset markers.
This commit is contained in:
can1357
2026-06-10 10:41:04 +02:00
parent bbe85b6661
commit 6b76463941
10 changed files with 162 additions and 72 deletions
+3 -6
View File
@@ -21,12 +21,9 @@ smoke_cli() {
XDG_DATA_HOME="$runtime_dir/xdg" HOME="$runtime_dir/home" "$omp_bin" --version
XDG_DATA_HOME="$runtime_dir/xdg" HOME="$runtime_dir/home" "$omp_bin" --help >/dev/null
XDG_DATA_HOME="$runtime_dir/xdg" HOME="$runtime_dir/home" "$omp_bin" stats --summary >/dev/null
# Spawns the stats sync worker via `new Worker(...)` and waits for a pong.
# Regression probe for #1011 (browser tab worker) and #1027 (stats sync
# worker) — both broke silently in compiled binaries because the `with
# { type: "file" }` import pattern only copies the worker as a raw asset
# without bundling its imports. `stats --summary` doesn't catch this on a
# fresh install (no session files = no Worker spawn).
# Spawns bundled workers and serves the stats dashboard once. Regression
# probe for #1011/#1027 worker loading and for npm/compiled distributions
# missing the dashboard assets that `stats --summary` never touches.
XDG_DATA_HOME="$runtime_dir/xdg" HOME="$runtime_dir/home" "$omp_bin" --smoke-test
}