create-fleetbo-project 1.2.67 → 1.2.68

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.
@@ -29,7 +29,7 @@ const command = args[0];
29
29
  process.env.DOTENV_SILENT = 'true';
30
30
  const envPath = path.join(process.cwd(), '.env');
31
31
  if (!fs.existsSync(envPath)) {
32
- console.error('\\x1b[31m%s\\x1b[0m', ' Error: Configuration file (.env) not found.');
32
+ console.error('\\x1b[31m%s\\x1b[0m', ' Error: Configuration file (.env) not found.');
33
33
  process.exit(1);
34
34
  }
35
35
  dotenv.config({ path: envPath, quiet: true });
@@ -80,7 +80,7 @@ const checkGitSecurity = () => {
80
80
  }
81
81
  };
82
82
  if (!projectId) {
83
- console.error('\\n Error: Project ID missing in .env.\\n');
83
+ console.error('\\n Error: Project ID missing in .env.\\n');
84
84
  process.exit(1);
85
85
  }
86
86
  const injectRouteIntoAppJs = (pageName, subPath = '') => {
@@ -91,7 +91,7 @@ const injectRouteIntoAppJs = (pageName, subPath = '') => {
91
91
  if (!content.includes(alexRouteAnchor)) return false;
92
92
  // Chemin dynamique selon si c'est une page ou un mock
93
93
  const pathPrefix = subPath ? \`\${subPath}/\` : '';
94
- const importLine = \`import \${pageName} from './pages/\${pathPrefix}\${pageName}';\`;
94
+ const importLine = \`import \${pageName} from './app/\${pathPrefix}\${pageName}';\`;
95
95
  const routeLine = \`<Route path="/\${pathPrefix.toLowerCase()}\${pageName.toLowerCase()}" element={<\${pageName} />} />\`;
96
96
  let injected = false;
97
97
  if (!content.includes(importLine)) {
@@ -150,7 +150,7 @@ if (command === 'alex') {
150
150
  }
151
151
  if (aiData.status === 'success' && aiData.moduleData) {
152
152
  const { fileName, code, mockFileName, mockCode, moduleName, instructions } = aiData.moduleData;
153
- console.log(\` \\x1b[90m⚙️ Architecting: \${moduleName}\x1b[0m\`);
153
+ console.log(\` \\x1b[90m Architecting: \${moduleName}\x1b[0m\`);
154
154
  const writeFile = (dir, name, content) => {
155
155
  const fullPath = path.join(process.cwd(), dir);
156
156
  const filePath = path.join(fullPath, name);
@@ -168,13 +168,13 @@ if (command === 'alex') {
168
168
  });
169
169
  }
170
170
  if (code && fileName) {
171
- const folder = fileName.endsWith('.kt') ? 'public/native/android/' : 'src/pages/';
171
+ const folder = fileName.endsWith('.kt') ? 'public/native/android/' : 'src/app/';
172
172
  writeFile(folder, fileName, code);
173
173
  if (fileName.endsWith('.jsx')) injectRouteIntoAppJs(fileName.replace('.jsx', ''));
174
174
  }
175
175
  if (mockCode && mockFileName) {
176
176
  const pageName = mockFileName.replace('.jsx', '');
177
- writeFile('src/pages/mocks/', mockFileName, mockCode);
177
+ writeFile('src/app/mocks/', mockFileName, mockCode);
178
178
  const injected = injectRouteIntoAppJs(pageName, 'mocks');
179
179
  if (injected) {
180
180
  console.log(\` \\x1b[32m[Routed]\x1b[0m App.js -> /mocks/\${pageName.toLowerCase()}\`);
@@ -224,7 +224,7 @@ if (command === 'alex') {
224
224
  rl.prompt();
225
225
  rl.on('line', async (line) => {
226
226
  if (['exit', 'quit'].includes(line.trim().toLowerCase())) {
227
- console.log('\\n\\x1b[90m👋 Alex session closed.\\x1b[0m');
227
+ console.log('\\n\\x1b[90m Alex session closed.\\x1b[0m');
228
228
  rl.close();
229
229
  return;
230
230
  }
@@ -339,7 +339,7 @@ async function syncFirebase(keyApp, networkUrl, testerEmail) {
339
339
  console.log('\\x1b[32m[Fleetbo] You can now start coding and previewing in Studio. 🚀\\x1b[0m');
340
340
  console.log(\`\\x1b[32m[Fleetbo]\\x1b[0m -------------------------------------------------------------\`);
341
341
  } catch (err) {
342
- console.error(\`[Fleetbo] Sync Error: \${err.message}\`);
342
+ console.error(\`[Fleetbo] Sync Error: \${err.message}\`);
343
343
  }
344
344
  }
345
345
  async function runDevEnvironment() {
@@ -386,7 +386,7 @@ const emailArg = args.find(arg => arg.startsWith('--email='));
386
386
  const bootstrapTokenArg = tokenArg ? tokenArg.split('=')[1] : null;
387
387
  const userEmailArg = emailArg ? emailArg.split('=')[1] : null;
388
388
  if (!projectNameArg || !bootstrapTokenArg || !userEmailArg) {
389
- console.error('\n Usage: npx create-fleetbo-project <name> --token=<token> --email=<email>');
389
+ console.error('\n Usage: npx create-fleetbo-project <name> --token=<token> --email=<email>');
390
390
  process.exit(1);
391
391
  }
392
392
  const projectName = projectNameArg;
@@ -437,17 +437,17 @@ function downloadEngine(url, dest) {
437
437
  });
438
438
  }
439
439
  async function setupProject() {
440
- console.log(`\n⚡ Initializing Fleetbo Framework for "${projectName}"...`);
440
+ console.log(`\n ⚡Initializing Fleetbo Framework for "${projectName}"...`);
441
441
 
442
442
  try {
443
443
  if (fs.existsSync(projectDir)) throw new Error(`Directory "${projectName}" already exists.`);
444
444
  fs.mkdirSync(projectDir);
445
445
 
446
- console.log(' [1/7] Downloading Fleetbo Core Engine...');
446
+ console.log(' [1/7] Downloading Fleetbo Core Engine...');
447
447
  const archivePath = path.join(projectDir, 'engine.tar.gz');
448
448
  await downloadEngine(archiveUrl, archivePath);
449
449
 
450
- console.log(' [2/7] Scaffolding project structure...');
450
+ console.log(' [2/7] Scaffolding project structure...');
451
451
  try {
452
452
  execSync(`tar -xf "${archivePath}" -C "${projectDir}" --strip-components=1`, { stdio: 'ignore' });
453
453
  fs.unlinkSync(archivePath);
@@ -455,11 +455,11 @@ async function setupProject() {
455
455
 
456
456
  process.chdir(projectDir);
457
457
 
458
- console.log(' [3/7] Authenticating with Fleetbo Cloud...');
458
+ console.log(' [3/7] Authenticating with Fleetbo Cloud...');
459
459
  const keys = await fetchProjectKeys(bootstrapTokenArg);
460
460
  if (!keys.enterpriseId) throw new Error("Invalid keys.");
461
461
 
462
- console.log(' [4/7] Configuring environment & CLI...');
462
+ console.log(' [4/7] Configuring environment & CLI...');
463
463
  const envContent = `REACT_APP_FLEETBO_DB_KEY=${keys.fleetboDBKey}
464
464
  REACT_APP_ENTERPRISE_ID=${keys.enterpriseId}
465
465
  REACT_KEY_APP=${projectName}
@@ -468,17 +468,17 @@ async function setupProject() {
468
468
  WDS_SOCKET_PORT=0`;
469
469
 
470
470
  fs.writeFileSync(path.join(projectDir, '.env'), envContent, 'utf8');
471
- console.log(' [5/7] Securing environment (adding .gitignore)...');
471
+ console.log(' [5/7] Securing environment (adding .gitignore)...');
472
472
  const gitignoreContent = `# Fleetbo Security\n.env\n.env.local\nnode_modules/\ndist/\nbuild/\n.DS_Store\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n`;
473
473
  fs.writeFileSync(path.join(projectDir, '.gitignore'), gitignoreContent, 'utf8');
474
474
  const scriptsDir = path.join(projectDir, 'scripts');
475
475
  if (!fs.existsSync(scriptsDir)) fs.mkdirSync(scriptsDir, { recursive: true });
476
476
  fs.writeFileSync(path.join(scriptsDir, 'cli.js'), CLI_SCRIPT_CONTENT, 'utf8');
477
477
  try { fs.chmodSync(path.join(scriptsDir, 'cli.js'), '755'); } catch (e) {}
478
- console.log(' [6/7] Installing dependencies...');
478
+ console.log(' [6/7] Installing dependencies...');
479
479
  execSync('npm install', { stdio: 'inherit' });
480
480
  execSync('npm install cloudflared dotenv axios archiver --save-dev', { stdio: 'ignore' });
481
- console.log(' [7/7] Finalizing setup...');
481
+ console.log(' [7/7] Finalizing setup...');
482
482
  const packageJsonPath = path.join(projectDir, 'package.json');
483
483
  const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
484
484
  packageJson.name = projectName;
@@ -489,7 +489,7 @@ async function setupProject() {
489
489
  console.log('\n \x1b[32m [Fleetbo] To start architecting with Alex, run: npm run fleetbo alex!\x1b[0m');
490
490
  console.log('');
491
491
  } catch (error) {
492
- console.error('\n Setup failed:', error.message);
492
+ console.error('\n Setup failed:', error.message);
493
493
  if (fs.existsSync(projectDir)) try { fs.rmSync(projectDir, { recursive: true, force: true }); } catch(e){}
494
494
  process.exit(1);
495
495
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fleetbo-project",
3
- "version": "1.2.67",
3
+ "version": "1.2.68",
4
4
  "description": "Creates a new Fleetbo project.",
5
5
  "main": "install-react-template.js",
6
6
  "bin": {