create-fleetbo-project 1.2.56 → 1.2.58
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 +40 -25
- package/package.json +1 -1
|
@@ -18,7 +18,8 @@ const dotenv = require('dotenv');
|
|
|
18
18
|
const os = require('os');
|
|
19
19
|
const archiver = require('archiver');
|
|
20
20
|
const readline = require('readline');
|
|
21
|
-
const
|
|
21
|
+
const ANDROID_BUILD_URL = "https://us-central1-myapp-259bf.cloudfunctions.net/FandroidBuild";
|
|
22
|
+
const IOS_BUILD_URL = "https://us-central1-myapp-259bf.cloudfunctions.net/FiosBuild";
|
|
22
23
|
const UPDATE_NETWORK_URL = 'https://us-central1-myapp-259bf.cloudfunctions.net/updateDeveloperNetwork';
|
|
23
24
|
const ALEX_ENGINE_URL = "https://us-central1-myapp-259bf.cloudfunctions.net/generateNativeModule";
|
|
24
25
|
const APP_JS_PATH = path.join(process.cwd(), 'src/App.js');
|
|
@@ -101,32 +102,19 @@ if (command === 'alex') {
|
|
|
101
102
|
console.log(\`\\n\\x1b[31m⛔ ENGINE OUT OF FUEL:\\x1b[0m \${aiData.message}\`);
|
|
102
103
|
return;
|
|
103
104
|
}
|
|
104
|
-
if (aiData.status === 'success' || aiData.status === 'message') {
|
|
105
|
-
console.log('');
|
|
106
|
-
console.log(\`\\x1b[32mAlex ❯\\x1b[0m \${aiData.message || "I'm ready."}\`);
|
|
107
|
-
if (aiData.remainingTokens !== undefined) {
|
|
108
|
-
const remaining = aiData.remainingTokens;
|
|
109
|
-
const limit = aiData.limit || 2500;
|
|
110
|
-
const percent = Math.round((remaining / limit) * 100);
|
|
111
|
-
const energyColor = percent > 30 ? '\\x1b[32m' : '\\x1b[31m';
|
|
112
|
-
console.log(\`\\x1b[36m Energy:\\x1b[0m \${energyColor}\${percent}%\\x1b[0m (\${remaining}/\${limit} tokens left)\`);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
105
|
if (aiData.status === 'success' || aiData.status === 'message') {
|
|
117
106
|
console.log('');
|
|
118
107
|
console.log(\`\\x1b[32mAlex ❯\\x1b[0m \${aiData.message || "I'm ready."}\`);
|
|
119
108
|
if (aiData.remainingTokens !== undefined) {
|
|
120
109
|
const remaining = aiData.remainingTokens;
|
|
121
|
-
const limit = aiData.limit
|
|
110
|
+
const limit = aiData.limit || 2500;
|
|
122
111
|
const tierLabel = aiData.tier === 'senior' ? 'SENIOR' : 'STARTER';
|
|
123
112
|
const percent = Math.round((remaining / limit) * 100);
|
|
124
|
-
const energyColor = percent > 20 ? '
|
|
113
|
+
const energyColor = percent > 20 ? '\\x1b[32m' : '\\x1b[31m';
|
|
125
114
|
console.log(\`\\x1b[36m Energy:\\x1b[0m \${energyColor}\${percent}%\\x1b[0m (\${remaining}/\${limit} tokens left)\`);
|
|
126
115
|
}
|
|
127
116
|
}
|
|
128
117
|
if (aiData.status === 'success' && aiData.moduleData) {
|
|
129
|
-
// 1. AJOUT de 'instructions' ici pour éviter l'erreur de variable indéfinie
|
|
130
118
|
const { fileName, code, mockFileName, mockCode, moduleName, instructions } = aiData.moduleData;
|
|
131
119
|
console.log(\` \\x1b[90m⚙️ Architecting: \${moduleName}\x1b[0m\`);
|
|
132
120
|
const writeFile = (dir, name, content) => {
|
|
@@ -137,14 +125,13 @@ if (command === 'alex') {
|
|
|
137
125
|
console.log(\` \x1b[32m[Written]\x1b[0m \${dir}\${name}\`);
|
|
138
126
|
};
|
|
139
127
|
if (instructions && Array.isArray(instructions) && instructions.length > 0) {
|
|
140
|
-
console.log('
|
|
128
|
+
console.log('\\n\\x1b[33m--- GUIDE DE PILOTAGE (MCI) ---\\x1b[0m');
|
|
141
129
|
instructions.forEach(line => {
|
|
142
130
|
if (typeof line === 'string') {
|
|
143
|
-
const formattedLine = line.replace(/ACTION|CAPTURE|PERSPECTIVE/g, '
|
|
131
|
+
const formattedLine = line.replace(/ACTION|CAPTURE|PERSPECTIVE/g, '\\x1b[1m$&\\x1b[0m');
|
|
144
132
|
console.log(\` \${formattedLine}\`);
|
|
145
133
|
}
|
|
146
134
|
});
|
|
147
|
-
console.log('\x1b[33m-------------------------------\x1b[0m');
|
|
148
135
|
}
|
|
149
136
|
if (code && fileName) {
|
|
150
137
|
const folder = fileName.endsWith('.kt') ? 'public/native/android/' : 'src/pages/';
|
|
@@ -223,10 +210,26 @@ if (command === 'alex') {
|
|
|
223
210
|
else processAlexRequest(initialPrompt);
|
|
224
211
|
return;
|
|
225
212
|
}
|
|
226
|
-
if (command === '
|
|
213
|
+
if (command === 'android' || command === 'ios') {
|
|
227
214
|
checkGitSecurity();
|
|
215
|
+
const platform = command;
|
|
216
|
+
const nativeDir = platform === 'android' ? 'public/native/android/' : 'public/native/ios/'; //
|
|
217
|
+
const extension = platform === 'android' ? '.kt' : '.swift';
|
|
218
|
+
const fullPath = path.join(process.cwd(), nativeDir);
|
|
219
|
+
let hasNativeFiles = false;
|
|
220
|
+
if (fs.existsSync(fullPath)) {
|
|
221
|
+
const files = fs.readdirSync(fullPath);
|
|
222
|
+
hasNativeFiles = files.some(file => file.endsWith(extension));
|
|
223
|
+
}
|
|
224
|
+
if (!hasNativeFiles) {
|
|
225
|
+
console.log(\`\\n\\x1b[31m⚠️ ENGINE INCOMPLETE:\\x1b[0m No native blueprints detected for \\x1b[1m\${platform.toUpperCase()}\\x1b[0m.\`);
|
|
226
|
+
console.log(\`\\x1b[90mAlex must architect at least one \${extension} module before deployment.\\x1b[0m\\n\`);
|
|
227
|
+
process.exit(1);
|
|
228
|
+
}
|
|
229
|
+
const targetUrl = platform === 'android' ? ANDROID_BUILD_URL : IOS_BUILD_URL;
|
|
228
230
|
(async () => {
|
|
229
|
-
|
|
231
|
+
// Utilisation de \\n et \\x1b pour que le texte reste intact dans cli.js
|
|
232
|
+
console.log(\`\\n\\x1b[36m⚡ FLEETBO \${platform.toUpperCase()} UPLINK\\x1b[0m\`);
|
|
230
233
|
try {
|
|
231
234
|
execSync('npm run build', { stdio: 'inherit' });
|
|
232
235
|
let buildDir = fs.existsSync(path.join(process.cwd(), 'dist')) ? 'dist' : 'build';
|
|
@@ -237,11 +240,23 @@ if (command === 'deploy') {
|
|
|
237
240
|
archive.directory(path.join(process.cwd(), buildDir), false);
|
|
238
241
|
archive.finalize();
|
|
239
242
|
});
|
|
240
|
-
|
|
243
|
+
|
|
244
|
+
// Correction du saut de ligne ici aussi
|
|
245
|
+
console.log(\`\\n\\x1b[33mSyncing \${platform} logic bundle...\\x1b[0m\`);
|
|
241
246
|
await showEnergyTransfer();
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
247
|
+
|
|
248
|
+
const res = await axios.post(targetUrl, zipBuffer, {
|
|
249
|
+
headers: { 'Content-Type': 'application/zip', 'x-project-id': projectId }
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
if (res.data.success) {
|
|
253
|
+
console.log(\`\\n\\x1b[1m\${platform.toUpperCase()} DEPLOYED\\x1b[0m | \\x1b[32mAlex ❯\\x1b[0m Runtime updated.\`);
|
|
254
|
+
}
|
|
255
|
+
} catch (error) {
|
|
256
|
+
// Correction de l'affichage d'erreur
|
|
257
|
+
console.error(\`\\n\\x1b[31m Build Error:\\x1b[0m \${error.response?.data?.error || error.message}\`);
|
|
258
|
+
process.exit(1);
|
|
259
|
+
}
|
|
245
260
|
})();
|
|
246
261
|
return;
|
|
247
262
|
}
|