fleetbo-cockpit-cli 1.0.29 → 1.0.30

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 +24 -2
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -770,10 +770,32 @@ else {
770
770
  '--http-host-header', `127.0.0.1:${PORT}`
771
771
  ], { shell: true });
772
772
 
773
- uplinkProcess.stderr.on('data', (chunk) => {
773
+ let uplinkFound = false;
774
+
775
+ const handleUplinkOutput = (chunk) => {
774
776
  const text = chunk.toString();
777
+ if (uplinkFound) return;
775
778
  const match = text.match(/https:\/\/[a-zA-Z0-9-]+\.trycloudflare\.com/);
776
- if (match) syncFirebase(process.env.REACT_KEY_APP, match[0], process.env.REACT_APP_TESTER_EMAIL);
779
+ if (match) {
780
+ uplinkFound = true;
781
+ syncFirebase(process.env.REACT_KEY_APP, match[0], process.env.REACT_APP_TESTER_EMAIL);
782
+ }
783
+ };
784
+
785
+ // Cloudflared peut écrire l'URL sur stdout OU stderr selon la version
786
+ uplinkProcess.stdout.on('data', handleUplinkOutput);
787
+ uplinkProcess.stderr.on('data', handleUplinkOutput);
788
+
789
+ uplinkProcess.on('error', (err) => {
790
+ console.error(`\x1b[31m[Fleetbo] ⚠️ Cloudflared failed to start: ${err.message}\x1b[0m`);
791
+ console.error(`\x1b[90m[Fleetbo] Try installing cloudflared manually: npm install -g cloudflared\x1b[0m`);
792
+ });
793
+
794
+ uplinkProcess.on('close', (code) => {
795
+ if (!uplinkFound && code !== 0) {
796
+ console.error(`\x1b[31m[Fleetbo] ⚠️ Uplink process exited with code ${code} without establishing a tunnel.\x1b[0m`);
797
+ console.error(`\x1b[90m[Fleetbo] Try running manually: npx cloudflared tunnel --url http://127.0.0.1:${PORT}\x1b[0m`);
798
+ }
777
799
  });
778
800
  }
779
801
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbo-cockpit-cli",
3
- "version": "1.0.29",
3
+ "version": "1.0.30",
4
4
  "description": "Fleetbo CLI - Build native mobile apps with React",
5
5
  "author": "Fleetbo",
6
6
  "license": "MIT",