fix(daemon): include package.json in tarball so packaged app reports correct version (#260)

The packaged app's Settings → About page displays version `0.0.0` instead
of the actual release version because the daemon's `package.json` was
excluded from its `pnpm pack` tarball.

Root cause: `apps/daemon/package.json` declares `"files": ["dist"]`, so
`pnpm pack` only includes the `dist/` directory. At runtime,
`readCurrentAppVersionInfo()` in `apps/daemon/src/app-version.ts` resolves
`new URL('../package.json', import.meta.url)` from the compiled
`dist/app-version.js`, which points at the tarball's root `package.json`.
Because that file isn't packed, the read fails silently, falls through
the catch in `readPackageMetadata()`, and the version falls back to the
`APP_VERSION_FALLBACK = '0.0.0'` constant. `/api/version` and
`/api/health` then report `'0.0.0'` for every packaged install.

Fix: add `"package.json"` to the daemon's `files` array so it ships in
the tarball. The package already declares `"./package.json"` as an
exports entry, so consumers expect this file to be available.

Closes #224
This commit is contained in:
Sid 2026-05-02 14:52:23 +08:00 committed by GitHub
parent 0e166bb799
commit 52677555f7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -20,7 +20,8 @@
}
},
"files": [
"dist"
"dist",
"package.json"
],
"scripts": {
"build": "tsc -p tsconfig.json && tsc -p tsconfig.sidecar.json",