gtx-cli 2.5.30-alpha.1 → 2.5.30-alpha.10

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.
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1 @@
1
+ export declare const PACKAGE_VERSION = "2.5.30-alpha.10";
@@ -0,0 +1,2 @@
1
+ // This file is auto-generated. Do not edit manually.
2
+ export const PACKAGE_VERSION = '2.5.30-alpha.10';
package/dist/router.js CHANGED
@@ -3,7 +3,7 @@
3
3
  import { spawn } from 'child_process';
4
4
  import { fileURLToPath } from 'url';
5
5
  import { dirname, join } from 'path';
6
- import { existsSync } from 'fs';
6
+ import { existsSync, chmodSync, statSync } from 'fs';
7
7
  const __filename = fileURLToPath(import.meta.url);
8
8
  const __dirname = dirname(__filename);
9
9
  function detectPlatform() {
@@ -34,6 +34,20 @@ function routeToBinary() {
34
34
  if (!existsSync(binaryPath)) {
35
35
  return;
36
36
  }
37
+ // Check and fix execute permissions if needed (Unix-like systems only)
38
+ if (process.platform !== 'win32') {
39
+ try {
40
+ const stats = statSync(binaryPath);
41
+ const isExecutable = !!(stats.mode & parseInt('100', 8)); // Check owner execute bit
42
+ if (!isExecutable) {
43
+ chmodSync(binaryPath, 0o755); // Make executable
44
+ }
45
+ }
46
+ catch (error) {
47
+ // If we can't check/fix permissions, continue anyway
48
+ // The spawn might still work or give a more meaningful error
49
+ }
50
+ }
37
51
  // Spawn the appropriate binary with all arguments
38
52
  const child = spawn(binaryPath, process.argv.slice(2), {
39
53
  stdio: 'inherit',
@@ -2,8 +2,8 @@ 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';
6
5
  import { exitSync } from '../console/logging.js';
6
+ import { PACKAGE_VERSION } from '../generated/version.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()) {
9
9
  // Get the current working directory (where the CLI is being run)
@@ -33,16 +33,7 @@ export async function getPackageJson(cwd = process.cwd()) {
33
33
  }
34
34
  }
35
35
  export function getCLIVersion() {
36
- const packageJsonPath = fromPackageRoot('package.json');
37
- if (!fs.existsSync(packageJsonPath)) {
38
- return 'unknown';
39
- }
40
- try {
41
- return JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')).version;
42
- }
43
- catch (error) {
44
- return 'unknown';
45
- }
36
+ return PACKAGE_VERSION;
46
37
  }
47
38
  export async function updatePackageJson(packageJson, cwd = process.cwd()) {
48
39
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gtx-cli",
3
- "version": "2.5.30-alpha.1",
3
+ "version": "2.5.30-alpha.10",
4
4
  "main": "dist/index.js",
5
5
  "bin": "dist/router.js",
6
6
  "files": [
@@ -130,16 +130,15 @@
130
130
  "typescript": "^5.5.4"
131
131
  },
132
132
  "scripts": {
133
- "build": "tsc && pnpm run build:exe",
134
- "build:clean": "sh ../../scripts/clean.sh && pnpm run build",
133
+ "build": "node scripts/generate-version.js && tsc && pnpm run build:exe",
134
+ "build:clean": "sh ../../scripts/clean.sh && rm -rf binaries && pnpm run build",
135
135
  "build:release": "pnpm run build:clean",
136
- "build:exe": "mkdir -p binaries && pnpm run build:exe:all",
137
- "build:exe:all": "pnpm run build:exe:darwin-x64 && pnpm run build:exe:darwin-arm64 && pnpm run build:exe:linux-x64 && pnpm run build:exe:linux-arm64 && pnpm run build:exe:windows-x64",
138
- "build:exe:darwin-x64": "bun build src/main.ts --compile --target=bun-darwin-x64 --outfile=binaries/gtx-cli-darwin-x64 --external \"\"",
139
- "build:exe:darwin-arm64": "bun build src/main.ts --compile --target=bun-darwin-arm64 --outfile=binaries/gtx-cli-darwin-arm64 --external \"\"",
140
- "build:exe:linux-x64": "bun build src/main.ts --compile --target=bun-linux-x64 --outfile=binaries/gtx-cli-linux-x64 --external \"\"",
141
- "build:exe:linux-arm64": "bun build src/main.ts --compile --target=bun-linux-arm64 --outfile=binaries/gtx-cli-linux-arm64 --external \"\"",
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",
@@ -147,6 +146,7 @@
147
146
  "release": "pnpm run build:clean && pnpm publish",
148
147
  "release:alpha": "pnpm run build:clean && pnpm publish --tag alpha",
149
148
  "release:beta": "pnpm run build:clean && pnpm publish --tag beta",
149
+ "release:bin": "pnpm run build:clean && pnpm publish --tag bin",
150
150
  "release:latest": "pnpm run build:clean && pnpm publish --tag latest"
151
151
  }
152
152
  }
@@ -1 +0,0 @@
1
- export declare function fromPackageRoot(relative: string): string;
@@ -1,6 +0,0 @@
1
- import path from 'node:path';
2
- import { fileURLToPath } from 'node:url';
3
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
4
- export function fromPackageRoot(relative) {
5
- return path.resolve(__dirname, `../../`, relative);
6
- }