@titanpl/cli 5.0.6 → 6.0.0
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/templates/common/.env +1 -0
- package/templates/common/Dockerfile +64 -0
- package/templates/common/README.md +85 -0
- package/templates/common/_dockerignore +35 -0
- package/templates/common/_gitignore +34 -0
- package/templates/common/_tanfig.json +14 -0
- package/templates/extension/index.d.ts +27 -0
- package/templates/extension/package.json +2 -2
- package/templates/js/package.json +8 -8
- package/templates/rust-js/package.json +4 -4
- package/templates/rust-ts/package.json +4 -4
- package/templates/ts/package.json +8 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@titanpl/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
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",
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"tit": "./index.js"
|
|
30
30
|
},
|
|
31
31
|
"optionalDependencies": {
|
|
32
|
-
"@titanpl/engine-win32-x64": "
|
|
33
|
-
"@titanpl/engine-linux-x64": "
|
|
32
|
+
"@titanpl/engine-win32-x64": "6.0.0",
|
|
33
|
+
"@titanpl/engine-linux-x64": "6.0.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@titanpl/packet": "
|
|
36
|
+
"@titanpl/packet": "6.0.0",
|
|
37
37
|
"prompts": "^2.4.2",
|
|
38
38
|
"commander": "^11.0.0",
|
|
39
39
|
"chalk": "^4.1.2"
|
|
40
40
|
}
|
|
41
|
-
}
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
TITAN_DEV=1
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# ================================================================
|
|
2
|
+
# STAGE 1 — Builder
|
|
3
|
+
# ================================================================
|
|
4
|
+
FROM node:20-slim AS builder
|
|
5
|
+
|
|
6
|
+
WORKDIR /app
|
|
7
|
+
|
|
8
|
+
# build-essential is required for native Titan extensions (C++ or Rust based)
|
|
9
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
10
|
+
build-essential pkg-config git ca-certificates \
|
|
11
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
12
|
+
|
|
13
|
+
ENV NODE_ENV=production
|
|
14
|
+
|
|
15
|
+
COPY package.json package-lock.json* ./
|
|
16
|
+
|
|
17
|
+
# Install with optional dependencies so it grabs the correct engine for the Linux builder
|
|
18
|
+
RUN npm install -g @titanpl/cli
|
|
19
|
+
|
|
20
|
+
RUN npm install --include=optional
|
|
21
|
+
|
|
22
|
+
COPY . .
|
|
23
|
+
|
|
24
|
+
# Run the Titan release build step (generates a 'build' folder)
|
|
25
|
+
RUN npx titan build --release
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# ================================================================
|
|
29
|
+
# STAGE 2 — Runtime (Optimized Pure Engine)
|
|
30
|
+
# ================================================================
|
|
31
|
+
FROM ubuntu:24.04
|
|
32
|
+
|
|
33
|
+
# Use an unprivileged user for security
|
|
34
|
+
RUN groupadd -r titan && useradd -r -g titan titan
|
|
35
|
+
|
|
36
|
+
WORKDIR /app
|
|
37
|
+
|
|
38
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
39
|
+
ca-certificates curl \
|
|
40
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
41
|
+
|
|
42
|
+
# Copy EVERYTHING from the generated build folder into Stage 2
|
|
43
|
+
# This includes dist/, .ext/, package.json, .env, and the titan-server binary
|
|
44
|
+
COPY --from=builder /app/build/ ./
|
|
45
|
+
|
|
46
|
+
# CRITICAL SYSTEM SETUP:
|
|
47
|
+
# Ensure the worker threads can find the extensions through the symlink
|
|
48
|
+
RUN ln -s /app/.ext /app/node_modules && \
|
|
49
|
+
chown -R titan:titan /app
|
|
50
|
+
|
|
51
|
+
# Standard environment variables
|
|
52
|
+
ENV HOST=0.0.0.0
|
|
53
|
+
ENV PORT=5100
|
|
54
|
+
ENV TITAN_DEV=0
|
|
55
|
+
|
|
56
|
+
USER titan
|
|
57
|
+
EXPOSE 5100
|
|
58
|
+
|
|
59
|
+
# Health check to ensure the server is alive
|
|
60
|
+
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
|
|
61
|
+
CMD curl -f http://localhost:5100/ || exit 1
|
|
62
|
+
|
|
63
|
+
# DYNAMIC ENTRYPOINT: Use the portable binary in the root of /app
|
|
64
|
+
CMD ["./titan-server", "start"]
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# ⏣ Titan Project
|
|
2
|
+
|
|
3
|
+
Welcome to your new **Titan Planet** project! Titan is a high-performance web framework designed for scale, speed, and developer happiness.
|
|
4
|
+
|
|
5
|
+
## 🚀 Getting Started
|
|
6
|
+
|
|
7
|
+
### 1. Install Dependencies
|
|
8
|
+
```bash
|
|
9
|
+
npm install
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### 2. Start Development Server
|
|
13
|
+
Run the project in development mode with hot-reloading:
|
|
14
|
+
```bash
|
|
15
|
+
titan dev
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### 3. Build for Production
|
|
19
|
+
Create a self-contained production bundle in the `build/` directory:
|
|
20
|
+
```bash
|
|
21
|
+
titan build --release
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### 4. Run Production Server
|
|
25
|
+
```bash
|
|
26
|
+
cd build
|
|
27
|
+
titan start
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 📂 Project Structure
|
|
33
|
+
|
|
34
|
+
- `app/actions/` - Your JavaScript/TypeScript backend logic.
|
|
35
|
+
- `public/` - Static assets served directly (images, robots.txt, etc.).
|
|
36
|
+
- `tanfig.json` - Core project configuration and build settings.
|
|
37
|
+
- `.env` - Environment variables.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 🛠 Configuration (`tanfig.json`)
|
|
42
|
+
|
|
43
|
+
Your project uses `tanfig.json` to control the build and runtime behavior.
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"name": "my-titan-app",
|
|
48
|
+
"build": {
|
|
49
|
+
"purpose": "test",
|
|
50
|
+
"files": ["public", "static", "db", "config"]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Build Options:
|
|
56
|
+
- **`purpose`**:
|
|
57
|
+
- `test`: (Default) Creates a `node_modules` junction for local testing.
|
|
58
|
+
- `deploy`: Slim build without `node_modules`, ready for production.
|
|
59
|
+
- **`files`**: List of folders/files from the root to include in the production `build/` folder.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 🐳 Docker Deployment
|
|
64
|
+
|
|
65
|
+
This project comes with a pre-configured, multi-stage `Dockerfile` optimized for Titan's native engine.
|
|
66
|
+
|
|
67
|
+
### Build Image
|
|
68
|
+
```bash
|
|
69
|
+
docker build -t my-titan-app .
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Run Container
|
|
73
|
+
```bash
|
|
74
|
+
docker run -p 5100:5100 my-titan-app
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## 🌐 Community & Support
|
|
80
|
+
|
|
81
|
+
- **Documentation**: [titanpl.vercel.app](https://titanpl.vercel.app)
|
|
82
|
+
- **GitHub**: [github.com/t8nlab/titanpl](https://github.com/t8nlab/titanpl)
|
|
83
|
+
- **Discord**: [Join our community](https://discord.gg/titanpl)
|
|
84
|
+
|
|
85
|
+
Built with ❤️ by the **Titan Planet** team.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
node_modules
|
|
2
|
+
npm-debug.log
|
|
3
|
+
.git
|
|
4
|
+
.gitignore
|
|
5
|
+
|
|
6
|
+
package-lock.json
|
|
7
|
+
yarn.lock
|
|
8
|
+
|
|
9
|
+
# Titan Gravity Engine
|
|
10
|
+
dist/
|
|
11
|
+
.titan/
|
|
12
|
+
.ext/
|
|
13
|
+
|
|
14
|
+
deploy/
|
|
15
|
+
|
|
16
|
+
# Rust Build Artifacts
|
|
17
|
+
server/target/
|
|
18
|
+
Cargo.lock
|
|
19
|
+
|
|
20
|
+
# OS Files
|
|
21
|
+
.DS_Store
|
|
22
|
+
Thumbs.db
|
|
23
|
+
*.tmp
|
|
24
|
+
*.bak
|
|
25
|
+
|
|
26
|
+
# Environment & Secrets
|
|
27
|
+
.env
|
|
28
|
+
.env.local
|
|
29
|
+
.env.*.local
|
|
30
|
+
|
|
31
|
+
# IDEs
|
|
32
|
+
.vscode/
|
|
33
|
+
.idea/
|
|
34
|
+
*.swp
|
|
35
|
+
*.swo
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Node & Packages
|
|
2
|
+
node_modules/
|
|
3
|
+
npm-debug.log*
|
|
4
|
+
yarn-debug.log*
|
|
5
|
+
yarn-error.log*
|
|
6
|
+
package-lock.json
|
|
7
|
+
yarn.lock
|
|
8
|
+
|
|
9
|
+
# Titan Engine (Auto-generated - DO NOT COMMIT)
|
|
10
|
+
dist/
|
|
11
|
+
.titan/
|
|
12
|
+
.ext/
|
|
13
|
+
.env
|
|
14
|
+
build/
|
|
15
|
+
|
|
16
|
+
# Rust Build Artifacts (If using Hybrid)
|
|
17
|
+
server/target/
|
|
18
|
+
Cargo.lock
|
|
19
|
+
|
|
20
|
+
# OS Files
|
|
21
|
+
.DS_Store
|
|
22
|
+
Thumbs.db
|
|
23
|
+
*.tmp
|
|
24
|
+
*.bak
|
|
25
|
+
|
|
26
|
+
# Environment & Secrets
|
|
27
|
+
.env.local
|
|
28
|
+
.env.*.local
|
|
29
|
+
|
|
30
|
+
# IDEs
|
|
31
|
+
.vscode/
|
|
32
|
+
.idea/
|
|
33
|
+
*.swp
|
|
34
|
+
*.swo
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Type definitions for {{name}}
|
|
2
|
+
// This file facilitates type inference when this extension is installed in a Titan project.
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
namespace Titan {
|
|
6
|
+
interface Runtime {
|
|
7
|
+
/**
|
|
8
|
+
* {{name}} Extension
|
|
9
|
+
*/
|
|
10
|
+
"{{name}}": {
|
|
11
|
+
/**
|
|
12
|
+
* Example hello function
|
|
13
|
+
*/
|
|
14
|
+
hello(name: string): string;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Example calc function (native wrapper)
|
|
18
|
+
*/
|
|
19
|
+
calc(a: number, b: number): number;
|
|
20
|
+
|
|
21
|
+
// Add your extension methods here
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "{{name}}",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "A Titan Planet extension",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@titanpl/core": "latest",
|
|
19
19
|
"chokidar": "^5.0.0",
|
|
20
20
|
"esbuild": "^0.27.2",
|
|
21
|
-
"titanpl-sdk": "
|
|
21
|
+
"titanpl-sdk": "6.0.0"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@tgrv/microgravity": "latest"
|
|
@@ -6,16 +6,16 @@
|
|
|
6
6
|
"template": "js"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@titanpl/cli": "
|
|
10
|
-
"@titanpl/route": "
|
|
11
|
-
"@titanpl/native": "
|
|
9
|
+
"@titanpl/cli": "6.0.0",
|
|
10
|
+
"@titanpl/route": "6.0.0",
|
|
11
|
+
"@titanpl/native": "6.0.0",
|
|
12
12
|
"@titanpl/core": "latest",
|
|
13
13
|
"@titanpl/node": "latest",
|
|
14
|
-
"@titanpl/packet": "
|
|
14
|
+
"@titanpl/packet": "6.0.0"
|
|
15
15
|
},
|
|
16
16
|
"optionalDependencies": {
|
|
17
|
-
"@titanpl/engine-linux-x64": "
|
|
18
|
-
"@titanpl/engine-win32-x64": "
|
|
17
|
+
"@titanpl/engine-linux-x64": "6.0.0",
|
|
18
|
+
"@titanpl/engine-win32-x64": "6.0.0"
|
|
19
19
|
},
|
|
20
20
|
"scripts": {
|
|
21
21
|
"build": "titan build",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"eslint": "^9.39.2",
|
|
29
29
|
"eslint-plugin-titanpl": "latest"
|
|
30
30
|
},
|
|
31
|
-
"version": "
|
|
32
|
-
}
|
|
31
|
+
"version": "6.0.0"
|
|
32
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "titanpl",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "A Titan Planet server",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"titan": {
|
|
7
7
|
"template": "rust-js"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@titanpl/cli": "
|
|
11
|
-
"@titanpl/route": "
|
|
12
|
-
"@titanpl/native": "
|
|
10
|
+
"@titanpl/cli": "6.0.0",
|
|
11
|
+
"@titanpl/route": "6.0.0",
|
|
12
|
+
"@titanpl/native": "6.0.0",
|
|
13
13
|
"@titanpl/core": "latest",
|
|
14
14
|
"@titanpl/node": "latest"
|
|
15
15
|
},
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "titanpl",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "A Titan Planet server (Rust + TypeScript)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"titan": {
|
|
7
7
|
"template": "rust-ts"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@titanpl/cli": "
|
|
11
|
-
"@titanpl/route": "
|
|
12
|
-
"@titanpl/native": "
|
|
10
|
+
"@titanpl/cli": "6.0.0",
|
|
11
|
+
"@titanpl/route": "6.0.0",
|
|
12
|
+
"@titanpl/native": "6.0.0",
|
|
13
13
|
"@titanpl/core": "latest",
|
|
14
14
|
"@titanpl/node": "latest",
|
|
15
15
|
"typescript": "^5.0.0"
|
|
@@ -6,18 +6,18 @@
|
|
|
6
6
|
"template": "ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@titanpl/cli": "
|
|
10
|
-
"@titanpl/route": "
|
|
11
|
-
"@titanpl/native": "
|
|
9
|
+
"@titanpl/cli": "6.0.0",
|
|
10
|
+
"@titanpl/route": "6.0.0",
|
|
11
|
+
"@titanpl/native": "6.0.0",
|
|
12
12
|
"@titanpl/core": "latest",
|
|
13
13
|
"@titanpl/node": "latest",
|
|
14
|
-
"@titanpl/packet": "
|
|
14
|
+
"@titanpl/packet": "6.0.0",
|
|
15
15
|
"typescript": "^5.0.0"
|
|
16
16
|
},
|
|
17
17
|
"optionalDependencies": {
|
|
18
18
|
"@titanpl/engine-linux-arm64": "2.0.5",
|
|
19
|
-
"@titanpl/engine-linux-x64": "
|
|
20
|
-
"@titanpl/engine-win32-x64": "
|
|
19
|
+
"@titanpl/engine-linux-x64": "6.0.0",
|
|
20
|
+
"@titanpl/engine-win32-x64": "6.0.0"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "titan build",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"eslint-plugin-titanpl": "latest",
|
|
32
32
|
"@typescript-eslint/parser": "^8.54.0"
|
|
33
33
|
},
|
|
34
|
-
"version": "
|
|
35
|
-
}
|
|
34
|
+
"version": "6.0.0"
|
|
35
|
+
}
|