fleetbo-cockpit-cli 1.0.163 → 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 +19 -14
  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
 
@@ -982,26 +983,28 @@ else if (['page', 'g', 'generate'].includes(command)) {
982
983
  // ============================================
983
984
  else {
984
985
  const NULL_DEV = process.platform === 'win32' ? '>nul 2>&1' : '2>/dev/null';
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}`);
994
+ }
995
+ } catch (e) {}
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' });
991
1003
  } else {
992
- // 🪓 LE TUEUR DE ZOMBIES WINDOWS
993
- // Cherche l'ID du processus (PID) qui utilise notre port, et le tue de force (/F)
994
- const output = execSync(`netstat -ano | findstr :${port}`).toString();
995
- const lines = output.split('\n');
996
- for (const line of lines) {
997
- const parts = line.trim().split(/\s+/);
998
- if (parts.length >= 5 && parts[1].includes(`:${port}`)) {
999
- const pid = parts[parts.length - 1];
1000
- execSync(`taskkill /PID ${pid} /F /T >nul 2>&1`);
1001
- }
1002
- }
1004
+ devServerProcess.kill('SIGKILL');
1003
1005
  }
1004
1006
  } catch (e) {}
1007
+ devServerProcess = null;
1005
1008
  }
1006
1009
 
1007
1010
  const killNetworkService = () => {
@@ -1028,6 +1031,7 @@ else {
1028
1031
  console.error('[Fleetbo] Network cleanup warning:', e.message);
1029
1032
  }
1030
1033
  killNetworkService();
1034
+ killDevServer();
1031
1035
  killProcessOnPort(PORT);
1032
1036
  console.log('[Fleetbo] Bye.');
1033
1037
  process.exit(code);
@@ -1066,7 +1070,7 @@ else {
1066
1070
  const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
1067
1071
 
1068
1072
  // ✅ On passe la chaîne complète, SANS tableau d'arguments du tout !
1069
- const devServer = spawn(`${npmCmd} run dev --silent`, {
1073
+ devServerProcess = spawn(`${npmCmd} run dev --silent`, {
1070
1074
  stdio: ['ignore', 'pipe', 'pipe'],
1071
1075
  shell: true,
1072
1076
  env: {
@@ -1075,6 +1079,7 @@ else {
1075
1079
  PORT: PORT.toString(),
1076
1080
  }
1077
1081
  });
1082
+ const devServer = devServerProcess;
1078
1083
  //devServer.stdout.pipe(process.stdout);
1079
1084
  devServer.stderr.pipe(process.stderr);
1080
1085
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fleetbo-cockpit-cli",
3
- "version": "1.0.163",
3
+ "version": "1.0.166",
4
4
  "description": "Fleetbo CLI - Build native mobile apps with React",
5
5
  "author": "Fleetbo",
6
6
  "license": "MIT",