@titanpl/cli 26.16.11 → 26.17.1
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/package.json +5 -5
- package/src/commands/dev.js +2 -2
- package/src/engine.js +28 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@titanpl/cli",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.17.1",
|
|
4
4
|
"description": "The unified CLI for Titan Planet. Use it to create, manage, build, and deploy high-performance backend projects.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"titanpl",
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"titan": "./index.js"
|
|
20
20
|
},
|
|
21
21
|
"optionalDependencies": {
|
|
22
|
-
"@titanpl/engine-win32-x64": "26.
|
|
23
|
-
"@titanpl/engine-linux-x64": "26.
|
|
24
|
-
"@titanpl/engine-darwin-arm64": "26.
|
|
22
|
+
"@titanpl/engine-win32-x64": "26.17.1",
|
|
23
|
+
"@titanpl/engine-linux-x64": "26.17.1",
|
|
24
|
+
"@titanpl/engine-darwin-arm64": "26.17.1"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@titanpl/packet": "26.
|
|
27
|
+
"@titanpl/packet": "26.17.1",
|
|
28
28
|
"prompts": "^2.4.2",
|
|
29
29
|
"commander": "^11.0.0",
|
|
30
30
|
"chalk": "^4.1.2"
|
package/src/commands/dev.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { dev } from "@titanpl/packet";
|
|
1
2
|
import { startEngine } from "../engine.js";
|
|
2
3
|
|
|
3
4
|
export async function devCommand() {
|
|
4
|
-
|
|
5
|
-
// There is no need for JS-based watchers or Node.js process managers.
|
|
5
|
+
await dev(process.cwd());
|
|
6
6
|
startEngine(true);
|
|
7
7
|
}
|
package/src/engine.js
CHANGED
|
@@ -16,16 +16,38 @@ export function getEngineBinaryPath() {
|
|
|
16
16
|
const pkgName = `@titanpl/engine-${platform}-${arch}`;
|
|
17
17
|
const binName = platform === 'win32' ? 'titan-server.exe' : 'titan-server';
|
|
18
18
|
|
|
19
|
-
// 1. Monorepo
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
// 1. Robust Binary Discovery (Monorepo, Local, or Global)
|
|
20
|
+
const searchPaths = [
|
|
21
|
+
__dirname,
|
|
22
|
+
process.cwd(),
|
|
23
|
+
path.join(process.cwd(), '..'),
|
|
24
|
+
path.join(process.cwd(), '..', '..')
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
for (let startPath of searchPaths) {
|
|
28
|
+
let current = startPath;
|
|
29
|
+
for (let i = 0; i < 8; i++) {
|
|
30
|
+
const potential = path.join(current, 'engine', 'target', 'release', binName);
|
|
31
|
+
if (fs.existsSync(potential)) return potential;
|
|
32
|
+
|
|
33
|
+
const parent = path.dirname(current);
|
|
34
|
+
if (parent === current) break;
|
|
35
|
+
current = parent;
|
|
36
|
+
}
|
|
24
37
|
}
|
|
25
38
|
|
|
26
39
|
// 2. Resolve installed optional dependency
|
|
27
40
|
try {
|
|
28
|
-
|
|
41
|
+
// We use a try/catch specifically for the resolve to provide a better diagnostic
|
|
42
|
+
let pkgPath;
|
|
43
|
+
try {
|
|
44
|
+
pkgPath = require.resolve(`${pkgName}/package.json`);
|
|
45
|
+
} catch (e) {
|
|
46
|
+
// Fallback: check if the binary exists in a standard location even if require.resolve fails
|
|
47
|
+
const fallbackBin = path.join(process.cwd(), 'node_modules', pkgName, 'bin', binName);
|
|
48
|
+
if (fs.existsSync(fallbackBin)) return fallbackBin;
|
|
49
|
+
throw e;
|
|
50
|
+
}
|
|
29
51
|
const pkgDir = path.dirname(pkgPath);
|
|
30
52
|
const binaryPath = path.join(pkgDir, 'bin', binName);
|
|
31
53
|
|