fleetbo-cockpit-cli 1.0.104 → 1.0.105

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 -22
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -5,41 +5,67 @@
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 (Zéro dépendance)
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 = ""; // Garde le texte en mémoire
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; // Met à jour le texte
20
+
21
+ if (this.timer) {
22
+ // Si déjà lancé, on affiche tout de suite le nouveau texte
23
+ process.stdout.write(`\r\x1b[2K \x1b[32m${this.frames[this.idx]}\x1b[0m ${this.currentMessage}`);
24
+ return;
25
+ }
26
+
27
+ process.stdout.write('\x1b[?25l'); // 🔴 CACHE LE CURSEUR XTERM INSTANTANÉMENT
28
+
29
+ // ⚡ DESSIN SYNCHRONE IMMÉDIAT (Avant que Node ne freeze pour charger axios)
30
+ process.stdout.write(`\r\x1b[2K \x1b[32m${this.frames[this.idx]}\x1b[0m ${this.currentMessage}`);
31
+ this.idx = (this.idx + 1) % this.frames.length;
32
+
29
33
  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}`);
34
+ process.stdout.write(`\r\x1b[2K \x1b[32m${this.frames[this.idx]}\x1b[0m ${this.currentMessage}`);
32
35
  this.idx = (this.idx + 1) % this.frames.length;
33
36
  }, 80);
34
37
  }
35
38
  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
39
+ if (this.timer) {
40
+ clearInterval(this.timer);
41
+ this.timer = null;
42
+ }
43
+ process.stdout.write('\x1b[?25h\r\x1b[2K'); // Réaffiche le curseur
39
44
  }
40
45
  }
41
46
  const osSpinner = new FleetboSpinner();
42
47
 
48
+ // ============================================
49
+ // 2. INTERCEPTION PRÉ-BOOT (Masque le délai de chargement)
50
+ // ============================================
51
+ const args = process.argv.slice(2);
52
+ const command = args[0];
53
+
54
+ if (command === 'alex' || !command) {
55
+ // Se lance avant même que Node n'ait chargé le reste du fichier !
56
+ osSpinner.start("\x1b[32m⚡ Booting Fleetbo Engine...\x1b[0m");
57
+ }
58
+
59
+ const { spawn, execSync } = require('child_process');
60
+ const fs = require('fs');
61
+ const path = require('path');
62
+ const axios = require('axios');
63
+ const dotenv = require('dotenv');
64
+ const os = require('os');
65
+ const archiver = require('archiver');
66
+ const readline = require('readline');
67
+
68
+
43
69
  // ============================================
44
70
  // FLEETBO CLI - Centralized Package
45
71
  // ============================================
@@ -53,8 +79,6 @@ const CACHE_URL = "https://getmodulecache-jqycakhlxa-uc.a.run.app";
53
79
  const PORT = 3000;
54
80
 
55
81
  let uplinkProcess = null;
56
- const args = process.argv.slice(2);
57
- const command = args[0];
58
82
 
59
83
  // ============================================
60
84
  // CONFIGURATION (.env du projet dev)
@@ -536,9 +560,9 @@ if (command === 'alex') {
536
560
  console.log(`\n\x1b[31m⚠️ Error: Alex replied, but source code could not be extracted. Try the command again.\x1b[0m\n`);
537
561
  }
538
562
  } catch (error) {
539
- // 🛑 SÉCURITÉ : Arrête le spinner s'il y a un crash
540
- if (spinnerTimer) clearInterval(spinnerTimer);
541
-
563
+ // 🛑 SÉCURITÉ : Arrête le moteur global s'il y a un crash
564
+ osSpinner.stop();
565
+
542
566
  process.stdout.write('\r' + ' '.repeat(50) + '\r');
543
567
  console.error('\n\x1b[31m Alex Error:\x1b[0m ' + (error.response?.data?.message || error.message));
544
568
  }
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.105",
4
4
  "description": "Fleetbo CLI - Build native mobile apps with React",
5
5
  "author": "Fleetbo",
6
6
  "license": "MIT",