muagqa 1.0.0 → 1.1.1

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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muagqa",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "MuagQA CLI — Test case runner with one-time session token and Playwright recorder",
5
5
  "author": "Mary C.N. Enwezor",
6
6
  "license": "MIT",
@@ -1,19 +1,36 @@
1
1
  import { execSync } from "child_process";
2
+ import path from "path";
2
3
  import chalk from "chalk";
3
4
 
4
5
  export function ensurePlaywrightInstalled() {
5
6
  try {
7
+ console.log(chalk.cyan("🔍 Checking Playwright installation..."));
8
+
9
+ // Try running playwright --version
6
10
  execSync("npx playwright --version", { stdio: "ignore" });
7
- return; // Already installed, nothing else to do
8
- } catch (e) {
9
- console.log(chalk.yellow("📦 Playwright not detected. Installing browsers..."));
11
+
12
+ console.log(chalk.green("✔ Playwright is already installed globally."));
13
+ return true;
14
+ } catch (err) {
15
+ console.log(chalk.yellow("⚠ Playwright not found globally. Installing..."));
10
16
  }
11
17
 
12
18
  try {
13
- execSync("npx playwright install", { stdio: "inherit" });
14
- console.log(chalk.green(" Playwright installation complete.\n"));
15
- } catch (err) {
16
- console.log(chalk.red("❌ Failed to install Playwright browsers."));
17
- throw err;
19
+ // 1️⃣ Determine global CLI install folder
20
+ const globalRoot = execSync("npm root -g").toString().trim();
21
+
22
+ const cliPath = path.join(globalRoot, "muagqa");
23
+
24
+ console.log(chalk.cyan(`📂 Installing Playwright inside: ${cliPath}`));
25
+
26
+ // 2️⃣ Install Playwright inside the global muagqa folder
27
+ execSync(`cd "${cliPath}" && npm install playwright`, { stdio: "inherit" });
28
+
29
+ console.log(chalk.green("✔ Playwright installed successfully!"));
30
+ return true;
31
+ } catch (e) {
32
+ console.log(chalk.red("❌ Failed to install Playwright globally."));
33
+ console.error(e);
34
+ return false;
18
35
  }
19
- }
36
+ }