@srcroot/ui 0.0.21 → 0.0.22

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 +21 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1009,10 +1009,16 @@ async function add(components, options) {
1009
1009
  resolveDeps(comp);
1010
1010
  }
1011
1011
  const componentsToAdd = Array.from(toInstall);
1012
- console.log(chalk2.cyan("\n\u{1F4E6} Adding components:\n"));
1013
- componentsToAdd.forEach((name) => {
1014
- console.log(chalk2.dim(` - ${name}`));
1015
- });
1012
+ if (componentsToAdd.length > 10) {
1013
+ console.log(chalk2.cyan(`
1014
+ \u{1F4E6} Adding ${componentsToAdd.length} components...
1015
+ `));
1016
+ } else {
1017
+ console.log(chalk2.cyan("\n\u{1F4E6} Adding components:\n"));
1018
+ componentsToAdd.forEach((name) => {
1019
+ console.log(chalk2.dim(` - ${name}`));
1020
+ });
1021
+ }
1016
1022
  console.log();
1017
1023
  if (!options.yes) {
1018
1024
  const response = await prompts2({
@@ -1027,14 +1033,18 @@ async function add(components, options) {
1027
1033
  }
1028
1034
  }
1029
1035
  const spinner = ora2("Adding components...").start();
1030
- const componentsDir = path2.join(cwd, "src", "components", "ui");
1036
+ const hasSrc = fs2.existsSync(path2.join(cwd, "src"));
1037
+ const srcPath = hasSrc ? path2.join(cwd, "src") : cwd;
1038
+ const componentsDir = path2.join(srcPath, "components", "ui");
1031
1039
  try {
1032
1040
  await fs2.ensureDir(componentsDir);
1033
1041
  for (const name of componentsToAdd) {
1034
1042
  const comp = REGISTRY[name];
1035
1043
  const targetPath = path2.join(componentsDir, comp.file);
1036
1044
  if (fs2.existsSync(targetPath) && !options.overwrite) {
1037
- spinner.info(`${chalk2.cyan(comp.file)} already exists, skipping (use --overwrite to replace)`);
1045
+ if (componentsToAdd.length <= 10) {
1046
+ spinner.info(`${chalk2.cyan(comp.file)} already exists, skipping`);
1047
+ }
1038
1048
  continue;
1039
1049
  }
1040
1050
  const registryPath = path2.resolve(__dirname3, "..", "registry", comp.file);
@@ -1044,7 +1054,11 @@ async function add(components, options) {
1044
1054
  }
1045
1055
  const content = await fs2.readFile(registryPath, "utf-8");
1046
1056
  await fs2.writeFile(targetPath, content);
1047
- spinner.succeed(`Added ${chalk2.cyan(comp.file)}`);
1057
+ if (componentsToAdd.length > 10) {
1058
+ spinner.text = `Added ${chalk2.cyan(comp.file)}`;
1059
+ } else {
1060
+ spinner.succeed(`Added ${chalk2.cyan(comp.file)}`);
1061
+ }
1048
1062
  }
1049
1063
  console.log(chalk2.green("\n\u2705 Components added successfully!\n"));
1050
1064
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@srcroot/ui",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "description": "A shadcn-style CLI UI library with polymorphic, accessible React components",
5
5
  "type": "module",
6
6
  "bin": {