create-fleetbo-project 1.2.20 → 1.2.21

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.
@@ -12,7 +12,7 @@ const branchName = 'master';
12
12
  const archiveUrl = `https://github.com/${repoOwner}/${repoName}/archive/refs/heads/${branchName}.tar.gz`;
13
13
  const bootstrapUrl = 'https://us-central1-myapp-259bf.cloudfunctions.net/bootstrapProject';
14
14
 
15
- // --- LE GARDIEN CLOUDFLARE (Version Production Silencieuse) ---
15
+ // --- LE GARDIEN RÉSEAU (Version "White Label") ---
16
16
  const CLI_SCRIPT_CONTENT = `#!/usr/bin/env node
17
17
 
18
18
  const { spawn, execSync } = require('child_process');
@@ -25,7 +25,7 @@ const os = require('os');
25
25
  const UPDATE_NETWORK_URL = 'https://us-central1-myapp-259bf.cloudfunctions.net/updateDeveloperNetwork';
26
26
  const PORT = 3000;
27
27
 
28
- // Nettoyage des ports (Mac/Linux)
28
+ // Gestion des processus (Mac/Linux)
29
29
  function killProcessOnPort(port) {
30
30
  try {
31
31
  if (process.platform !== 'win32') {
@@ -35,8 +35,8 @@ function killProcessOnPort(port) {
35
35
  } catch (e) {}
36
36
  }
37
37
 
38
- // Nettoyage spécifique Cloudflare
39
- function killCloudflared() {
38
+ // Gestion du connecteur réseau
39
+ function killNetworkConnector() {
40
40
  try {
41
41
  const cmd = process.platform === 'win32' ? 'taskkill /IM cloudflared.exe /F' : 'pkill cloudflared';
42
42
  execSync(cmd + ' 2>/dev/null');
@@ -45,7 +45,7 @@ function killCloudflared() {
45
45
 
46
46
  async function cleanupAndExit(code = 0) {
47
47
  console.log('\\n[Fleetbo] 🛑 Stopping services...');
48
- killCloudflared();
48
+ killNetworkConnector();
49
49
  killProcessOnPort(PORT);
50
50
  process.exit(code);
51
51
  }
@@ -57,8 +57,8 @@ async function syncFirebase(keyApp, networkUrl) {
57
57
  try {
58
58
  await axios.post(UPDATE_NETWORK_URL, { keyApp, networkUrl });
59
59
  console.log('\\n[Fleetbo] ---------------------------------------------------');
60
- console.log(\`[Fleetbo] ✅ Tunnel Active: \${networkUrl}\`);
61
- console.log(\`[Fleetbo] 🚀 Emulator: https://fleetbo.io/studio/view/\${keyApp}\`);
60
+ console.log(\`[Fleetbo] ✅ Network Ready: Active\`);
61
+ console.log(\`[Fleetbo] 🚀 Simulator: https://fleetbo.io/studio/view/\${keyApp}\`);
62
62
  console.log('[Fleetbo] ---------------------------------------------------\\n');
63
63
  } catch (err) {
64
64
  console.error(\`[Fleetbo] ⚠️ Sync Error: \${err.message}\`);
@@ -68,8 +68,8 @@ async function syncFirebase(keyApp, networkUrl) {
68
68
  async function runGuardian() {
69
69
  console.log(\`[Fleetbo] 🛡️ Starting Fleetbo Guardian on \${os.platform()}...\`);
70
70
 
71
- // 1. NETTOYAGE PRÉVENTIF
72
- killCloudflared();
71
+ // 1. PRÉPARATION ENVIRONNEMENT
72
+ killNetworkConnector();
73
73
  killProcessOnPort(PORT);
74
74
 
75
75
  const envPath = path.join(process.cwd(), '.env');
@@ -92,21 +92,21 @@ async function runGuardian() {
92
92
  devServer.stdout.pipe(process.stdout);
93
93
  devServer.stderr.pipe(process.stderr);
94
94
 
95
- let tunnelStarted = false;
95
+ let connectionStarted = false;
96
96
 
97
97
  devServer.stdout.on('data', (data) => {
98
98
  const output = data.toString();
99
99
 
100
- if (!tunnelStarted && (output.includes('Local:') || output.includes('Compiled successfully'))) {
101
- tunnelStarted = true;
102
- console.log(\`\\n[Fleetbo] 🔗 React is ready. Establishing secure tunnel...\`);
100
+ if (!connectionStarted && (output.includes('Local:') || output.includes('Compiled successfully'))) {
101
+ connectionStarted = true;
102
+ console.log(\`\\n[Fleetbo] 🔗 React is ready. Establishing Secure Link...\`);
103
103
 
104
- // 3. DÉMARRAGE TUNNEL CLOUDFLARE (via npm exec pour la compatibilité)
104
+ // 3. DÉMARRAGE LINK SÉCURISÉ
105
105
  const npxCmd = process.platform === 'win32' ? 'npx.cmd' : 'npx';
106
- const tunnel = spawn(npxCmd, ['cloudflared', 'tunnel', '--url', \`http://localhost:\${PORT}\`]);
106
+ const connector = spawn(npxCmd, ['cloudflared', 'tunnel', '--url', \`http://localhost:\${PORT}\`]);
107
107
 
108
- // Capture de l'URL dans les logs
109
- tunnel.stderr.on('data', (chunk) => {
108
+ // Capture de l'URL (Silencieux)
109
+ connector.stderr.on('data', (chunk) => {
110
110
  const log = chunk.toString();
111
111
  const match = log.match(/https:\/\/[a-zA-Z0-9-]+\.trycloudflare\.com/);
112
112
  if (match) {
@@ -118,8 +118,8 @@ async function runGuardian() {
118
118
  }
119
119
  });
120
120
 
121
- tunnel.on('error', (err) => {
122
- console.error("[Fleetbo] ❌ Tunnel Error. Ensure 'cloudflared' is installed.");
121
+ connector.on('error', (err) => {
122
+ console.error("[Fleetbo] ❌ Connection Error. Essential network components missing.");
123
123
  });
124
124
  }
125
125
  });
@@ -214,7 +214,7 @@ async function setupProject() {
214
214
  if (!keys.enterpriseId) throw new Error("Invalid keys.");
215
215
 
216
216
  console.log(' [4/6] ⚙️ Configuring environment & CLI...');
217
- // On force le host check pour la compatibilité tunnel
217
+ // On force le host check pour la compatibilité réseau
218
218
  const envContent = `REACT_APP_FLEETBO_DB_KEY=${keys.fleetboDBKey}\nREACT_APP_ENTERPRISE_ID=${keys.enterpriseId}\nREACT_KEY_APP=${projectName}\nDANGEROUSLY_DISABLE_HOST_CHECK=true\n`;
219
219
 
220
220
  fs.writeFileSync(path.join(projectDir, '.env'), envContent, 'utf8');
@@ -223,7 +223,7 @@ async function setupProject() {
223
223
  console.log(' [5/6] 📚 Installing dependencies...');
224
224
  execSync('npm install', { stdio: 'inherit' });
225
225
 
226
- // Installation de cloudflared
226
+ // Installation des connecteurs réseaux (silencieux)
227
227
  execSync('npm install cloudflared dotenv axios --save-dev', { stdio: 'ignore' });
228
228
 
229
229
  console.log(' [6/6] ✨ Finalizing setup...');
@@ -246,8 +246,7 @@ async function setupProject() {
246
246
  setupProject();
247
247
 
248
248
 
249
- {/*
250
-
249
+ {/*
251
250
  const { execSync } = require('child_process');
252
251
  const fs = require('fs');
253
252
  const path = require('path');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fleetbo-project",
3
- "version": "1.2.20",
3
+ "version": "1.2.21",
4
4
  "description": "Creates a new Fleetbo project.",
5
5
  "main": "install-react-template.js",
6
6
  "bin": {