@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.
- package/dist/index.js +14 -4
- 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("
|
|
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
|
-
|
|
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 ${
|
|
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} ${
|
|
368
|
+
Manually run: ${cfg.packageManager} ${cfg.installCmd} ${missingDeps.join(" ")}`);
|
|
359
369
|
}
|
|
360
370
|
}
|
|
361
371
|
printSuccess() {
|