@deimoscloud/coreai 0.1.4 → 0.1.6
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.
- package/dist/cli/index.js +44 -27
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +20 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/commands/cache.ts +1 -1
- package/src/index.ts +23 -3
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -4,10 +4,30 @@
|
|
|
4
4
|
* This is the main library export for programmatic usage.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import { readFileSync } from 'fs';
|
|
8
|
+
import { dirname, join } from 'path';
|
|
9
|
+
import { fileURLToPath } from 'url';
|
|
10
10
|
|
|
11
|
+
// Find package.json by walking up from the current module
|
|
12
|
+
function findPackageJson(): string {
|
|
13
|
+
let dir = dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
while (dir !== dirname(dir)) {
|
|
15
|
+
const pkgPath = join(dir, 'package.json');
|
|
16
|
+
try {
|
|
17
|
+
const content = readFileSync(pkgPath, 'utf-8');
|
|
18
|
+
const pkg = JSON.parse(content);
|
|
19
|
+
if (pkg.name === '@deimoscloud/coreai') {
|
|
20
|
+
return content;
|
|
21
|
+
}
|
|
22
|
+
} catch {
|
|
23
|
+
// Continue searching
|
|
24
|
+
}
|
|
25
|
+
dir = dirname(dir);
|
|
26
|
+
}
|
|
27
|
+
return '{"version": "unknown"}';
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const packageJson = JSON.parse(findPackageJson());
|
|
11
31
|
export const VERSION: string = packageJson.version;
|
|
12
32
|
|
|
13
33
|
// Configuration
|