@ezetgalaxy/titan 25.11.3 → 25.11.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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
  import fs from "fs";
3
3
  import path from "path";
4
4
  import { execSync, spawn } from "child_process";
@@ -94,13 +94,13 @@ Next steps:
94
94
  // RUN BUNDLER
95
95
  // ------------------------------------------
96
96
  function runBundler() {
97
- const bundler = path.join(process.cwd(), "titan", "bundler.js");
97
+ const bundler = path.join(process.cwd(), "titan", "bundle.js");
98
98
 
99
99
  if (fs.existsSync(bundler)) {
100
100
  console.log(cyan("Titan: bundling actions..."));
101
101
  execSync(`node ${bundler}`, { stdio: "inherit" });
102
102
  } else {
103
- console.log(yellow("Warning: cli/bundle.js missing."));
103
+ console.log(yellow("Warning: titan/bundle.js missing."));
104
104
  }
105
105
  }
106
106
 
@@ -144,9 +144,7 @@ function buildProd() {
144
144
  function startProd() {
145
145
  const isWindows = process.platform === "win32";
146
146
 
147
- const binaryName = isWindows
148
- ? "titan-server.exe"
149
- : "titan-server"; // Linux / macOS
147
+ const binaryName = isWindows ? "titan-server.exe" : "titan-server"; // Linux / macOS
150
148
 
151
149
  const exe = path.join(
152
150
  process.cwd(),
@@ -156,7 +154,7 @@ function startProd() {
156
154
  binaryName
157
155
  );
158
156
 
159
- execSync(`"${exe}"`, { stdio: "inherit", shell: true });
157
+ execSync(`"${exe}"`, { stdio: "inherit" });
160
158
  }
161
159
 
162
160
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ezetgalaxy/titan",
3
- "version": "25.11.3",
3
+ "version": "25.11.5",
4
4
  "description": "JavaScript backend framework that compiles your JS into a Rust + Axum server.",
5
5
  "license": "ISC",
6
6
  "author": "ezetgalaxy",
@@ -13,6 +13,7 @@
13
13
  "index.js",
14
14
  "scripts/",
15
15
  "templates/",
16
+ "titan",
16
17
  "README.md"
17
18
  ],
18
19
  "keywords": [
@@ -1,39 +1,71 @@
1
1
  #!/usr/bin/env bash
2
2
  set -e
3
- # Create dist folder and copy release binary
4
- ROOT=$(cd "$(dirname "$0")/.." && pwd)
3
+
4
+ echo "Building Titan distribution..."
5
+
6
+ # ---------------------------------------------
7
+ # Resolve directories
8
+ # ---------------------------------------------
9
+ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
5
10
  SERVER_DIR="$ROOT/server"
6
11
  DIST_DIR="$ROOT/dist"
12
+
13
+ # Clean and recreate dist/
7
14
  rm -rf "$DIST_DIR"
8
15
  mkdir -p "$DIST_DIR"
9
16
 
17
+ # ---------------------------------------------
18
+ # Copy release binary titan-server
19
+ # ---------------------------------------------
20
+ RELEASE_PATH="$SERVER_DIR/target/release"
10
21
 
11
- # copy binary
12
- if [ -f "$SERVER_DIR/target/release/titan-server" ]; then
13
- cp "$SERVER_DIR/target/release/titan-server" "$DIST_DIR/"
22
+ echo "Looking for titan-server binary..."
23
+
24
+ if [ -f "$RELEASE_PATH/titan-server" ]; then
25
+ echo "✓ Found titan-server"
26
+ cp "$RELEASE_PATH/titan-server" "$DIST_DIR/"
14
27
  else
15
- # on mac/linux after build the binary name may differ by package name
16
- BIN=$(ls "$SERVER_DIR/target/release" | grep titan-server || true)
17
- if [ -n "$BIN" ]; then
18
- cp "$SERVER_DIR/target/release/$BIN" "$DIST_DIR/titan-server"
19
- fi
20
- fi
28
+ echo "Binary not found directly, searching..."
29
+ BIN=$(ls "$RELEASE_PATH" | grep 'titan-server' || true)
21
30
 
31
+ if [ -n "$BIN" ]; then
32
+ echo "✓ Found matching binary: $BIN"
33
+ cp "$RELEASE_PATH/$BIN" "$DIST_DIR/titan-server"
34
+ else
35
+ echo "✗ titan-server binary not found in release folder."
36
+ echo "Did you run: cargo build --release ?"
37
+ exit 1
38
+ fi
39
+ fi
22
40
 
23
- # Generate routes.json from project root by inspecting templates (we assume user ran JS bundler to emit routes.build.json)
41
+ # ---------------------------------------------
42
+ # routes.json (JS bundler should generate routes.build.json)
43
+ # ---------------------------------------------
24
44
  if [ -f "$ROOT/routes.build.json" ]; then
25
- cp "$ROOT/routes.build.json" "$DIST_DIR/routes.json"
45
+ echo "✓ Using routes.build.json"
46
+ cp "$ROOT/routes.build.json" "$DIST_DIR/routes.json"
26
47
  else
27
- # try default template
28
- echo "{}" > "$DIST_DIR/routes.json"
48
+ echo "⚠ No routes.build.json found. Creating empty routes.json"
49
+ echo "{}" > "$DIST_DIR/routes.json"
29
50
  fi
30
51
 
31
-
32
- # copy handlers if any
52
+ # ---------------------------------------------
53
+ # Copy handlers if they exist
54
+ # ---------------------------------------------
33
55
  mkdir -p "$DIST_DIR/handlers"
56
+
34
57
  if [ -d "$ROOT/handlers" ]; then
35
- cp -r "$ROOT/handlers"/* "$DIST_DIR/handlers/" || true
58
+ echo " Copying handlers/"
59
+ cp -r "$ROOT/handlers/"* "$DIST_DIR/handlers/" 2>/dev/null || true
60
+ else
61
+ echo "⚠ No handlers/ directory found."
36
62
  fi
37
63
 
38
-
39
- echo "Created dist/ with titan-server and routes.json"
64
+ echo ""
65
+ echo "-------------------------------------------"
66
+ echo " ✔ Titan dist/ build complete"
67
+ echo "-------------------------------------------"
68
+ echo "Binary: dist/titan-server"
69
+ echo "Routes: dist/routes.json"
70
+ echo "Handlers: dist/handlers/"
71
+ echo ""
@@ -0,0 +1,6 @@
1
+ function getname(req) {
2
+ const name = req.name;
3
+ return { name: name, msg: "It's a demo action on titan" }
4
+ }
5
+
6
+ globalThis.getname = getname;
@@ -3,7 +3,7 @@ import t from "../titan/titan.js";
3
3
 
4
4
 
5
5
 
6
-
6
+ t.post("/getname").action("getname") // pass a json payload { "name": "titan" }
7
7
 
8
8
  t.get("/").reply("Ready to land on Titan 🚀");
9
9