muagqa 1.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muagqa",
3
- "version": "1.1.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,16 +1,36 @@
1
1
  import { execSync } from "child_process";
2
+ import path from "path";
2
3
  import chalk from "chalk";
3
4
 
4
- export async function ensurePlaywrightInstalled() {
5
+ export function ensurePlaywrightInstalled() {
5
6
  try {
6
- console.log(chalk.yellow("Checking Playwright installation..."));
7
+ console.log(chalk.cyan("🔍 Checking Playwright installation..."));
7
8
 
9
+ // Try running playwright --version
8
10
  execSync("npx playwright --version", { stdio: "ignore" });
9
11
 
10
- // If successful, browsers are already installed
11
- return;
12
- } catch {
13
- console.log(chalk.cyan("\nPlaywright browsers not found. Installing...\n"));
14
- execSync("npx playwright install chromium", { stdio: "inherit" });
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..."));
16
+ }
17
+
18
+ try {
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;
15
35
  }
16
36
  }