mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 19:01:47 +03: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.
|
// Single source of truth for the current OpenClaw version.
|
||||||
// - Embedded/bundled builds: injected define or env var.
|
// - Embedded/bundled builds: injected define or env var.
|
||||||
// - Dev/npm builds: package.json.
|
// - Dev/npm builds: package.json.
|
||||||
@@ -19,4 +29,5 @@ export const VERSION =
|
|||||||
(typeof __OPENCLAW_VERSION__ === "string" && __OPENCLAW_VERSION__) ||
|
(typeof __OPENCLAW_VERSION__ === "string" && __OPENCLAW_VERSION__) ||
|
||||||
process.env.OPENCLAW_BUNDLED_VERSION ||
|
process.env.OPENCLAW_BUNDLED_VERSION ||
|
||||||
readVersionFromPackageJson() ||
|
readVersionFromPackageJson() ||
|
||||||
|
readVersionFromBuildInfo() ||
|
||||||
"0.0.0";
|
"0.0.0";
|
||||||
|
|||||||
Reference in New Issue
Block a user