uniqueui-cli 0.1.6 → 0.1.7

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.
@@ -91,17 +91,26 @@ async function add(componentName, options) {
91
91
  await updateTailwindConfig(config.tailwind.config, item.tailwindConfig);
92
92
  }
93
93
  // 5. Write Files
94
- const targetDir = path_1.default.resolve(config.paths.components || "components/ui");
95
- await fs_extra_1.default.ensureDir(targetDir);
96
94
  for (const file of item.files) {
97
- // We only handle ui components for now
98
95
  if (file.type === "registry:ui") {
96
+ const targetDir = path_1.default.resolve(config.paths.components || "components/ui");
97
+ await fs_extra_1.default.ensureDir(targetDir);
99
98
  const fileName = path_1.default.basename(file.path);
100
99
  const targetPath = path_1.default.join(targetDir, fileName);
101
100
  await fs_extra_1.default.writeFile(targetPath, file.content);
102
101
  console.log(chalk_1.default.green(`Created ${fileName}`));
103
102
  }
104
- // Handle utils if needed, or other types
103
+ else if (file.type === "registry:util") {
104
+ const targetDir = path_1.default.resolve(config.paths.lib || "utils");
105
+ await fs_extra_1.default.ensureDir(targetDir);
106
+ const fileName = path_1.default.basename(file.path);
107
+ const targetPath = path_1.default.join(targetDir, fileName);
108
+ // Only create util if it doesn't exist
109
+ if (!fs_extra_1.default.existsSync(targetPath)) {
110
+ await fs_extra_1.default.writeFile(targetPath, file.content);
111
+ console.log(chalk_1.default.green(`Created ${fileName}`));
112
+ }
113
+ }
105
114
  }
106
115
  }
107
116
  async function updateTailwindConfig(configPath, newConfig) {
@@ -40,19 +40,35 @@ async function init() {
40
40
  tsx: response.typescript,
41
41
  tailwind: {
42
42
  config: response.tailwindConfig,
43
- css: "app/globals.css", // simplifying assumption or could ask
43
+ css: "app/globals.css",
44
44
  baseColor: "slate",
45
45
  cssVariables: true,
46
46
  },
47
47
  aliases: {
48
48
  components: "@/components",
49
- utils: "@/lib/utils",
49
+ utils: "@/utils",
50
50
  },
51
51
  paths: {
52
52
  components: response.componentsDir,
53
- lib: "lib" // simplifying
53
+ lib: "utils"
54
54
  }
55
55
  };
56
56
  await fs_1.promises.writeFile(path_1.default.join(cwd, "components.json"), JSON.stringify(config, null, 2));
57
+ // Create utils/cn.ts if it doesn't exist
58
+ const utilsDir = path_1.default.join(cwd, "utils");
59
+ const cnPath = path_1.default.join(utilsDir, "cn.ts");
60
+ const cnContent = `import { type ClassValue, clsx } from "clsx";
61
+ import { twMerge } from "tailwind-merge";
62
+
63
+ export function cn(...inputs: ClassValue[]) {
64
+ return twMerge(clsx(inputs));
65
+ }`;
66
+ if (!(await fs_1.promises.stat(utilsDir).catch(() => null))) {
67
+ await fs_1.promises.mkdir(utilsDir, { recursive: true });
68
+ }
69
+ if (!(await fs_1.promises.stat(cnPath).catch(() => null))) {
70
+ await fs_1.promises.writeFile(cnPath, cnContent);
71
+ console.log(chalk_1.default.green("Created utils/cn.ts"));
72
+ }
57
73
  console.log(chalk_1.default.green("Configuration saved to components.json"));
58
74
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uniqueui-cli",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "CLI to add beautiful animated UI components from UniqueUI to your React project",
5
5
  "main": "dist/index.js",
6
6
  "bin": {