@ezetgalaxy/titan 26.3.0 → 26.3.2

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";
@@ -368,23 +368,52 @@ function updateTitan() {
368
368
  console.log(cyan("Updating Titan runtime and server..."));
369
369
 
370
370
  // ----------------------------------------------------------
371
- // 1. Update titan/ runtime folder
371
+ // 1. Update titan/ runtime (authoritative, safe to replace)
372
372
  // ----------------------------------------------------------
373
- fs.rmSync(projectTitan, { recursive: true, force: true, maxRetries: 10, retryDelay: 500 });
373
+ fs.rmSync(projectTitan, {
374
+ recursive: true,
375
+ force: true,
376
+ maxRetries: 10,
377
+ retryDelay: 500,
378
+ });
379
+
374
380
  copyDir(templateTitan, projectTitan);
375
381
  console.log(green("✔ Updated titan/ runtime"));
376
382
 
377
383
  // ----------------------------------------------------------
378
- // 2. Update entire server/ folder (authoritative overwrite)
384
+ // 2. Update server/ WITHOUT deleting the folder
379
385
  // ----------------------------------------------------------
380
- fs.rmSync(projectServer, { recursive: true, force: true, maxRetries: 10, retryDelay: 500 });
381
- copyDir(templateServer, projectServer);
382
- console.log(green("✔ Updated server/ (Cargo.toml + src/)"));
386
+ if (!fs.existsSync(projectServer)) {
387
+ fs.mkdirSync(projectServer);
388
+ }
383
389
 
384
- // ----------------------------------------------------------
385
- // 3. Update project-level config files
386
- // ----------------------------------------------------------
387
- [".gitignore", ".dockerignore", "Dockerfile", "titan.d.ts"].forEach((file) => {
390
+ // 2a. Overwrite Cargo.toml
391
+ const srcCargo = path.join(templateServer, "Cargo.toml");
392
+ const destCargo = path.join(projectServer, "Cargo.toml");
393
+
394
+ if (fs.existsSync(srcCargo)) {
395
+ fs.copyFileSync(srcCargo, destCargo);
396
+ console.log(green("✔ Updated server/Cargo.toml"));
397
+ }
398
+
399
+ // 2b. Replace server/src only
400
+ const projectSrc = path.join(projectServer, "src");
401
+ const templateSrc = path.join(templateServer, "src");
402
+
403
+ if (fs.existsSync(projectSrc)) {
404
+ fs.rmSync(projectSrc, {
405
+ recursive: true,
406
+ force: true,
407
+ maxRetries: 10,
408
+ retryDelay: 500,
409
+ });
410
+ }
411
+
412
+ copyDir(templateSrc, projectSrc);
413
+ console.log(green("✔ Updated server/src/"));
414
+
415
+ // Root-level config files
416
+ [".gitignore", ".dockerignore", "Dockerfile"].forEach((file) => {
388
417
  const src = path.join(templatesRoot, file);
389
418
  const dest = path.join(root, file);
390
419
 
@@ -394,10 +423,26 @@ function updateTitan() {
394
423
  }
395
424
  });
396
425
 
426
+ // app/titan.d.ts (JS typing contract)
427
+ const appDir = path.join(root, "app");
428
+ const srcDts = path.join(templatesRoot, "titan.d.ts");
429
+ const destDts = path.join(appDir, "titan.d.ts");
430
+
431
+ if (fs.existsSync(srcDts)) {
432
+ if (!fs.existsSync(appDir)) {
433
+ fs.mkdirSync(appDir);
434
+ }
435
+
436
+ fs.copyFileSync(srcDts, destDts);
437
+ console.log(green("✔ Updated app/titan.d.ts"));
438
+ }
439
+
440
+
397
441
  console.log(bold(green("✔ Titan update complete")));
398
442
  }
399
443
 
400
444
 
445
+
401
446
  /* -------------------------------------------------------
402
447
  * ROUTER
403
448
  * ----------------------------------------------------- */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ezetgalaxy/titan",
3
- "version": "26.3.0",
3
+ "version": "26.3.2",
4
4
  "description": "Titan Planet is a JavaScript-first backend framework that embeds JS actions into a Rust + Axum server and ships as a single native binary. Routes are compiled to static metadata; only actions run in the embedded JS runtime. No Node.js. No event loop in production.",
5
5
  "license": "ISC",
6
6
  "author": "ezetgalaxy",
File without changes