@srcroot/ui 0.0.48 → 0.0.49

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 +14 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -336,7 +336,7 @@ export function cn(...inputs: ClassValue[]) {
336
336
  }
337
337
  async installDependencies() {
338
338
  const cfg = this.config;
339
- const spinner = ora("Installing dependencies...").start();
339
+ const spinner = ora("Checking dependencies...").start();
340
340
  const deps = [
341
341
  "clsx",
342
342
  "tailwind-merge",
@@ -347,15 +347,25 @@ export function cn(...inputs: ClassValue[]) {
347
347
  deps.push("tailwindcss-animate");
348
348
  }
349
349
  try {
350
- await execa(cfg.packageManager, [cfg.installCmd, ...deps], {
350
+ const packageJsonPath = path3.join(cfg.cwd, "package.json");
351
+ const pkg = await fs3.readJson(packageJsonPath);
352
+ const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };
353
+ const missingDeps = deps.filter((dep) => !allDeps[dep]);
354
+ if (missingDeps.length === 0) {
355
+ spinner.succeed("Dependencies already installed");
356
+ return;
357
+ }
358
+ spinner.text = "Installing dependencies...";
359
+ await execa(cfg.packageManager, [cfg.installCmd, ...missingDeps], {
351
360
  cwd: cfg.cwd,
352
361
  stdio: "pipe"
353
362
  });
354
- spinner.succeed(`Installed ${deps.length} dependencies`);
363
+ spinner.succeed(`Installed ${missingDeps.length} dependencies`);
355
364
  } catch (error) {
356
365
  spinner.fail("Failed to install dependencies");
366
+ const missingDeps = deps;
357
367
  logger.warn(`
358
- Manually run: ${cfg.packageManager} ${cfg.installCmd} ${deps.join(" ")}`);
368
+ Manually run: ${cfg.packageManager} ${cfg.installCmd} ${missingDeps.join(" ")}`);
359
369
  }
360
370
  }
361
371
  printSuccess() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@srcroot/ui",
3
- "version": "0.0.48",
3
+ "version": "0.0.49",
4
4
  "description": "A UI library with polymorphic, accessible React components",
5
5
  "author": "Shifaul Islam",
6
6
  "license": "MIT",