create-fleetbo-project 1.2.81 → 1.2.83

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.
@@ -85,28 +85,36 @@ if (!projectId) {
85
85
  console.error('\\n Error: Project ID missing in .env.\\n');
86
86
  process.exit(1);
87
87
  }
88
- const injectRouteIntoAppJs = (pageName, subPath = '') => {
89
- if (!fs.existsSync(APP_JS_PATH)) return false;
90
- let content = fs.readFileSync(APP_JS_PATH, 'utf8');
88
+ const injectRouteIntoAppJs = (moduleName, subPath = '') => {
89
+ const appJsPath = path.join(process.cwd(), 'src', 'App.js');
90
+ if (!fs.existsSync(appJsPath)) {
91
+ console.error(\` \\x1b[31m[Safety Stop]\\x1b[0m App.js missing.\`);
92
+ return false;
93
+ }
94
+ let content = fs.readFileSync(appJsPath, 'utf8');
91
95
  const importAnchor = '// FLEETBO_MORE_IMPORTS';
92
- const alexRouteAnchor = '{/* FLEETBO_DYNAMIC ROUTES */}';
93
- if (!content.includes(alexRouteAnchor)) return false;
94
- // Chemin dynamique selon si c'est une page ou un mock
95
- const pathPrefix = subPath ? \`\${subPath}/\` : '';
96
- const importLine = \`import \${pageName} from './app/\${pathPrefix}\${pageName}';\`;
97
- const routeLine = \`<Route path="/\${pathPrefix.toLowerCase()}\${pageName.toLowerCase()}" element={<\${pageName} />} />\`;
98
- let injected = false;
96
+ const routeAnchor = '{/* FLEETBO_DYNAMIC ROUTES */}';
97
+ if (!content.includes(importAnchor) || !content.includes(routeAnchor)) {
98
+ console.log(\` \\x1b[33m[Skipped]\\x1b[0m Anchors missing in App.js.\`);
99
+ return false;
100
+ }
101
+ const cleanSubPath = subPath ? \`\${subPath}/\` : '';
102
+ const importLine = \`import \${moduleName} from './app/\${cleanSubPath}\${moduleName}';\`;
103
+ const routeLine = \`<Route path="/\${cleanSubPath}\${moduleName.toLowerCase()}" element={<\${moduleName} />} />\`;
104
+ let modified = false;
99
105
  if (!content.includes(importLine)) {
100
106
  content = content.replace(importAnchor, \`\${importLine}\\n\${importAnchor}\`);
101
- injected = true;
107
+ modified = true;
102
108
  }
103
109
  if (!content.includes(routeLine)) {
104
- // Injection précise dans l'ancre Alex
105
- content = content.replace(alexRouteAnchor, \`\${routeLine}\\n \${alexRouteAnchor}\`);
106
- injected = true;
110
+ content = content.replace(routeAnchor, \`\${routeLine}\\n \${routeAnchor}\`);
111
+ modified = true;
112
+ }
113
+ if (modified) {
114
+ fs.writeFileSync(appJsPath, content);
115
+ console.log(\` \\x1b[32m[Routed]\\x1b[0m \${moduleName} injected into App.js safely.\`);
107
116
  }
108
- if (injected) fs.writeFileSync(APP_JS_PATH, content);
109
- return injected;
117
+ return modified;
110
118
  };
111
119
  const showEnergyTransfer = async () => {
112
120
  const width = 30;
@@ -282,7 +290,6 @@ if (command === 'android' || command === 'ios') {
282
290
  }
283
291
  const targetUrl = platform === 'android' ? ANDROID_BUILD_URL : IOS_BUILD_URL;
284
292
  (async () => {
285
- // Utilisation de \\n et \\x1b pour que le texte reste intact dans cli.js
286
293
  console.log(\`\\n\\x1b[36m⚡ FLEETBO \${platform.toUpperCase()} UPLINK\\x1b[0m\`);
287
294
  try {
288
295
  execSync('npm run build', { stdio: 'inherit' });
@@ -328,7 +335,6 @@ function killProcessOnPort(port) {
328
335
  } catch (e) {}
329
336
  }
330
337
  const killNetworkService = () => {
331
- // On tue UNIQUEMENT le processus enfant que nous avons lancé
332
338
  if (uplinkProcess) {
333
339
  try {
334
340
  uplinkProcess.kill('SIGINT'); // On demande poliment de s'arrêter
@@ -361,9 +367,10 @@ async function syncFirebase(keyApp, networkUrl, testerEmail) {
361
367
  try {
362
368
  await axios.post(UPDATE_NETWORK_URL, { keyApp, networkUrl, tester: testerEmail });
363
369
  console.log(\`\\n\\x1b[32m[Fleetbo]\\x1b[0m -------------------------------------------------------------\`);
364
- console.log('\\x1b[32m[Fleetbo] GO GO GO ! FLEETBO STUDIO IS READY \\x1b[0m');
365
- console.log('\\x1b[32m[Fleetbo] You can now start coding and previewing in Studio. 🚀\\x1b[0m');
370
+ console.log('\\x1b[32m[Fleetbo] GO GO GO ! FLEETBO COCKPIT IS READY \\x1b[0m');
371
+ console.log('\\x1b[32m[Fleetbo] You can now start coding and previewing in Cockpit. 🚀\\x1b[0m');
366
372
  console.log(\`\\x1b[32m[Fleetbo]\\x1b[0m -------------------------------------------------------------\`);
373
+ console.log('\\x1b[34m[Pilot Instruction] ❯ \\x1b[0m Switch to your Fleetbo Cockpit tab to begin. \\x1b[0m');
367
374
  } catch (err) {
368
375
  console.error(\`[Fleetbo] Sync Error: \${err.message}\`);
369
376
  }
@@ -536,7 +543,7 @@ async function setupProject() {
536
543
  packageJson.scripts = { ...packageJson.scripts, "fleetbo": "node scripts/cli.js", "dev": "node scripts/cli.js" };
537
544
  fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2), 'utf8');
538
545
  console.log('\n \x1b[32m [Fleetbo] Project successfully created!\x1b[0m');
539
- console.log(`\n Run: cd ${projectName}`);
546
+ console.log(`\n Run: cd ${projectName} && npm run fleetbo`);
540
547
  console.log('\n \x1b[32m [Fleetbo] To start architecting with Alex, run: npm run fleetbo alex!\x1b[0m');
541
548
  console.log('');
542
549
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fleetbo-project",
3
- "version": "1.2.81",
3
+ "version": "1.2.83",
4
4
  "description": "Creates a new Fleetbo project.",
5
5
  "main": "install-react-template.js",
6
6
  "bin": {