mirror of https://github.com/openclaw/openclaw.git
fix: use build-info for version fallback
This commit is contained in:
parent
f1cbe7db1d
commit
a9bb96ade3
|
|
@ -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";
|
||||
|
|
|
|||
Loading…
Reference in New Issue