feat(gateway): support bun-compiled embedded gateway

This commit is contained in:
Peter Steinberger
2025-12-19 19:20:41 +01:00
parent bd63b5a231
commit bb7f4abd4b
8 changed files with 380 additions and 55 deletions

View File

@@ -1,7 +1,22 @@
import { createRequire } from "node:module";
const require = createRequire(import.meta.url);
const pkg = require("../package.json") as { version?: string };
declare const __CLAWDIS_VERSION__: string | undefined;
// Single source of truth for the current clawdis version (reads from package.json).
export const VERSION = pkg.version ?? "0.0.0";
function readVersionFromPackageJson(): string | null {
try {
const require = createRequire(import.meta.url);
const pkg = require("../package.json") as { version?: string };
return pkg.version ?? null;
} catch {
return null;
}
}
// Single source of truth for the current clawdis version.
// - Embedded/bundled builds: injected define or env var.
// - Dev/npm builds: package.json.
export const VERSION =
(typeof __CLAWDIS_VERSION__ === "string" && __CLAWDIS_VERSION__) ||
process.env.CLAWDIS_BUNDLED_VERSION ||
readVersionFromPackageJson() ||
"0.0.0";