chore: upgrade to node 24 and read app version from workspace root

- base the docker image on node:24-slim and require node >=24 via
  engines in the root package.json
- read app name and version from the workspace root package.json for
  config, swagger, startup log and mcp server info; drop the server
  workspace version
- bind test http servers to 127.0.0.1 so tests pass in containers
  without ipv6 loopback
- bump version to 1.19.1
This commit is contained in:
ars9 committed 2026-09-30 20:57:33 +03:00
1 parent a4bfa3117f
commit 68415f805b
13 files changed
+105 -20

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
import * as fs from "node:fs";
import * as path from "node:path";
export interface AppPackage {
name: string;
version: string;
}
let cached: AppPackage | undefined;
/**
* Name and version of the application, read from the workspace root
* `package.json` (the one declaring `workspaces`) - the single source of the
* app version. Found by walking up from this file, which covers both the repo
* (`server/src/common` → repo root) and the Docker image
* (`/app/dist/common` → `/app/package.json`).
*/
export function appPackage(): AppPackage {
if (cached) return cached;
let dir = __dirname;
for (;;) {
const file = path.join(dir, "package.json");
if (fs.existsSync(file)) {
const pkg = JSON.parse(fs.readFileSync(file, "utf8")) as Partial<
AppPackage & { workspaces: unknown }
>;
if (pkg.workspaces && pkg.name && pkg.version) {
cached = { name: pkg.name, version: pkg.version };
return cached;
}
}
const parent = path.dirname(dir);
if (parent === dir) {
throw new Error(
`Workspace root package.json (with "workspaces", "name" and "version") not found above ${__dirname}`,
);
}
dir = parent;
}
}