@jacexh/claude-web-console 0.2.3 → 0.2.4
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/bin/cli.js +16 -1
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -46,10 +46,25 @@ process.env.HOST = host;
|
|
|
46
46
|
import { fileURLToPath } from 'node:url';
|
|
47
47
|
import { dirname, join } from 'node:path';
|
|
48
48
|
import { spawn } from 'node:child_process';
|
|
49
|
+
import { existsSync } from 'node:fs';
|
|
50
|
+
import { createRequire } from 'node:module';
|
|
49
51
|
|
|
50
52
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
51
53
|
const serverEntry = join(__dirname, '..', 'server', 'src', 'index.ts');
|
|
52
|
-
|
|
54
|
+
|
|
55
|
+
// Find tsx binary: check local node_modules first, then resolve via require
|
|
56
|
+
function findTsx() {
|
|
57
|
+
const local = join(__dirname, '..', 'node_modules', '.bin', 'tsx');
|
|
58
|
+
if (existsSync(local)) return local;
|
|
59
|
+
try {
|
|
60
|
+
const require = createRequire(import.meta.url);
|
|
61
|
+
const tsxMain = require.resolve('tsx/package.json');
|
|
62
|
+
return join(dirname(tsxMain), 'dist', 'cli.mjs');
|
|
63
|
+
} catch {
|
|
64
|
+
return 'tsx'; // fallback to PATH
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const tsxBin = findTsx();
|
|
53
68
|
|
|
54
69
|
const child = spawn(tsxBin, [serverEntry], {
|
|
55
70
|
stdio: 'inherit',
|