fleetbo-cockpit-cli 1.0.164 → 1.0.166

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 +22 -23
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -27,6 +27,7 @@ const CACHE_URL = "https://getmodulecache-jqycakhlxa-uc.a.run.app";
27
27
  const PORT = 3000;
28
28
 
29
29
  let uplinkProcess = null;
30
+ let devServerProcess = null;
30
31
  const args = process.argv.slice(2);
31
32
  const command = args[0];
32
33
 
@@ -985,25 +986,31 @@ else {
985
986
 
986
987
  function killProcessOnPort(port) {
987
988
  try {
988
- if (process.platform !== 'win32') {
989
+ if (process.platform === 'win32') {
990
+ execSync(`for /f "tokens=5" %a in ('netstat -aon ^| find ":${port}"') do taskkill /F /PID %a`, { stdio: 'ignore', shell: true });
991
+ } else {
989
992
  const pid = execSync(`lsof -ti:${port} ${NULL_DEV}`).toString().trim();
990
993
  if (pid) execSync(`kill -9 ${pid.split('\n').join(' ')} ${NULL_DEV}`);
991
994
  }
992
995
  } catch (e) {}
993
996
  }
997
+
998
+ function killDevServer() {
999
+ if (!devServerProcess) return;
1000
+ try {
1001
+ if (process.platform === 'win32') {
1002
+ execSync(`taskkill /pid ${devServerProcess.pid} /T /F`, { stdio: 'ignore' });
1003
+ } else {
1004
+ devServerProcess.kill('SIGKILL');
1005
+ }
1006
+ } catch (e) {}
1007
+ devServerProcess = null;
1008
+ }
994
1009
 
995
1010
  const killNetworkService = () => {
996
1011
  if (uplinkProcess) {
997
1012
  try {
998
- if (process.platform === 'win32') {
999
- // Windows ne supporte pas SIGINT sur les process enfants
1000
- // On utilise taskkill pour forcer la fermeture propre
1001
- try {
1002
- execSync(`taskkill /pid ${uplinkProcess.pid} /T /F`, { stdio: 'ignore' });
1003
- } catch (e) {}
1004
- } else {
1005
- uplinkProcess.kill('SIGINT');
1006
- }
1013
+ uplinkProcess.kill('SIGINT');
1007
1014
  console.log('[Fleetbo] Engine closed.');
1008
1015
  } catch (e) {
1009
1016
  console.error('[Fleetbo] Error closing tunnel:', e.message);
@@ -1012,7 +1019,7 @@ else {
1012
1019
  };
1013
1020
 
1014
1021
  let isExiting = false;
1015
-
1022
+
1016
1023
  async function cleanupAndExit(code = 0) {
1017
1024
  if (isExiting) return;
1018
1025
  isExiting = true;
@@ -1024,21 +1031,12 @@ else {
1024
1031
  console.error('[Fleetbo] Network cleanup warning:', e.message);
1025
1032
  }
1026
1033
  killNetworkService();
1034
+ killDevServer();
1027
1035
  killProcessOnPort(PORT);
1028
1036
  console.log('[Fleetbo] Bye.');
1029
1037
  process.exit(code);
1030
1038
  }
1031
-
1032
- // 🪟 WINDOWS FIX : Ctrl+C est intercepté par cmd.exe avant Node.js
1033
- // On capture le signal au niveau stdin pour éviter l'invite "O/N"
1034
- if (process.platform === 'win32') {
1035
- const rl = require('readline').createInterface({
1036
- input: process.stdin,
1037
- output: process.stdout
1038
- });
1039
- rl.on('SIGINT', () => cleanupAndExit(0));
1040
- }
1041
-
1039
+
1042
1040
  process.on('SIGINT', () => cleanupAndExit(0));
1043
1041
  process.on('SIGTERM', () => cleanupAndExit(0));
1044
1042
 
@@ -1072,7 +1070,7 @@ else {
1072
1070
  const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
1073
1071
 
1074
1072
  // ✅ On passe la chaîne complète, SANS tableau d'arguments du tout !
1075
- const devServer = spawn(`${npmCmd} run dev --silent`, {
1073
+ devServerProcess = spawn(`${npmCmd} run dev --silent`, {
1076
1074
  stdio: ['ignore', 'pipe', 'pipe'],
1077
1075
  shell: true,
1078
1076
  env: {
@@ -1081,6 +1079,7 @@ else {
1081
1079
  PORT: PORT.toString(),
1082
1080
  }
1083
1081
  });
1082
+ const devServer = devServerProcess;
1084
1083
  //devServer.stdout.pipe(process.stdout);
1085
1084
  devServer.stderr.pipe(process.stderr);
1086
1085
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbo-cockpit-cli",
3
- "version": "1.0.164",
3
+ "version": "1.0.166",
4
4
  "description": "Fleetbo CLI - Build native mobile apps with React",
5
5
  "author": "Fleetbo",
6
6
  "license": "MIT",