skopix 2.0.103 → 2.0.104

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/core/recorder.js +19 -12
  2. package/package.json +1 -1
package/core/recorder.js CHANGED
@@ -850,15 +850,22 @@ export class RecordingSession {
850
850
  }
851
851
  }
852
852
 
853
- // ─── Entry point ──────────────────────────────────────────────────────────────
854
- const [,, url, sessionId, screenshotDir] = process.argv;
855
- if (!url) { process.stderr.write('Usage: recorder.js <url> <sessionId> <screenshotDir>\n'); process.exit(1); }
856
-
857
- const session = new RecordingSession({ url, sessionId, screenshotDir });
858
- session.launch().catch((err) => { session.emit({ type: 'error', message: err.message }); process.exit(1); });
859
-
860
- process.stdin.setEncoding('utf8');
861
- process.stdin.on('data', async (data) => {
862
- if (data.trim() === 'stop') { await session.stop(); process.exit(0); }
863
- });
864
- process.on('SIGTERM', async () => { await session.stop(); process.exit(0); });
853
+ // ─── Entry point (only when run directly, not when imported as a module) ──────
854
+ const isMain = process.argv[1] && (
855
+ process.argv[1].endsWith('recorder.js') ||
856
+ process.argv[1].includes('recorder')
857
+ );
858
+
859
+ if (isMain && !process.argv[1].includes('node_modules/.bin')) {
860
+ const [,, url, sessionId, screenshotDir] = process.argv;
861
+ if (!url) { process.stderr.write('Usage: recorder.js <url> <sessionId> <screenshotDir>\n'); process.exit(1); }
862
+
863
+ const session = new RecordingSession({ url, sessionId, screenshotDir });
864
+ session.launch().catch((err) => { session.emit({ type: 'error', message: err.message }); process.exit(1); });
865
+
866
+ process.stdin.setEncoding('utf8');
867
+ process.stdin.on('data', async (data) => {
868
+ if (data.trim() === 'stop') { await session.stop(); process.exit(0); }
869
+ });
870
+ process.on('SIGTERM', async () => { await session.stop(); process.exit(0); });
871
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skopix",
3
- "version": "2.0.103",
3
+ "version": "2.0.104",
4
4
  "description": "Browser-based QA tool — record tests by using your app, replay them deterministically, generate Playwright code automatically",
5
5
  "main": "cli/index.js",
6
6
  "bin": {