@titanpl/cli 5.0.3 → 5.0.5
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 +2 -2
- package/src/commands/update.js +24 -3
- package/src/engine.js +25 -5
- package/templates/common/README.md +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@titanpl/cli",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.5",
|
|
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",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@titanpl/engine-linux-x64": "2.0.4"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@titanpl/packet": "4.0.
|
|
36
|
+
"@titanpl/packet": "4.0.2",
|
|
37
37
|
"prompts": "^2.4.2",
|
|
38
38
|
"commander": "^11.0.0",
|
|
39
39
|
"chalk": "^4.1.2"
|
package/src/commands/update.js
CHANGED
|
@@ -58,9 +58,30 @@ export async function updateCommand() {
|
|
|
58
58
|
console.log(chalk.yellow(` ⚠️ Failed to update package.json: ${e.message}`));
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
// 2.
|
|
62
|
-
const
|
|
63
|
-
|
|
61
|
+
// 2. Migration: rename titan.json to tanfig.json if needed
|
|
62
|
+
const oldConfigPath = path.join(root, 'titan.json');
|
|
63
|
+
const newConfigPath = path.join(root, 'tanfig.json');
|
|
64
|
+
if (fs.existsSync(oldConfigPath) && !fs.existsSync(newConfigPath)) {
|
|
65
|
+
fs.renameSync(oldConfigPath, newConfigPath);
|
|
66
|
+
console.log(chalk.green(` ✔ Migrated titan.json to tanfig.json`));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// 3. Refresh Dockerfile and dotfiles from templates
|
|
70
|
+
let commonDir = null;
|
|
71
|
+
const tryCommonPaths = [
|
|
72
|
+
path.resolve(__dirname, '..', '..', '..', '..', 'templates', 'common'), // Monorepo
|
|
73
|
+
path.resolve(__dirname, '..', '..', 'templates', 'common'), // NPM cli package
|
|
74
|
+
path.resolve(__dirname, '..', '..', '..', 'templates', 'common') // Fallback
|
|
75
|
+
];
|
|
76
|
+
|
|
77
|
+
for (const p of tryCommonPaths) {
|
|
78
|
+
if (fs.existsSync(p)) {
|
|
79
|
+
commonDir = p;
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (commonDir) {
|
|
64
85
|
const filesToSync = [
|
|
65
86
|
['Dockerfile', 'Dockerfile'],
|
|
66
87
|
['_dockerignore', '.dockerignore'],
|
package/src/engine.js
CHANGED
|
@@ -19,6 +19,7 @@ export function resolveEngineBinaryPath() {
|
|
|
19
19
|
const arch = os.arch();
|
|
20
20
|
const pkgName = `@titanpl/engine-${platform}-${arch}`;
|
|
21
21
|
const binName = platform === 'win32' ? 'titan-server.exe' : 'titan-server';
|
|
22
|
+
const shortPkgName = pkgName.split('/').pop();
|
|
22
23
|
|
|
23
24
|
// 1. Monorepo search (local dev)
|
|
24
25
|
const searchPaths = [
|
|
@@ -31,8 +32,14 @@ export function resolveEngineBinaryPath() {
|
|
|
31
32
|
for (let startPath of searchPaths) {
|
|
32
33
|
let current = startPath;
|
|
33
34
|
for (let i = 0; i < 8; i++) {
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
// Check built binary (engine/target/release/...)
|
|
36
|
+
const builtBin = path.join(current, 'engine', 'target', 'release', binName);
|
|
37
|
+
if (fs.existsSync(builtBin)) return builtBin;
|
|
38
|
+
|
|
39
|
+
// Check package binary (packages/engine-*/bin/...)
|
|
40
|
+
const pkgBin = path.join(current, 'packages', shortPkgName, 'bin', binName);
|
|
41
|
+
if (fs.existsSync(pkgBin)) return pkgBin;
|
|
42
|
+
|
|
36
43
|
const parent = path.dirname(current);
|
|
37
44
|
if (parent === current) break;
|
|
38
45
|
current = parent;
|
|
@@ -47,9 +54,22 @@ export function resolveEngineBinaryPath() {
|
|
|
47
54
|
} catch (e) { }
|
|
48
55
|
|
|
49
56
|
// 3. Fallback: sibling in node_modules (global install layout)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
// We need to handle scoped packages correctly.
|
|
58
|
+
// If we are at .../node_modules/@titanpl/cli/src
|
|
59
|
+
// Up 1: .../node_modules/@titanpl/cli
|
|
60
|
+
// Up 2: .../node_modules/@titanpl
|
|
61
|
+
// Up 3: .../node_modules (This is where the engine package should be)
|
|
62
|
+
let current = __dirname;
|
|
63
|
+
for (let i = 0; i < 5; i++) {
|
|
64
|
+
const potentialNm = path.join(current, 'node_modules');
|
|
65
|
+
if (fs.existsSync(potentialNm)) {
|
|
66
|
+
const siblingBin = path.join(potentialNm, pkgName, 'bin', binName);
|
|
67
|
+
if (fs.existsSync(siblingBin)) return siblingBin;
|
|
68
|
+
}
|
|
69
|
+
const parent = path.dirname(current);
|
|
70
|
+
if (parent === current) break;
|
|
71
|
+
current = parent;
|
|
72
|
+
}
|
|
53
73
|
|
|
54
74
|
// 4. Walk upwards from current dir searching for binary in root or .ext/node_modules
|
|
55
75
|
let searchDir = process.cwd();
|
|
@@ -78,7 +78,7 @@ docker run -p 5100:5100 my-titan-app
|
|
|
78
78
|
|
|
79
79
|
## 🌐 Community & Support
|
|
80
80
|
|
|
81
|
-
- **Documentation**: [docs.titanpl.com](https://
|
|
81
|
+
- **Documentation**: [docs.titanpl.com](https://titanpl.vercel.app)
|
|
82
82
|
- **GitHub**: [github.com/t8nlab/titanpl](https://github.com/t8nlab/titanpl)
|
|
83
83
|
- **Discord**: [Join our community](https://discord.gg/titanpl)
|
|
84
84
|
|