fleetbo-cockpit-cli 1.0.104 → 1.0.106

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.
Files changed (2) hide show
  1. package/cli.js +46 -24
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -5,41 +5,66 @@
5
5
  process.stdout.write("\x1b[1A\x1b[2K".repeat(4));
6
6
  console.clear();
7
7
 
8
- const { spawn, execSync } = require('child_process');
9
- const fs = require('fs');
10
- const path = require('path');
11
- const axios = require('axios');
12
- const dotenv = require('dotenv');
13
- const os = require('os');
14
- const archiver = require('archiver');
15
- const readline = require('readline');
16
-
17
8
  // ============================================
18
- // OS SPINNER (Terminal Animation Engine)
9
+ // 1. MOTEUR D'ANIMATION PRÉ-BOOT (Blindé)
19
10
  // ============================================
20
11
  class FleetboSpinner {
21
12
  constructor() {
22
13
  this.frames = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
23
14
  this.idx = 0;
24
15
  this.timer = null;
16
+ this.currentMessage = "";
25
17
  }
26
18
  start(message) {
27
- if (this.timer) return;
28
- process.stdout.write('\x1b[?25l'); // Cache le curseur natif
19
+ this.currentMessage = message;
20
+
21
+ if (this.timer) {
22
+ process.stdout.write(`\r\x1b[2K \x1b[32m${this.frames[this.idx]}\x1b[0m ${this.currentMessage}`);
23
+ return;
24
+ }
25
+
26
+ process.stdout.write('\x1b[?25l');
27
+
28
+ process.stdout.write(`\r\x1b[2K \x1b[32m${this.frames[this.idx]}\x1b[0m ${this.currentMessage}`);
29
+ this.idx = (this.idx + 1) % this.frames.length;
30
+
29
31
  this.timer = setInterval(() => {
30
- // \r revient au début, \x1b[2K efface la ligne
31
- process.stdout.write(`\r\x1b[2K \x1b[32m${this.frames[this.idx]}\x1b[0m ${message}`);
32
+ process.stdout.write(`\r\x1b[2K \x1b[32m${this.frames[this.idx]}\x1b[0m ${this.currentMessage}`);
32
33
  this.idx = (this.idx + 1) % this.frames.length;
33
34
  }, 80);
34
35
  }
35
36
  stop() {
36
- if (this.timer) clearInterval(this.timer);
37
- this.timer = null;
38
- process.stdout.write('\x1b[?25h\r\x1b[2K'); // Réaffiche le curseur et nettoie la ligne
37
+ if (this.timer) {
38
+ clearInterval(this.timer);
39
+ this.timer = null;
40
+ }
41
+ // 🛡️ HARD-CLEAR : On écrase physiquement avec des espaces pour éviter le Ghosting
42
+ process.stdout.write('\r' + ' '.repeat(60) + '\r\x1b[?25h');
39
43
  }
40
44
  }
41
45
  const osSpinner = new FleetboSpinner();
42
46
 
47
+ // ============================================
48
+ // 2. INTERCEPTION PRÉ-BOOT (Masque le délai de chargement)
49
+ // ============================================
50
+ const args = process.argv.slice(2);
51
+ const command = args[0];
52
+
53
+ if (command === 'alex' || !command) {
54
+ // Se lance avant même que Node n'ait chargé le reste du fichier !
55
+ osSpinner.start("\x1b[32m⚡ Booting Fleetbo Engine...\x1b[0m");
56
+ }
57
+
58
+ const { spawn, execSync } = require('child_process');
59
+ const fs = require('fs');
60
+ const path = require('path');
61
+ const axios = require('axios');
62
+ const dotenv = require('dotenv');
63
+ const os = require('os');
64
+ const archiver = require('archiver');
65
+ const readline = require('readline');
66
+
67
+
43
68
  // ============================================
44
69
  // FLEETBO CLI - Centralized Package
45
70
  // ============================================
@@ -53,8 +78,6 @@ const CACHE_URL = "https://getmodulecache-jqycakhlxa-uc.a.run.app";
53
78
  const PORT = 3000;
54
79
 
55
80
  let uplinkProcess = null;
56
- const args = process.argv.slice(2);
57
- const command = args[0];
58
81
 
59
82
  // ============================================
60
83
  // CONFIGURATION (.env du projet dev)
@@ -536,8 +559,8 @@ if (command === 'alex') {
536
559
  console.log(`\n\x1b[31m⚠️ Error: Alex replied, but source code could not be extracted. Try the command again.\x1b[0m\n`);
537
560
  }
538
561
  } catch (error) {
539
- // 🛑 SÉCURITÉ : Arrête le spinner s'il y a un crash
540
- if (spinnerTimer) clearInterval(spinnerTimer);
562
+ // 🛑 SÉCURITÉ : Arrête le moteur global s'il y a un crash
563
+ osSpinner.stop();
541
564
 
542
565
  process.stdout.write('\r' + ' '.repeat(50) + '\r');
543
566
  console.error('\n\x1b[31m Alex Error:\x1b[0m ' + (error.response?.data?.message || error.message));
@@ -1027,10 +1050,9 @@ else {
1027
1050
  }
1028
1051
 
1029
1052
  async function runDevEnvironment() {
1053
+ osSpinner.stop(); // 🛑 Tue le spinner Pre-Boot avant le console.log
1030
1054
  console.log(`[Fleetbo] 🛡️ Initializing Dev Environment...`);
1031
-
1032
-
1033
-
1055
+
1034
1056
  killNetworkService();
1035
1057
  killProcessOnPort(PORT);
1036
1058
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbo-cockpit-cli",
3
- "version": "1.0.104",
3
+ "version": "1.0.106",
4
4
  "description": "Fleetbo CLI - Build native mobile apps with React",
5
5
  "author": "Fleetbo",
6
6
  "license": "MIT",