gtx-cli 2.5.30-alpha.0 → 2.5.30-alpha.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.
- 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/main.d.ts +1 -3
- package/dist/main.js +5 -57
- package/dist/router.d.ts +2 -0
- package/dist/router.js +50 -0
- package/package.json +8 -9
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/main.d.ts
CHANGED
package/dist/main.js
CHANGED
|
@@ -1,60 +1,8 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { spawn } from 'child_process';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
import { dirname, join } from 'path';
|
|
5
|
-
import { existsSync } from 'fs';
|
|
6
1
|
import { main } from './index.js';
|
|
7
2
|
import dotenv from 'dotenv';
|
|
8
3
|
import { program } from 'commander';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
// Map Node.js platform/arch to our binary names
|
|
15
|
-
const platformMap = {
|
|
16
|
-
darwin: {
|
|
17
|
-
x64: 'gtx-cli-darwin-x64',
|
|
18
|
-
arm64: 'gtx-cli-darwin-arm64',
|
|
19
|
-
},
|
|
20
|
-
linux: {
|
|
21
|
-
x64: 'gtx-cli-linux-x64',
|
|
22
|
-
arm64: 'gtx-cli-linux-arm64',
|
|
23
|
-
},
|
|
24
|
-
win32: {
|
|
25
|
-
x64: 'gtx-cli-win32-x64.exe',
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
return platformMap[platform]?.[arch] || null;
|
|
29
|
-
}
|
|
30
|
-
function tryExecuteBinary() {
|
|
31
|
-
const binaryName = detectPlatform();
|
|
32
|
-
if (!binaryName) {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
const binaryPath = join(__dirname, '..', 'binaries', binaryName);
|
|
36
|
-
if (!existsSync(binaryPath)) {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
// Spawn the appropriate binary with all arguments
|
|
40
|
-
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
41
|
-
stdio: 'inherit',
|
|
42
|
-
});
|
|
43
|
-
child.on('close', (code) => {
|
|
44
|
-
process.exit(code);
|
|
45
|
-
});
|
|
46
|
-
child.on('error', () => {
|
|
47
|
-
process.exit(1);
|
|
48
|
-
});
|
|
49
|
-
console.log('Binary executed successfully');
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
52
|
-
// Try to use standalone binary first, fall back to regular execution
|
|
53
|
-
if (!tryExecuteBinary()) {
|
|
54
|
-
dotenv.config({ path: '.env' });
|
|
55
|
-
dotenv.config({ path: '.env.local', override: true });
|
|
56
|
-
dotenv.config({ path: '.env.production', override: true });
|
|
57
|
-
main(program);
|
|
58
|
-
program.parse();
|
|
59
|
-
}
|
|
60
|
-
export { detectPlatform };
|
|
4
|
+
dotenv.config({ path: '.env' });
|
|
5
|
+
dotenv.config({ path: '.env.local', override: true });
|
|
6
|
+
dotenv.config({ path: '.env.production', override: true });
|
|
7
|
+
main(program);
|
|
8
|
+
program.parse();
|
package/dist/router.d.ts
ADDED
package/dist/router.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Routes to proper binary based on platform
|
|
3
|
+
import { spawn } from 'child_process';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { dirname, join } from 'path';
|
|
6
|
+
import { existsSync } from 'fs';
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = dirname(__filename);
|
|
9
|
+
function detectPlatform() {
|
|
10
|
+
const platform = process.platform;
|
|
11
|
+
const arch = process.arch;
|
|
12
|
+
// Map Node.js platform/arch to our binary names
|
|
13
|
+
const platformMap = {
|
|
14
|
+
darwin: {
|
|
15
|
+
x64: 'gtx-cli-darwin-x64',
|
|
16
|
+
arm64: 'gtx-cli-darwin-arm64',
|
|
17
|
+
},
|
|
18
|
+
linux: {
|
|
19
|
+
x64: 'gtx-cli-linux-x64',
|
|
20
|
+
arm64: 'gtx-cli-linux-arm64',
|
|
21
|
+
},
|
|
22
|
+
win32: {
|
|
23
|
+
x64: 'gtx-cli-win32-x64.exe',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
return platformMap[platform]?.[arch] || null;
|
|
27
|
+
}
|
|
28
|
+
function routeToBinary() {
|
|
29
|
+
const binaryName = detectPlatform();
|
|
30
|
+
if (!binaryName) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const binaryPath = join(__dirname, '..', 'binaries', binaryName);
|
|
34
|
+
if (!existsSync(binaryPath)) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
// Spawn the appropriate binary with all arguments
|
|
38
|
+
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
39
|
+
stdio: 'inherit',
|
|
40
|
+
});
|
|
41
|
+
child.on('close', (code) => {
|
|
42
|
+
process.exit(code);
|
|
43
|
+
});
|
|
44
|
+
child.on('error', () => {
|
|
45
|
+
process.exit(1);
|
|
46
|
+
});
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
// Entry point
|
|
50
|
+
routeToBinary();
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gtx-cli",
|
|
3
|
-
"version": "2.5.30-alpha.
|
|
3
|
+
"version": "2.5.30-alpha.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
|
-
"bin": "dist/
|
|
5
|
+
"bin": "dist/router.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
8
8
|
"binaries",
|
|
@@ -133,13 +133,12 @@
|
|
|
133
133
|
"build": "tsc && pnpm run build:exe",
|
|
134
134
|
"build:clean": "sh ../../scripts/clean.sh && pnpm run build",
|
|
135
135
|
"build:release": "pnpm run build:clean",
|
|
136
|
-
"build:exe": "
|
|
137
|
-
"build:exe:
|
|
138
|
-
"build:exe:darwin-
|
|
139
|
-
"build:exe:
|
|
140
|
-
"build:exe:linux-
|
|
141
|
-
"build:exe:
|
|
142
|
-
"build:exe:windows-x64": "bun build src/main.ts --compile --target=bun-windows-x64 --outfile=binaries/gtx-cli-win32-x64.exe --external \"\"",
|
|
136
|
+
"build:exe": "sh scripts/build-exe.sh all",
|
|
137
|
+
"build:exe:darwin-x64": "sh scripts/build-exe.sh darwin-x64",
|
|
138
|
+
"build:exe:darwin-arm64": "sh scripts/build-exe.sh darwin-arm64",
|
|
139
|
+
"build:exe:linux-x64": "sh scripts/build-exe.sh linux-x64",
|
|
140
|
+
"build:exe:linux-arm64": "sh scripts/build-exe.sh linux-arm64",
|
|
141
|
+
"build:exe:windows-x64": "sh scripts/build-exe.sh windows-x64",
|
|
143
142
|
"lint": "eslint \"src/**/*.{js,ts}\" \"./**/__tests__/**/*.{js,ts}\"",
|
|
144
143
|
"lint:fix": "eslint \"src/**/*.{js,ts}\" \"./**/__tests__/**/*.{js,ts}\" --fix",
|
|
145
144
|
"test": "vitest run --config=./vitest.config.ts",
|