create-fleetbo-project 1.2.54 → 1.2.56

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.
@@ -63,7 +63,6 @@ const injectRouteIntoAppJs = (pageName, subPath = '') => {
63
63
  // Chemin dynamique selon si c'est une page ou un mock
64
64
  const pathPrefix = subPath ? \`\${subPath}/\` : '';
65
65
  const importLine = \`import \${pageName} from './pages/\${pathPrefix}\${pageName}';\`;
66
- // CORRECTION ICI : Syntax React Router valide element={<PageName />}
67
66
  const routeLine = \`<Route path="/\${pathPrefix.toLowerCase()}\${pageName.toLowerCase()}" element={<\${pageName} />} />\`;
68
67
  let injected = false;
69
68
  if (!content.includes(importLine)) {
@@ -117,7 +116,6 @@ if (command === 'alex') {
117
116
  if (aiData.status === 'success' || aiData.status === 'message') {
118
117
  console.log('');
119
118
  console.log(\`\\x1b[32mAlex ❯\\x1b[0m \${aiData.message || "I'm ready."}\`);
120
-
121
119
  if (aiData.remainingTokens !== undefined) {
122
120
  const remaining = aiData.remainingTokens;
123
121
  const limit = aiData.limit; // Récupération dynamique de la limite
@@ -127,25 +125,40 @@ if (command === 'alex') {
127
125
  console.log(\`\\x1b[36m Energy:\\x1b[0m \${energyColor}\${percent}%\\x1b[0m (\${remaining}/\${limit} tokens left)\`);
128
126
  }
129
127
  }
130
-
131
128
  if (aiData.status === 'success' && aiData.moduleData) {
132
- const { fileName, code, mockFileName, mockCode, moduleName } = aiData.moduleData;
133
- console.log(\` \\x1b[90m⚙️ Architecting: \${moduleName}\\x1b[0m\`);
129
+ // 1. AJOUT de 'instructions' ici pour éviter l'erreur de variable indéfinie
130
+ const { fileName, code, mockFileName, mockCode, moduleName, instructions } = aiData.moduleData;
131
+ console.log(\` \\x1b[90m⚙️ Architecting: \${moduleName}\x1b[0m\`);
134
132
  const writeFile = (dir, name, content) => {
135
- const fullPath = path.join(process.cwd(), dir);
136
- const filePath = path.join(fullPath, name);
137
- if (!fs.existsSync(fullPath)) fs.mkdirSync(fullPath, { recursive: true });
133
+ const fullPath = path.join(process.cwd(), dir);
134
+ const filePath = path.join(fullPath, name);
135
+ if (!fs.existsSync(fullPath)) fs.mkdirSync(fullPath, { recursive: true });
138
136
  fs.writeFileSync(filePath, content);
139
- console.log(\` \\x1b[32m[Written]\\x1b[0m \${dir}\${name}\`);
137
+ console.log(\` \x1b[32m[Written]\x1b[0m \${dir}\${name}\`);
140
138
  };
139
+ if (instructions && Array.isArray(instructions) && instructions.length > 0) {
140
+ console.log('\n\x1b[33m--- GUIDE DE PILOTAGE (MCI) ---\x1b[0m');
141
+ instructions.forEach(line => {
142
+ if (typeof line === 'string') {
143
+ const formattedLine = line.replace(/ACTION|CAPTURE|PERSPECTIVE/g, '\x1b[1m$&\x1b[0m');
144
+ console.log(\` \${formattedLine}\`);
145
+ }
146
+ });
147
+ console.log('\x1b[33m-------------------------------\x1b[0m');
148
+ }
141
149
  if (code && fileName) {
142
150
  const folder = fileName.endsWith('.kt') ? 'public/native/android/' : 'src/pages/';
143
151
  writeFile(folder, fileName, code);
144
152
  if (fileName.endsWith('.jsx')) injectRouteIntoAppJs(fileName.replace('.jsx', ''));
145
153
  }
146
154
  if (mockCode && mockFileName) {
155
+ const pageName = mockFileName.replace('.jsx', '');
147
156
  writeFile('src/pages/mocks/', mockFileName, mockCode);
148
157
  writeFile('src/pages/mocks/', 'Quick.jsx', mockCode);
158
+ const injected = injectRouteIntoAppJs(pageName, 'mocks');
159
+ if (injected) {
160
+ console.log(\` \\x1b[32m[Routed]\x1b[0m App.js -> /mocks/\${pageName.toLowerCase()}\`);
161
+ }
149
162
  }
150
163
  }
151
164
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fleetbo-project",
3
- "version": "1.2.54",
3
+ "version": "1.2.56",
4
4
  "description": "Creates a new Fleetbo project.",
5
5
  "main": "install-react-template.js",
6
6
  "bin": {