projax 1.3.14 → 1.3.16

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "projax-api",
3
- "version": "1.3.14",
3
+ "version": "1.3.16",
4
4
  "description": "REST API server for projax project dashboard (internal use)",
5
5
  "private": true,
6
6
  "main": "dist/index.js",
package/dist/index.js CHANGED
@@ -211,54 +211,38 @@ program
211
211
  .action(async () => {
212
212
  try {
213
213
  await ensureAPIServerRunning(true);
214
- // Find the built prxi file - check multiple locations
215
- const prxiBuiltNew = path.join(__dirname, '..', '..', 'prxi', 'dist', 'index.mjs');
216
- const prxiBuiltOld = path.join(__dirname, 'prxi', 'dist', 'index.mjs');
217
- const prxiSourceOld = path.join(__dirname, '..', 'src', 'prxi.tsx');
218
- let prxiPath = null;
219
- let useSource = false;
220
- if (fs.existsSync(prxiBuiltNew)) {
221
- prxiPath = prxiBuiltNew;
222
- }
223
- else if (fs.existsSync(prxiBuiltOld)) {
224
- prxiPath = prxiBuiltOld;
225
- }
226
- else if (fs.existsSync(prxiSourceOld)) {
227
- prxiPath = prxiSourceOld;
228
- useSource = true;
229
- }
214
+ // Find the prxi source file - check multiple locations
215
+ const prxiPaths = [
216
+ path.join(__dirname, 'prxi', 'src', 'index.tsx'), // When running from built/published CLI
217
+ path.join(__dirname, '..', '..', 'prxi', 'src', 'index.tsx'), // When running from workspace
218
+ path.join(__dirname, '..', 'src', 'prxi.tsx'), // Legacy location
219
+ ];
220
+ const prxiPath = prxiPaths.find(p => fs.existsSync(p));
230
221
  if (!prxiPath) {
231
222
  console.error('Error: prxi UI not found.');
232
- console.error('Please rebuild the project: npm run build');
223
+ console.error('Looked in:', prxiPaths);
233
224
  process.exit(1);
234
225
  }
235
- const { spawn } = require('child_process');
236
- if (useSource) {
237
- // Fallback: Run source using tsx
238
- const tsxBinRoot = path.join(__dirname, '..', '..', '..', 'node_modules', '.bin', 'tsx');
239
- const tsxBinCli = path.join(__dirname, '..', 'node_modules', '.bin', 'tsx');
240
- const tsxBin = fs.existsSync(tsxBinRoot) ? tsxBinRoot : tsxBinCli;
241
- if (!fs.existsSync(tsxBin)) {
242
- console.error('Error: tsx not found. Please install dependencies: npm install');
243
- process.exit(1);
244
- }
245
- const child = spawn(tsxBin, [prxiPath], {
246
- stdio: 'inherit',
247
- cwd: path.dirname(prxiPath),
248
- });
249
- child.on('exit', (code) => {
250
- process.exit(code || 0);
251
- });
252
- }
253
- else {
254
- // Run built version with node
255
- const child = spawn(process.execPath, [prxiPath], {
256
- stdio: 'inherit',
257
- });
258
- child.on('exit', (code) => {
259
- process.exit(code || 0);
260
- });
226
+ // Find tsx binary - it should be in CLI's node_modules since tsx is a dependency
227
+ const tsxPaths = [
228
+ path.join(__dirname, '..', 'node_modules', '.bin', 'tsx'), // When running from built CLI
229
+ path.join(__dirname, '..', '..', '..', 'node_modules', '.bin', 'tsx'), // When running from workspace root
230
+ 'tsx', // Fallback to PATH
231
+ ];
232
+ let tsxBin = tsxPaths.find(p => p === 'tsx' || fs.existsSync(p));
233
+ if (!tsxBin) {
234
+ console.error('Error: tsx not found. Please install dependencies: npm install');
235
+ process.exit(1);
261
236
  }
237
+ // Run prxi source using tsx
238
+ const { spawn } = require('child_process');
239
+ const child = spawn(tsxBin, [prxiPath], {
240
+ stdio: 'inherit',
241
+ cwd: path.dirname(prxiPath),
242
+ });
243
+ child.on('exit', (code) => {
244
+ process.exit(code || 0);
245
+ });
262
246
  }
263
247
  catch (error) {
264
248
  console.error('Error launching prxi:', error instanceof Error ? error.message : error);