@aronnaxlin/bgm-cli 1.1.3 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Single source of truth for the CLI version at runtime.
3
+ *
4
+ * The released version lives in git tags (vX.Y.Z). The release workflow stamps
5
+ * it into package.json right before `npm publish`, so a published package
6
+ * always reports its real version. A source checkout reports the placeholder
7
+ * committed to package.json, like a dev build.
8
+ */
9
+
10
+ import { readFileSync } from "node:fs";
11
+
12
+ export const DEV_VERSION = "0.0.0-dev";
13
+
14
+ function readPackageVersion() {
15
+ try {
16
+ const raw = readFileSync(new URL("../../package.json", import.meta.url), "utf8");
17
+ const version = JSON.parse(raw).version;
18
+ return typeof version === "string" && version ? version : DEV_VERSION;
19
+ } catch {
20
+ return DEV_VERSION;
21
+ }
22
+ }
23
+
24
+ export const APP_VERSION = readPackageVersion();