declare-cc 0.5.3 → 0.5.4
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/hooks/declare-server.js +7 -7
- package/package.json +1 -1
package/hooks/declare-server.js
CHANGED
|
@@ -86,17 +86,15 @@ function killPort(port) {
|
|
|
86
86
|
* Start the dashboard server for this project in the background.
|
|
87
87
|
*/
|
|
88
88
|
function startServer() {
|
|
89
|
+
// Write port file before spawning so /declare:dashboard always finds it
|
|
90
|
+
try { fs.writeFileSync(portFile, String(port)); } catch {}
|
|
91
|
+
|
|
89
92
|
const child = cp.spawn(process.execPath, [bundle, 'serve', '--port', String(port)], {
|
|
90
93
|
cwd,
|
|
91
94
|
detached: true,
|
|
92
95
|
stdio: 'ignore',
|
|
93
96
|
});
|
|
94
97
|
child.unref();
|
|
95
|
-
|
|
96
|
-
// Write port file so /declare:dashboard knows where to open
|
|
97
|
-
setTimeout(() => {
|
|
98
|
-
try { fs.writeFileSync(portFile, String(port)); } catch {}
|
|
99
|
-
}, 800);
|
|
100
98
|
}
|
|
101
99
|
|
|
102
100
|
// Check if something is already running on this port
|
|
@@ -111,6 +109,8 @@ checkRunningServer(port, status => {
|
|
|
111
109
|
|
|
112
110
|
// Nothing running (or non-Declare process) — kill whatever is there and start fresh
|
|
113
111
|
killPort(port);
|
|
114
|
-
setTimeout(
|
|
115
|
-
|
|
112
|
+
setTimeout(() => {
|
|
113
|
+
startServer();
|
|
114
|
+
process.exit(0);
|
|
115
|
+
}, 300);
|
|
116
116
|
});
|
package/package.json
CHANGED