projax 3.3.7 → 3.3.9

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/dist/index.js +24 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -133,12 +133,32 @@ async function startAPIServer(silent = false) {
133
133
  console.log('Starting API server...');
134
134
  }
135
135
  try {
136
- spawn('node', [apiPath], {
136
+ const child = spawn('node', [apiPath], {
137
137
  detached: true,
138
- stdio: 'ignore',
139
- }).unref();
138
+ stdio: silent ? 'ignore' : 'inherit',
139
+ });
140
+ // When not silent, keep the process attached for a moment to see any immediate errors
140
141
  if (!silent) {
141
- console.log('✓ API server started');
142
+ await new Promise((resolve, reject) => {
143
+ const timeout = setTimeout(() => {
144
+ child.unref();
145
+ console.log('✓ API server started');
146
+ resolve(true);
147
+ }, 1000);
148
+ child.on('error', (err) => {
149
+ clearTimeout(timeout);
150
+ reject(err);
151
+ });
152
+ child.on('exit', (code) => {
153
+ if (code !== 0 && code !== null) {
154
+ clearTimeout(timeout);
155
+ reject(new Error(`API server exited with code ${code}`));
156
+ }
157
+ });
158
+ });
159
+ }
160
+ else {
161
+ child.unref();
142
162
  }
143
163
  return true;
144
164
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "projax",
3
- "version": "3.3.7",
3
+ "version": "3.3.9",
4
4
  "description": "Cross-platform project management dashboard for tracking local development projects. Features CLI, Terminal UI, Desktop app, REST API, and built-in tools for test detection, port management, and script execution.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {