@srcroot/ui 0.0.17 → 0.0.19

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/dist/index.js +18 -22
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -561,10 +561,10 @@ async function init(options) {
561
561
  const currentDeps = { ...currentPkg.dependencies, ...currentPkg.devDependencies };
562
562
  const missing = [];
563
563
  const requiredDeps = {
564
- "clsx": "clsx@2.1.1",
565
- "tailwind-merge": "tailwind-merge@3.4.0",
566
- "class-variance-authority": "class-variance-authority@0.7.1",
567
- "lucide-react": "lucide-react@0.561.0"
564
+ "clsx": "clsx",
565
+ "tailwind-merge": "tailwind-merge",
566
+ "class-variance-authority": "class-variance-authority",
567
+ "lucide-react": "lucide-react"
568
568
  };
569
569
  if (!isTailwind4) {
570
570
  requiredDeps["tailwindcss-animate"] = "tailwindcss-animate";
@@ -579,7 +579,13 @@ async function init(options) {
579
579
  } else {
580
580
  spinner.info(`Found ${chalk.cyan(missing.length)} missing ${missing.length === 1 ? "dependency" : "dependencies"}: ${chalk.dim(missing.map((d) => d.split("@")[0]).join(", "))}`);
581
581
  }
582
- async function installOneByOne(spinner2, packageManager2, installCmd2, missing2, cwd2, execSync) {
582
+ async function runCommand(command, cwd2) {
583
+ const { exec } = await import("child_process");
584
+ const { promisify } = await import("util");
585
+ const execAsync = promisify(exec);
586
+ return await execAsync(command, { cwd: cwd2 });
587
+ }
588
+ async function installOneByOne(spinner2, packageManager2, installCmd2, missing2, cwd2) {
583
589
  spinner2.warn("Batch installation failed. Attempting to install dependencies one by one...");
584
590
  let allSucceeded = true;
585
591
  const installFlags = packageManager2 === "npm" ? "--legacy-peer-deps" : "";
@@ -587,10 +593,7 @@ async function init(options) {
587
593
  spinner2.start(`Installing ${chalk.cyan(dep)} via ${packageManager2}${installFlags ? " (with --legacy-peer-deps)" : ""}...`);
588
594
  try {
589
595
  const command = installFlags ? `${packageManager2} ${installCmd2} ${installFlags} ${dep}` : `${packageManager2} ${installCmd2} ${dep}`;
590
- execSync(command, {
591
- stdio: "pipe",
592
- cwd: cwd2
593
- });
596
+ await runCommand(command, cwd2);
594
597
  spinner2.succeed(`Installed ${chalk.green(dep)}`);
595
598
  } catch (depError) {
596
599
  allSucceeded = false;
@@ -618,29 +621,22 @@ Please manually run: ${manualCmd}
618
621
  }
619
622
  }
620
623
  if (missing.length > 0) {
621
- const { execSync } = await import("child_process");
622
- spinner.text = `Installing dependencies via ${packageManager}: ${missing.join(", ")}...`;
624
+ spinner.start(`Installing dependencies via ${packageManager}: ${missing.join(", ")}...`);
623
625
  try {
624
- execSync(`${packageManager} ${installCmd} ${missing.join(" ")}`, {
625
- stdio: "pipe",
626
- cwd
627
- });
626
+ await runCommand(`${packageManager} ${installCmd} ${missing.join(" ")}`, cwd);
628
627
  spinner.succeed("Dependencies installed");
629
628
  } catch (error) {
630
629
  const stderr = error.stderr?.toString() || "";
631
630
  if (packageManager === "npm" && (stderr.includes("ERESOLVE") || stderr.includes("peer dependency") || stderr.includes("conflicting peer dependency") || stderr.includes("Cannot read properties of null"))) {
632
- spinner.text = "Batch installation failed. Retrying with --legacy-peer-deps...";
631
+ spinner.start("Batch installation failed. Retrying with --legacy-peer-deps...");
633
632
  try {
634
- execSync(`npm install --legacy-peer-deps ${missing.join(" ")}`, {
635
- stdio: "pipe",
636
- cwd
637
- });
633
+ await runCommand(`npm install --legacy-peer-deps ${missing.join(" ")}`, cwd);
638
634
  spinner.succeed("Dependencies installed (used --legacy-peer-deps)");
639
635
  } catch (retryError) {
640
- await installOneByOne(spinner, packageManager, installCmd, missing, cwd, execSync);
636
+ await installOneByOne(spinner, packageManager, installCmd, missing, cwd);
641
637
  }
642
638
  } else {
643
- await installOneByOne(spinner, packageManager, installCmd, missing, cwd, execSync);
639
+ await installOneByOne(spinner, packageManager, installCmd, missing, cwd);
644
640
  }
645
641
  }
646
642
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@srcroot/ui",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "description": "A shadcn-style CLI UI library with polymorphic, accessible React components",
5
5
  "type": "module",
6
6
  "bin": {