gtx-cli 2.5.30-alpha.4 → 2.5.30-alpha.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/binaries/gtx-cli-darwin-arm64 +0 -0
- package/binaries/gtx-cli-darwin-x64 +0 -0
- package/binaries/gtx-cli-linux-arm64 +0 -0
- package/binaries/gtx-cli-linux-x64 +0 -0
- package/binaries/gtx-cli-win32-x64.exe +0 -0
- package/dist/fs/getPackageResource.d.ts +1 -0
- package/dist/fs/getPackageResource.js +6 -0
- package/dist/utils/packageJson.js +7 -3
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { logger } from '../console/logger.js';
|
|
3
4
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
4
5
|
export function fromPackageRoot(relative) {
|
|
6
|
+
logger.debug('fromPackageRoot __dirname' + __dirname);
|
|
5
7
|
return path.resolve(__dirname, `../../`, relative);
|
|
6
8
|
}
|
|
9
|
+
export function fromBinariesRoot(relative) {
|
|
10
|
+
logger.debug('fromBinariesRoot __dirname' + __dirname);
|
|
11
|
+
return path.resolve(__dirname, `../`, relative);
|
|
12
|
+
}
|
|
@@ -2,7 +2,7 @@ import { logger } from '../console/logger.js';
|
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import fs from 'node:fs';
|
|
5
|
-
import { fromPackageRoot } from '../fs/getPackageResource.js';
|
|
5
|
+
import { fromBinariesRoot, fromPackageRoot } from '../fs/getPackageResource.js';
|
|
6
6
|
import { exitSync } from '../console/logging.js';
|
|
7
7
|
// search for package.json such that we can run init in non-js projects
|
|
8
8
|
export async function searchForPackageJson(cwd = process.cwd()) {
|
|
@@ -33,9 +33,13 @@ export async function getPackageJson(cwd = process.cwd()) {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
export function getCLIVersion() {
|
|
36
|
-
|
|
36
|
+
let packageJsonPath = fromPackageRoot('package.json');
|
|
37
37
|
if (!fs.existsSync(packageJsonPath)) {
|
|
38
|
-
|
|
38
|
+
// Try binaries behavior instead
|
|
39
|
+
packageJsonPath = fromBinariesRoot('package.json');
|
|
40
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
41
|
+
return 'unknown';
|
|
42
|
+
}
|
|
39
43
|
}
|
|
40
44
|
try {
|
|
41
45
|
return JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')).version;
|