@veolab/discoverylab 1.2.0 → 1.2.2

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,30 @@
1
+ // src/core/appVersion.ts
2
+ import { existsSync, readFileSync } from "fs";
3
+ import { dirname, join } from "path";
4
+ import { fileURLToPath } from "url";
5
+ function findPackageVersion() {
6
+ const moduleDir = dirname(fileURLToPath(import.meta.url));
7
+ const searchRoots = [
8
+ moduleDir,
9
+ dirname(moduleDir),
10
+ dirname(dirname(moduleDir)),
11
+ dirname(dirname(dirname(moduleDir)))
12
+ ];
13
+ for (const root of searchRoots) {
14
+ const packageJsonPath = join(root, "package.json");
15
+ if (!existsSync(packageJsonPath)) continue;
16
+ try {
17
+ const pkg = JSON.parse(readFileSync(packageJsonPath, "utf8"));
18
+ if (typeof pkg.version === "string" && pkg.version.trim()) {
19
+ return pkg.version.trim();
20
+ }
21
+ } catch {
22
+ }
23
+ }
24
+ return "0.0.0";
25
+ }
26
+ var APP_VERSION = findPackageVersion();
27
+
28
+ export {
29
+ APP_VERSION
30
+ };