jettypod 4.4.26 → 4.4.27
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/jettypod.js +18 -10
- package/package.json +1 -1
package/jettypod.js
CHANGED
|
@@ -1973,7 +1973,7 @@ switch (command) {
|
|
|
1973
1973
|
|
|
1974
1974
|
// Launch dashboard
|
|
1975
1975
|
const dashboardPath = path.join(__dirname, 'apps', 'dashboard');
|
|
1976
|
-
const
|
|
1976
|
+
const BASE_PORT = 3456;
|
|
1977
1977
|
const { spawn, exec } = require('child_process');
|
|
1978
1978
|
|
|
1979
1979
|
// Check if a port is available
|
|
@@ -1988,12 +1988,23 @@ switch (command) {
|
|
|
1988
1988
|
server.listen(port);
|
|
1989
1989
|
});
|
|
1990
1990
|
|
|
1991
|
-
|
|
1991
|
+
// Find an available port starting from BASE_PORT
|
|
1992
|
+
const findAvailablePort = async (startPort, maxAttempts = 10) => {
|
|
1993
|
+
for (let i = 0; i < maxAttempts; i++) {
|
|
1994
|
+
const port = startPort + i;
|
|
1995
|
+
if (await isPortAvailable(port)) {
|
|
1996
|
+
return port;
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
return null;
|
|
2000
|
+
};
|
|
2001
|
+
|
|
2002
|
+
const availablePort = await findAvailablePort(BASE_PORT);
|
|
1992
2003
|
|
|
1993
|
-
if (
|
|
2004
|
+
if (availablePort) {
|
|
1994
2005
|
// Start dashboard in background with project path
|
|
1995
2006
|
console.log('🚀 Starting dashboard...');
|
|
1996
|
-
const dashboardProcess = spawn('npm', ['run', 'dev', '--', '-p', String(
|
|
2007
|
+
const dashboardProcess = spawn('npm', ['run', 'dev', '--', '-p', String(availablePort)], {
|
|
1997
2008
|
cwd: dashboardPath,
|
|
1998
2009
|
detached: true,
|
|
1999
2010
|
stdio: 'ignore',
|
|
@@ -2008,14 +2019,11 @@ switch (command) {
|
|
|
2008
2019
|
setTimeout(() => {
|
|
2009
2020
|
const openCmd = process.platform === 'darwin' ? 'open' :
|
|
2010
2021
|
process.platform === 'win32' ? 'start' : 'xdg-open';
|
|
2011
|
-
exec(`${openCmd} http://localhost:${
|
|
2022
|
+
exec(`${openCmd} http://localhost:${availablePort}`);
|
|
2012
2023
|
}, 2000);
|
|
2013
2024
|
} else {
|
|
2014
|
-
//
|
|
2015
|
-
console.log('
|
|
2016
|
-
const openCmd = process.platform === 'darwin' ? 'open' :
|
|
2017
|
-
process.platform === 'win32' ? 'start' : 'xdg-open';
|
|
2018
|
-
exec(`${openCmd} http://localhost:${DASHBOARD_PORT}`);
|
|
2025
|
+
// No ports available in range
|
|
2026
|
+
console.log('⚠️ Could not find available port for dashboard (tried ports 3456-3465)');
|
|
2019
2027
|
}
|
|
2020
2028
|
|
|
2021
2029
|
const discovery = currentConfig.project_discovery;
|