projax 1.3.2 → 1.3.3
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/dist/index.js +18 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -102,11 +102,27 @@ async function checkAPIStatus() {
|
|
|
102
102
|
}
|
|
103
103
|
return { running: false, port: null };
|
|
104
104
|
}
|
|
105
|
+
function resolveApiEntry() {
|
|
106
|
+
const candidates = [
|
|
107
|
+
// Packaged CLI (dist/api/index.js)
|
|
108
|
+
path.join(__dirname, 'api', 'index.js'),
|
|
109
|
+
// Development builds inside workspace
|
|
110
|
+
path.join(__dirname, '..', 'api', 'dist', 'index.js'),
|
|
111
|
+
path.join(__dirname, '..', '..', 'api', 'dist', 'index.js'),
|
|
112
|
+
path.join(__dirname, '..', '..', '..', 'api', 'dist', 'index.js'),
|
|
113
|
+
];
|
|
114
|
+
for (const candidate of candidates) {
|
|
115
|
+
if (fs.existsSync(candidate)) {
|
|
116
|
+
return candidate;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
105
121
|
// Function to start the API server
|
|
106
122
|
async function startAPIServer(silent = false) {
|
|
107
123
|
const { spawn } = require('child_process');
|
|
108
|
-
const apiPath =
|
|
109
|
-
if (!
|
|
124
|
+
const apiPath = resolveApiEntry();
|
|
125
|
+
if (!apiPath) {
|
|
110
126
|
if (!silent) {
|
|
111
127
|
console.error('Error: API server not found. Please build it first: npm run build --workspace=packages/api');
|
|
112
128
|
}
|