mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 18:39:20 -05:00
fix: use build-info for version fallback
This commit is contained in:
@@ -12,6 +12,16 @@ function readVersionFromPackageJson(): string | null {
|
||||
}
|
||||
}
|
||||
|
||||
function readVersionFromBuildInfo(): string | null {
|
||||
try {
|
||||
const require = createRequire(import.meta.url);
|
||||
const info = require("../build-info.json") as { version?: string };
|
||||
return info.version ?? null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Single source of truth for the current OpenClaw version.
|
||||
// - Embedded/bundled builds: injected define or env var.
|
||||
// - Dev/npm builds: package.json.
|
||||
@@ -19,4 +29,5 @@ export const VERSION =
|
||||
(typeof __OPENCLAW_VERSION__ === "string" && __OPENCLAW_VERSION__) ||
|
||||
process.env.OPENCLAW_BUNDLED_VERSION ||
|
||||
readVersionFromPackageJson() ||
|
||||
readVersionFromBuildInfo() ||
|
||||
"0.0.0";
|
||||
|
||||
Reference in New Issue
Block a user