raiton 1.0.0-alpha.1 → 1.0.0-alpha.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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [1.0.0-alpha.2](https://github.com/protorians/raiton/compare/v1.0.0-alpha.1...v1.0.0-alpha.2) (2026-02-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * `CliTools`: add support for Deno runtime, improve runtime detection, and adjust spawn logic for `.ts` file handling ([71c506a](https://github.com/protorians/raiton/commit/71c506afcbb4ec3acffec8d4b36934afa8d0b6b3))
7
+
1
8
  # 1.0.0-alpha.1 (2026-02-16)
2
9
 
3
10
 
package/README.md CHANGED
@@ -1,22 +1,99 @@
1
1
  # Protorians Raiton
2
- Protorians Raiton development kit for backend microservice
3
2
 
4
- ## Bun Optimization
5
- Raiton is optimized for Bun. It automatically detects the Bun runtime and uses `Bun.serve` for maximum performance.
3
+ [![Version](https://img.shields.io/npm/v/raiton.svg)](https://www.npmjs.com/package/raiton)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
5
 
7
- ### Usage with Bun
8
- To run your project with Bun:
6
+ **Protorians Raiton** est un kit de développement (SDK) backend moderne et performant,
7
+ conçu pour construire des microservices TypeScript. Optimisé pour **Bun**,
8
+ il offre également un support complet pour **Node.js** et **Deno**.
9
+
10
+ ## Caractéristiques
11
+
12
+ - **Optimisé pour Bun** : Utilise `Bun.serve` nativement pour des performances maximales.
13
+ - **Multi-Runtime** : Compatible avec Bun, Node.js, Deno et les environnements Web.
14
+ - **Architecture Décorative** : Utilise les décorateurs TypeScript pour définir contrôleurs, routes et injections.
15
+ - **Modulaire** : Système de plugins et de middlewares flexible.
16
+ - **CLI Puissant** : Outils intégrés pour le développement, le build et le déploiement.
17
+
18
+ ## Installation
9
19
 
10
20
  ```bash
11
- bun run source/bin/index.ts
21
+ bun add raiton reflect-metadata
22
+ # ou
23
+ npm install raiton reflect-metadata
24
+ ```
25
+
26
+ > **Note :** Raiton nécessite `reflect-metadata` pour fonctionner avec les décorateurs. Importez-le au début de votre point d'entrée.
27
+
28
+ ## Démarrage Rapide
29
+
30
+ ### 1. Créez un contrôleur (`source/controllers/hello.controller.ts`)
31
+
32
+ ```typescript
33
+ import { Controllable, Get, Param } from "raiton/sdk";
34
+
35
+ @Controllable('/hello')
36
+ export class HelloController {
37
+ @Get('/')
38
+ index() {
39
+ return { message: "Bonjour de Raiton !" };
40
+ }
41
+
42
+ @Get('/:name')
43
+ greet(@Param("name") name?: string) {
44
+ return { message: `Bonjour, ${name} !` };
45
+ }
46
+ }
47
+ ```
48
+
49
+ ### 2. Configurez votre application (`source/main.ts`)
50
+
51
+ ```typescript
52
+ import "reflect-metadata";
53
+ import {ThreadInterface} from "raiton/types";
54
+ import {Application} from "raiton/core";
55
+
56
+ export default async function (thread: ThreadInterface) {
57
+ const app = new Application({
58
+ port: 3000,
59
+ prefix: '/api'
60
+ });
61
+
62
+ // Enregistrez vos plugins, middlewares et contrôleurs ici
63
+ // ...
64
+
65
+ // Lier son application au thread
66
+ return await thread.setup({application: app}).run()
67
+ }
12
68
  ```
13
69
 
14
- Or using the provided scripts:
70
+ ## Utilisation du CLI
71
+
72
+ Raiton est livré avec une interface en ligne de commande pour faciliter le développement.
15
73
 
16
74
  ```bash
17
- # Development mode with hot reload
18
- bun run bun:dev
75
+ # Lancer en mode développement (avec hot reload)
76
+ bun raiton develop
77
+
78
+ # Builder le projet
79
+ bun raiton build
19
80
 
20
- # Start built project
21
- bun run bun:start
81
+ # Démarrer le projet buildé
82
+ bun raiton start
22
83
  ```
84
+
85
+ ## 🛠 Runtimes supportés
86
+
87
+ Raiton détecte automatiquement l'environnement d'exécution et adapte son serveur :
88
+
89
+ - **Bun** : Utilisation de `Bun.serve`.
90
+ - **Node.js** : Adaptateur pour serveurs HTTP Node.
91
+ - **Deno** : Support natif de l'environnement Deno.
92
+ - **Web** : Compatible avec les environnements basés sur les standards Web (Fetch API).
93
+
94
+ ## 📄 Licence
95
+
96
+ Ce projet est sous licence MIT. Voir le fichier [LICENSE](LICENSE) pour plus de détails.
97
+
98
+ ---
99
+ Développé avec ❤️ par **Y. Yannick GOBOU**
@@ -6720,20 +6720,33 @@ class RaitonCommands {
6720
6720
  }
6721
6721
  // source/bin/cli-tools.ts
6722
6722
  import { spawn } from "node:child_process";
6723
- var isBunUsed = typeof Bun !== "undefined";
6723
+ var isBunUsed = typeof globalThis.Bun !== "undefined";
6724
+ var isDenoUsed = typeof globalThis.Deno !== "undefined";
6724
6725
 
6725
6726
  class CliTools {
6726
6727
  static get cwd() {
6727
- return `${process.cwd()}`;
6728
+ return `${isDenoUsed ? globalThis.Deno.cwd() : process.cwd()}`;
6728
6729
  }
6729
6730
  static set cwd(value) {
6730
- process.chdir(value);
6731
+ if (isDenoUsed) {
6732
+ globalThis.Deno.chdir(value);
6733
+ } else {
6734
+ process.chdir(value);
6735
+ }
6731
6736
  }
6732
6737
  static get argv() {
6733
- return isBunUsed ? Bun.argv : process.argv;
6738
+ if (isBunUsed)
6739
+ return globalThis.Bun.argv;
6740
+ if (isDenoUsed)
6741
+ return globalThis.Deno.args;
6742
+ return process.argv;
6734
6743
  }
6735
6744
  static get process() {
6736
- return isBunUsed ? Bun : process;
6745
+ if (isBunUsed)
6746
+ return globalThis.Bun;
6747
+ if (isDenoUsed)
6748
+ return globalThis.Deno;
6749
+ return process;
6737
6750
  }
6738
6751
  static spawn(command2, args = [], options) {
6739
6752
  if (isBunUsed) {
@@ -6746,11 +6759,26 @@ class CliTools {
6746
6759
  }
6747
6760
  return Bun.spawn(cmdArray, options);
6748
6761
  }
6762
+ if (isDenoUsed) {
6763
+ const cmd2 = typeof command2 == "string" ? command2 : command2[0];
6764
+ const cmdArgs2 = typeof command2 == "string" ? args : [...command2.slice(1), ...args];
6765
+ if (cmd2.endsWith(".ts")) {
6766
+ return new Deno.Command("deno", {
6767
+ args: ["run", "-A", cmd2, ...cmdArgs2],
6768
+ ...options
6769
+ }).spawn();
6770
+ }
6771
+ return new Deno.Command(cmd2, {
6772
+ args: cmdArgs2,
6773
+ ...options
6774
+ }).spawn();
6775
+ }
6749
6776
  const cmd = typeof command2 == "string" ? command2 : command2[0];
6777
+ const cmdArgs = typeof command2 == "string" ? args : [...command2.slice(1), ...args];
6750
6778
  if (cmd.endsWith(".ts")) {
6751
- return spawn("bun", [cmd, ...args], options);
6779
+ return spawn("node", ["--loader", "ts-node/register", cmd, ...cmdArgs], options);
6752
6780
  }
6753
- return spawn(cmd, args, options);
6781
+ return spawn(cmd, cmdArgs, options);
6754
6782
  }
6755
6783
  }
6756
6784
 
@@ -6780,7 +6808,7 @@ var {
6780
6808
  Help
6781
6809
  } = import__.default;
6782
6810
  // package.json
6783
- var version = "1.0.0-alpha.1";
6811
+ var version = "1.0.0-alpha.2";
6784
6812
 
6785
6813
  // source/bin/cli.ts
6786
6814
  var CLI = new Command;
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "raiton",
3
- "version": "1.0.0-alpha.1",
3
+ "version": "1.0.0-alpha.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Protorians Raiton Development Kit",
@@ -16,7 +16,9 @@
16
16
  "development",
17
17
  "kit",
18
18
  "typescript",
19
+ "node",
19
20
  "bun",
21
+ "deno",
20
22
  "backend"
21
23
  ],
22
24
  "author": "Y. Yannick GOBOU",
@@ -1,22 +1,34 @@
1
1
  import {spawn} from 'node:child_process';
2
2
 
3
- const isBunUsed = typeof Bun !== "undefined";
3
+ const isBunUsed = typeof (globalThis as any).Bun !== "undefined";
4
+ const isDenoUsed = typeof (globalThis as any).Deno !== "undefined";
5
+
6
+ declare const Bun: any;
7
+ declare const Deno: any;
4
8
 
5
9
  export class CliTools {
6
10
  static get cwd() {
7
- return `${process.cwd()}`;
11
+ return `${isDenoUsed ? (globalThis as any).Deno.cwd() : process.cwd()}`;
8
12
  }
9
13
 
10
14
  static set cwd(value: string) {
11
- process.chdir(value)
15
+ if (isDenoUsed) {
16
+ (globalThis as any).Deno.chdir(value);
17
+ } else {
18
+ process.chdir(value);
19
+ }
12
20
  }
13
21
 
14
22
  static get argv() {
15
- return isBunUsed ? Bun.argv : process.argv;
23
+ if (isBunUsed) return (globalThis as any).Bun.argv;
24
+ if (isDenoUsed) return (globalThis as any).Deno.args;
25
+ return process.argv;
16
26
  }
17
27
 
18
28
  static get process() {
19
- return isBunUsed ? Bun : process;
29
+ if (isBunUsed) return (globalThis as any).Bun;
30
+ if (isDenoUsed) return (globalThis as any).Deno;
31
+ return process;
20
32
  }
21
33
 
22
34
  static spawn(command: string | string[], args: string[] = [], options?: Record<string, any>) {
@@ -25,19 +37,37 @@ export class CliTools {
25
37
  ...(typeof command == 'string' ? [command] : (Array.isArray(command) ? command : [])),
26
38
  ...args
27
39
  ];
28
- // If the command is a .ts file, prepend bun
29
40
  if (typeof command === 'string' && command.endsWith('.ts')) {
30
41
  cmdArray.unshift('bun');
31
42
  }
32
43
  return Bun.spawn(cmdArray, options);
33
44
  }
34
45
 
46
+ if (isDenoUsed) {
47
+ const cmd = typeof command == 'string' ? command : command[0];
48
+ const cmdArgs = typeof command == 'string' ? args : [...command.slice(1), ...args];
49
+
50
+ if (cmd.endsWith('.ts')) {
51
+ return new Deno.Command('deno', {
52
+ args: ['run', '-A', cmd, ...cmdArgs],
53
+ ...options
54
+ }).spawn();
55
+ }
56
+
57
+
58
+ return new Deno.Command(cmd, {
59
+ args: cmdArgs,
60
+ ...options
61
+ }).spawn();
62
+ }
63
+
35
64
  const cmd = typeof command == 'string' ? command : command[0];
36
- // If the command is a .ts file, prepend bun (or npx tsx/ts-node if we wanted to be Node generic, but here we favor Bun)
65
+ const cmdArgs = typeof command == 'string' ? args : [...command.slice(1), ...args];
66
+
37
67
  if (cmd.endsWith('.ts')) {
38
- return spawn('bun', [cmd, ...args], options);
68
+ return spawn('node', ['--loader', 'ts-node/register', cmd, ...cmdArgs], options);
39
69
  }
40
70
 
41
- return spawn(cmd, args, options);
71
+ return spawn(cmd, cmdArgs, options);
42
72
  }
43
73
  }
Binary file