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.
Files changed (2) hide show
  1. package/cli.js +40 -17
  2. 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
- const res = await axios.post(targetUrl, zipBuffer, {
430
- headers: {
431
- 'Content-Type': 'application/zip',
432
- 'x-project-id': projectId
433
- },
434
- maxContentLength: Infinity,
435
- maxBodyLength: Infinity,
436
- timeout: 120000 // 2 minutes timeout
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
- if (res.data.success) {
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 Build ID: ${res.data.buildId || 'N/A'}\x1b[0m`);
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
- throw new Error(res.data.error || 'Unknown error from Factory');
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
- const errorMsg = error.response?.data?.error || error.message;
455
- console.error(`\x1b[31m Error:\x1b[0m ${errorMsg}`);
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 (errorMsg.includes('Propulsion Limit')) {
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 (errorMsg.includes('No') && errorMsg.includes('blueprint')) {
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('');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbo-cockpit-cli",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Fleetbo CLI - Build native mobile apps with React",
5
5
  "author": "Fleetbo",
6
6
  "license": "MIT",