create-fleetbo-project 1.2.20 → 1.2.22
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/install-react-template.js +10 -6
- package/package.json +1 -1
|
@@ -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
|
|
15
|
+
// --- LE CONTENU DU GARDIEN (CLI.JS) ---
|
|
16
16
|
const CLI_SCRIPT_CONTENT = `#!/usr/bin/env node
|
|
17
17
|
|
|
18
18
|
const { spawn, execSync } = require('child_process');
|
|
@@ -30,7 +30,9 @@ function killProcessOnPort(port) {
|
|
|
30
30
|
try {
|
|
31
31
|
if (process.platform !== 'win32') {
|
|
32
32
|
const pid = execSync(\`lsof -ti:\${port} 2>/dev/null\`).toString().trim();
|
|
33
|
-
if (pid)
|
|
33
|
+
if (pid) {
|
|
34
|
+
execSync(\`kill -9 \${pid.split('\\n').join(' ')} 2>/dev/null\`);
|
|
35
|
+
}
|
|
34
36
|
}
|
|
35
37
|
} catch (e) {}
|
|
36
38
|
}
|
|
@@ -58,7 +60,7 @@ async function syncFirebase(keyApp, networkUrl) {
|
|
|
58
60
|
await axios.post(UPDATE_NETWORK_URL, { keyApp, networkUrl });
|
|
59
61
|
console.log('\\n[Fleetbo] ---------------------------------------------------');
|
|
60
62
|
console.log(\`[Fleetbo] ✅ Tunnel Active: \${networkUrl}\`);
|
|
61
|
-
console.log(\`[Fleetbo] 🚀
|
|
63
|
+
console.log(\`[Fleetbo] 🚀 Simulator: https://fleetbo.io/studio/view/\${keyApp}\`);
|
|
62
64
|
console.log('[Fleetbo] ---------------------------------------------------\\n');
|
|
63
65
|
} catch (err) {
|
|
64
66
|
console.error(\`[Fleetbo] ⚠️ Sync Error: \${err.message}\`);
|
|
@@ -101,14 +103,17 @@ async function runGuardian() {
|
|
|
101
103
|
tunnelStarted = true;
|
|
102
104
|
console.log(\`\\n[Fleetbo] 🔗 React is ready. Establishing secure tunnel...\`);
|
|
103
105
|
|
|
104
|
-
// 3. DÉMARRAGE TUNNEL CLOUDFLARE (via npm exec
|
|
106
|
+
// 3. DÉMARRAGE TUNNEL CLOUDFLARE (via npm exec)
|
|
105
107
|
const npxCmd = process.platform === 'win32' ? 'npx.cmd' : 'npx';
|
|
106
108
|
const tunnel = spawn(npxCmd, ['cloudflared', 'tunnel', '--url', \`http://localhost:\${PORT}\`]);
|
|
107
109
|
|
|
108
|
-
// Capture de l'URL dans les logs
|
|
110
|
+
// Capture de l'URL dans les logs stderr
|
|
109
111
|
tunnel.stderr.on('data', (chunk) => {
|
|
110
112
|
const log = chunk.toString();
|
|
113
|
+
|
|
114
|
+
// --- REGEX VALIDÉE ---
|
|
111
115
|
const match = log.match(/https:\/\/[a-zA-Z0-9-]+\.trycloudflare\.com/);
|
|
116
|
+
|
|
112
117
|
if (match) {
|
|
113
118
|
const url = match[0];
|
|
114
119
|
if (global.currentUrl !== url) {
|
|
@@ -214,7 +219,6 @@ async function setupProject() {
|
|
|
214
219
|
if (!keys.enterpriseId) throw new Error("Invalid keys.");
|
|
215
220
|
|
|
216
221
|
console.log(' [4/6] ⚙️ Configuring environment & CLI...');
|
|
217
|
-
// On force le host check pour la compatibilité tunnel
|
|
218
222
|
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
223
|
|
|
220
224
|
fs.writeFileSync(path.join(projectDir, '.env'), envContent, 'utf8');
|