projax 3.3.58 → 3.3.59
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/electron/script-runner.js +52 -20
- package/dist/index.js +1 -1
- package/dist/prxi.js +844 -109
- package/dist/prxi.tsx +1234 -179
- package/dist/script-runner.js +52 -20
- package/package.json +1 -1
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/core-bridge.ts.html +0 -292
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -191
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/core-bridge.ts.html +0 -292
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -191
- package/coverage/lcov-report/port-extractor.ts.html +0 -1174
- package/coverage/lcov-report/port-scanner.ts.html +0 -301
- package/coverage/lcov-report/port-utils.ts.html +0 -670
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/script-runner.ts.html +0 -3346
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov-report/test-parser.ts.html +0 -799
- package/coverage/lcov.info +0 -1338
- package/coverage/port-extractor.ts.html +0 -1174
- package/coverage/port-scanner.ts.html +0 -301
- package/coverage/port-utils.ts.html +0 -670
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/script-runner.ts.html +0 -3346
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -210
- package/coverage/test-parser.ts.html +0 -799
- package/dist/__tests__/core-bridge.test.d.ts +0 -1
- package/dist/__tests__/core-bridge.test.js +0 -135
- package/dist/__tests__/port-extractor.test.d.ts +0 -1
- package/dist/__tests__/port-extractor.test.js +0 -407
- package/dist/__tests__/port-scanner.test.d.ts +0 -1
- package/dist/__tests__/port-scanner.test.js +0 -170
- package/dist/__tests__/port-utils.test.d.ts +0 -1
- package/dist/__tests__/port-utils.test.js +0 -127
- package/dist/__tests__/script-runner.test.d.ts +0 -1
- package/dist/__tests__/script-runner.test.js +0 -491
- package/dist/__tests__/test-parser.test.d.ts +0 -1
- package/dist/__tests__/test-parser.test.js +0 -276
- package/dist/api/__tests__/database.test.d.ts +0 -2
- package/dist/api/__tests__/database.test.d.ts.map +0 -1
- package/dist/api/__tests__/database.test.js +0 -485
- package/dist/api/__tests__/database.test.js.map +0 -1
- package/dist/api/__tests__/routes.test.d.ts +0 -2
- package/dist/api/__tests__/routes.test.d.ts.map +0 -1
- package/dist/api/__tests__/routes.test.js +0 -484
- package/dist/api/__tests__/routes.test.js.map +0 -1
- package/dist/api/__tests__/scanner.test.d.ts +0 -2
- package/dist/api/__tests__/scanner.test.d.ts.map +0 -1
- package/dist/api/__tests__/scanner.test.js +0 -403
- package/dist/api/__tests__/scanner.test.js.map +0 -1
- package/dist/core/__tests__/database.test.d.ts +0 -1
- package/dist/core/__tests__/database.test.js +0 -557
- package/dist/core/__tests__/detector.test.d.ts +0 -1
- package/dist/core/__tests__/detector.test.js +0 -375
- package/dist/core/__tests__/index.test.d.ts +0 -1
- package/dist/core/__tests__/index.test.js +0 -469
- package/dist/core/__tests__/scanner.test.d.ts +0 -1
- package/dist/core/__tests__/scanner.test.js +0 -406
- package/dist/core/__tests__/settings.test.d.ts +0 -1
- package/dist/core/__tests__/settings.test.js +0 -280
- package/dist/electron/core/__tests__/database.test.d.ts +0 -1
- package/dist/electron/core/__tests__/database.test.js +0 -557
- package/dist/electron/core/__tests__/detector.test.d.ts +0 -1
- package/dist/electron/core/__tests__/detector.test.js +0 -375
- package/dist/electron/core/__tests__/index.test.d.ts +0 -1
- package/dist/electron/core/__tests__/index.test.js +0 -469
- package/dist/electron/core/__tests__/scanner.test.d.ts +0 -1
- package/dist/electron/core/__tests__/scanner.test.js +0 -406
- package/dist/electron/core/__tests__/settings.test.d.ts +0 -1
- package/dist/electron/core/__tests__/settings.test.js +0 -280
- package/jest.config.js +0 -26
|
@@ -51,6 +51,38 @@ const os = __importStar(require("os"));
|
|
|
51
51
|
const child_process_1 = require("child_process");
|
|
52
52
|
const core_bridge_1 = require("./core-bridge");
|
|
53
53
|
const port_utils_1 = require("./port-utils");
|
|
54
|
+
/**
|
|
55
|
+
* Safe console logging that handles EPIPE errors gracefully
|
|
56
|
+
* This prevents uncaught exceptions when stdout/stderr are closed
|
|
57
|
+
*/
|
|
58
|
+
function safeLog(...args) {
|
|
59
|
+
try {
|
|
60
|
+
console.log(...args);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
// Silently ignore EPIPE errors (pipe closed)
|
|
64
|
+
if (error?.code !== 'EPIPE') {
|
|
65
|
+
// For other errors, try to write to stderr as fallback
|
|
66
|
+
try {
|
|
67
|
+
process.stderr.write(`[log] ${args.join(' ')}\n`);
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
// Give up - output streams are not available
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function safeError(...args) {
|
|
76
|
+
try {
|
|
77
|
+
console.error(...args);
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
// Silently ignore EPIPE errors
|
|
81
|
+
if (error?.code !== 'EPIPE') {
|
|
82
|
+
// No fallback for stderr errors
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
54
86
|
/**
|
|
55
87
|
* Detect the project type based on files in the directory
|
|
56
88
|
*/
|
|
@@ -278,19 +310,19 @@ function getProjectScripts(projectPath) {
|
|
|
278
310
|
async function handlePortConflict(port, projectName, force) {
|
|
279
311
|
const processInfo = await (0, port_utils_1.getProcessOnPort)(port);
|
|
280
312
|
if (!processInfo) {
|
|
281
|
-
|
|
313
|
+
safeError(`Port ${port} appears to be in use, but couldn't identify the process.`);
|
|
282
314
|
return false;
|
|
283
315
|
}
|
|
284
|
-
|
|
316
|
+
safeError(`\n⚠️ Port ${port} is already in use by process ${processInfo.pid} (${processInfo.command})`);
|
|
285
317
|
if (force) {
|
|
286
|
-
|
|
318
|
+
safeLog(`Killing process ${processInfo.pid} on port ${port}...`);
|
|
287
319
|
const killed = await (0, port_utils_1.killProcessOnPort)(port);
|
|
288
320
|
if (killed) {
|
|
289
|
-
|
|
321
|
+
safeLog(`✓ Process killed. Retrying...\n`);
|
|
290
322
|
return true;
|
|
291
323
|
}
|
|
292
324
|
else {
|
|
293
|
-
|
|
325
|
+
safeError(`Failed to kill process on port ${port}`);
|
|
294
326
|
return false;
|
|
295
327
|
}
|
|
296
328
|
}
|
|
@@ -307,16 +339,16 @@ async function handlePortConflict(port, projectName, force) {
|
|
|
307
339
|
if (answer.kill) {
|
|
308
340
|
const killed = await (0, port_utils_1.killProcessOnPort)(port);
|
|
309
341
|
if (killed) {
|
|
310
|
-
|
|
342
|
+
safeLog(`✓ Process killed. Retrying...\n`);
|
|
311
343
|
return true;
|
|
312
344
|
}
|
|
313
345
|
else {
|
|
314
|
-
|
|
346
|
+
safeError(`Failed to kill process on port ${port}`);
|
|
315
347
|
return false;
|
|
316
348
|
}
|
|
317
349
|
}
|
|
318
350
|
else {
|
|
319
|
-
|
|
351
|
+
safeLog('Cancelled.');
|
|
320
352
|
return false;
|
|
321
353
|
}
|
|
322
354
|
}
|
|
@@ -416,8 +448,8 @@ function runScript(projectPath, scriptName, args = [], force = false) {
|
|
|
416
448
|
commandArgs = [...parts.slice(1), ...args];
|
|
417
449
|
break;
|
|
418
450
|
}
|
|
419
|
-
|
|
420
|
-
|
|
451
|
+
safeLog(`Running: ${command} ${commandArgs.join(' ')}`);
|
|
452
|
+
safeLog(`In directory: ${projectPath}\n`);
|
|
421
453
|
// Capture stderr for reactive port conflict detection
|
|
422
454
|
let stderrOutput = '';
|
|
423
455
|
let stdoutOutput = '';
|
|
@@ -681,7 +713,7 @@ async function stopScript(pid) {
|
|
|
681
713
|
}
|
|
682
714
|
catch (error) {
|
|
683
715
|
// Process may have already exited
|
|
684
|
-
|
|
716
|
+
safeError(`Error killing process ${pid}:`, error);
|
|
685
717
|
}
|
|
686
718
|
}
|
|
687
719
|
// Remove from tracking regardless of whether kill succeeded
|
|
@@ -689,7 +721,7 @@ async function stopScript(pid) {
|
|
|
689
721
|
return true;
|
|
690
722
|
}
|
|
691
723
|
catch (error) {
|
|
692
|
-
|
|
724
|
+
safeError(`Error stopping script ${pid}:`, error);
|
|
693
725
|
return false;
|
|
694
726
|
}
|
|
695
727
|
}
|
|
@@ -869,9 +901,9 @@ function runScriptInBackground(projectPath, projectName, scriptName, args = [],
|
|
|
869
901
|
// Unref so parent can exit and process runs independently
|
|
870
902
|
child.unref();
|
|
871
903
|
// Show minimal output
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
904
|
+
safeLog(`✓ Started "${projectName}" (${scriptName}) in background [PID: ${child.pid}]`);
|
|
905
|
+
safeLog(` Logs: ${logFile}`);
|
|
906
|
+
safeLog(` Command: ${command} ${commandArgs.join(' ')}\n`);
|
|
875
907
|
// For background processes, we can't easily do reactive detection
|
|
876
908
|
// But we can check the log file after a short delay for port conflicts and URLs
|
|
877
909
|
setTimeout(async () => {
|
|
@@ -883,9 +915,9 @@ function runScriptInBackground(projectPath, projectName, scriptName, args = [],
|
|
|
883
915
|
// Check for port conflicts
|
|
884
916
|
const port = (0, port_utils_1.extractPortFromError)(logContent);
|
|
885
917
|
if (port) {
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
918
|
+
safeError(`\n⚠️ Port conflict detected in background process: port ${port} is in use`);
|
|
919
|
+
safeError(` Check log file: ${logFile}`);
|
|
920
|
+
safeError(` Use: prx <project> <script> --force to auto-resolve port conflicts\n`);
|
|
889
921
|
}
|
|
890
922
|
// Extract URLs from output
|
|
891
923
|
const urls = extractUrlsFromOutput(logContent);
|
|
@@ -986,10 +1018,10 @@ async function checkAndParseTestResults(logFile, projectPath, scriptName) {
|
|
|
986
1018
|
// Save test results to database
|
|
987
1019
|
db.addTestResult(project.id, scriptName, parsed.passed, parsed.failed, parsed.skipped, parsed.total, parsed.duration, parsed.coverage, parsed.framework, logContent.slice(-5000) // Store last 5000 chars of output
|
|
988
1020
|
);
|
|
989
|
-
|
|
1021
|
+
safeLog(`\n📊 Test results saved: ${parsed.passed} passed, ${parsed.failed} failed, ${parsed.skipped} skipped`);
|
|
990
1022
|
}
|
|
991
1023
|
catch (error) {
|
|
992
1024
|
// Silently fail - test parsing is optional
|
|
993
|
-
|
|
1025
|
+
safeError('Error parsing test results:', error);
|
|
994
1026
|
}
|
|
995
1027
|
}
|
package/dist/index.js
CHANGED
|
@@ -461,7 +461,7 @@ program
|
|
|
461
461
|
path.join(__dirname, '..', '..', '..', 'node_modules', '.bin', 'tsx'), // When running from workspace root
|
|
462
462
|
'tsx', // Fallback to PATH
|
|
463
463
|
];
|
|
464
|
-
|
|
464
|
+
const tsxBin = tsxPaths.find(p => p === 'tsx' || fs.existsSync(p));
|
|
465
465
|
if (!tsxBin) {
|
|
466
466
|
console.error('Error: tsx not found. Please install dependencies: npm install');
|
|
467
467
|
process.exit(1);
|