@zibby/cli 0.1.10 → 0.1.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zibby/cli",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Zibby CLI - Test automation generator and runner",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,13 +1,23 @@
1
1
  import { spawn } from 'child_process';
2
- import { resolve, join, dirname } from 'path';
3
- import { fileURLToPath } from 'url';
2
+ import { join, dirname } from 'path';
3
+ import { createRequire } from 'module';
4
4
  import chalk from 'chalk';
5
5
 
6
- const __filename = fileURLToPath(import.meta.url);
7
- const __dirname = dirname(__filename);
6
+ const require = createRequire(import.meta.url);
7
+
8
+ function findCorePackagePath() {
9
+ try {
10
+ return dirname(require.resolve('@zibby/core/package.json'));
11
+ } catch {
12
+ return null;
13
+ }
14
+ }
8
15
 
9
16
  async function runScript(scriptName, description, headed = false, cloudSync = false, video = 'on', viewport = null) {
10
- const corePackagePath = resolve(__dirname, '../../../core');
17
+ const corePackagePath = findCorePackagePath();
18
+ if (!corePackagePath) {
19
+ throw new Error('@zibby/core not found. Run: npm install @zibby/core');
20
+ }
11
21
  const scriptPath = join(corePackagePath, 'scripts', scriptName);
12
22
 
13
23
  const env = { ...process.env };
@@ -64,7 +74,10 @@ export async function setupCiCommand(_options) {
64
74
 
65
75
  export async function testWithVideoCommand(testFile, options) {
66
76
  try {
67
- const corePackagePath = resolve(__dirname, '../../../core');
77
+ const corePackagePath = findCorePackagePath();
78
+ if (!corePackagePath) {
79
+ throw new Error('@zibby/core not found. Run: npm install @zibby/core');
80
+ }
68
81
  const scriptPath = join(corePackagePath, 'scripts', 'test-with-video.sh');
69
82
 
70
83
  const args = [scriptPath, testFile || 'tests/'];