fleetbo-cockpit-cli 1.0.6 β 1.0.8
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/cli.js +40 -17
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -362,6 +362,12 @@ else if (command === 'android' || command === 'ios') {
|
|
|
362
362
|
process.stdout.write(`\x1b[32mOK\x1b[0m\n\n`);
|
|
363
363
|
} catch (preflightError) {
|
|
364
364
|
process.stdout.write(`\x1b[31mDENIED\x1b[0m\n`);
|
|
365
|
+
|
|
366
|
+
// π’ AJOUT CRITIQUE : On capture le message d'erreur du Cloud (JSON)
|
|
367
|
+
if (preflightError.response && preflightError.response.data && preflightError.response.data.error) {
|
|
368
|
+
// On remplace l'erreur technique Axios par le message mΓ©tier clair
|
|
369
|
+
throw new Error(preflightError.response.data.error);
|
|
370
|
+
}
|
|
365
371
|
// Fait sauter le code directement au "catch" global du bas sans jamais builder
|
|
366
372
|
throw preflightError;
|
|
367
373
|
}
|
|
@@ -426,39 +432,56 @@ else if (command === 'android' || command === 'ios') {
|
|
|
426
432
|
console.log(`\n\x1b[33m[3/3]\x1b[0m Uploading to Fleetbo Factory...`);
|
|
427
433
|
await showEnergyTransfer();
|
|
428
434
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
435
|
+
// π’ ON UTILISE UNE VARIABLE LOCALE POUR LA RΓPONSE
|
|
436
|
+
let uploadResponse;
|
|
437
|
+
try {
|
|
438
|
+
uploadResponse = await axios.post(targetUrl, zipBuffer, {
|
|
439
|
+
headers: {
|
|
440
|
+
'Content-Type': 'application/zip',
|
|
441
|
+
'x-project-id': projectId
|
|
442
|
+
},
|
|
443
|
+
maxContentLength: Infinity,
|
|
444
|
+
maxBodyLength: Infinity,
|
|
445
|
+
timeout: 120000 // 2 minutes timeout
|
|
446
|
+
});
|
|
447
|
+
} catch (axiosError) {
|
|
448
|
+
// π SI AXIOS PLANTE (400, 403, 500), ON LANCE UNE ERREUR CLAIRE POUR LE CATCH GLOBAL
|
|
449
|
+
// axiosError.response.data contient le JSON renvoyΓ© par FandroidBuild
|
|
450
|
+
if (axiosError.response && axiosError.response.data && axiosError.response.data.error) {
|
|
451
|
+
throw new Error(axiosError.response.data.error);
|
|
452
|
+
} else {
|
|
453
|
+
// Timeout ou erreur rΓ©seau pure
|
|
454
|
+
throw new Error(`Connection to OS failed: ${axiosError.message}`);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
438
457
|
|
|
439
|
-
|
|
458
|
+
// π’ SI AXIOS RΓUSSIT MAIS QUE LA RΓPONSE N'EST PAS UN SUCCΓS LOGIQUE
|
|
459
|
+
if (uploadResponse.data && uploadResponse.data.success) {
|
|
440
460
|
console.log(`\n\x1b[32mββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\x1b[0m`);
|
|
441
461
|
console.log(`\x1b[32mβ ${platform.toUpperCase()} PROPULSION SUCCESSFUL\x1b[0m`);
|
|
442
462
|
console.log(`\x1b[32mββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\x1b[0m`);
|
|
443
|
-
console.log(`\x1b[90m
|
|
463
|
+
console.log(`\x1b[90m Deployment ID: ${uploadResponse.data.deploymentId || 'N/A'}\x1b[0m`);
|
|
444
464
|
console.log(`\x1b[90m Your ${platform} bundle is now in the Factory queue.\x1b[0m\n`);
|
|
445
465
|
} else {
|
|
446
|
-
|
|
466
|
+
// Ce cas ne devrait pas arriver si le backend est bien codΓ© (il renverrait une erreur HTTP), mais au cas oΓΉ :
|
|
467
|
+
throw new Error(uploadResponse.data?.error || 'Unknown logical error from Factory');
|
|
447
468
|
}
|
|
448
469
|
|
|
449
|
-
} catch (error) {
|
|
470
|
+
} catch (error) { // <-- LE CATCH GLOBAL (Reste inchangΓ©)
|
|
450
471
|
console.log(`\n\x1b[31mββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\x1b[0m`);
|
|
451
472
|
console.log(`\x1b[31mβ PROPULSION FAILED\x1b[0m`);
|
|
452
473
|
console.log(`\x1b[31mββββββββββββββββββββββββββββββββββββββββββββββββββββββββ\x1b[0m`);
|
|
453
474
|
|
|
454
|
-
|
|
455
|
-
console.error(`\x1b[31m Error:\x1b[0m ${
|
|
475
|
+
// L'erreur est maintenant propre, on l'affiche directement
|
|
476
|
+
console.error(`\x1b[31m Error:\x1b[0m ${error.message}`);
|
|
456
477
|
|
|
457
478
|
// Messages d'aide selon l'erreur
|
|
458
|
-
if (
|
|
479
|
+
if (error.message.includes('Limit') || error.message.includes('Quota')) {
|
|
459
480
|
console.log(`\n\x1b[33m π‘ Tip:\x1b[0m Upgrade to Senior Pilot for more builds.`);
|
|
460
|
-
} else if (
|
|
481
|
+
} else if (error.message.includes('No native module')) {
|
|
461
482
|
console.log(`\n\x1b[33m π‘ Tip:\x1b[0m Run "npm run fleetbo alex" to create native modules first.`);
|
|
483
|
+
} else if (error.message.includes('Trial Period Ended')) {
|
|
484
|
+
console.log(`\n\x1b[33m π‘ Tip:\x1b[0m Your free sprint is over. Upgrade to Senior Pilot on fleetbo.io.`);
|
|
462
485
|
}
|
|
463
486
|
|
|
464
487
|
console.log('');
|