uniqueui-cli 0.1.6 → 0.1.8
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/commands/add.js +13 -4
- package/dist/commands/init.js +19 -3
- package/dist/index.js +4 -1
- package/package.json +2 -2
package/dist/commands/add.js
CHANGED
|
@@ -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
|
-
|
|
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) {
|
package/dist/commands/init.js
CHANGED
|
@@ -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",
|
|
43
|
+
css: "app/globals.css",
|
|
44
44
|
baseColor: "slate",
|
|
45
45
|
cssVariables: true,
|
|
46
46
|
},
|
|
47
47
|
aliases: {
|
|
48
48
|
components: "@/components",
|
|
49
|
-
utils: "@/
|
|
49
|
+
utils: "@/utils",
|
|
50
50
|
},
|
|
51
51
|
paths: {
|
|
52
52
|
components: response.componentsDir,
|
|
53
|
-
lib: "
|
|
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/dist/index.js
CHANGED
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const commander_1 = require("commander");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const path_1 = require("path");
|
|
5
7
|
const init_1 = require("./commands/init");
|
|
6
8
|
const add_1 = require("./commands/add");
|
|
9
|
+
const pkg = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(__dirname, "../package.json"), "utf-8"));
|
|
7
10
|
const program = new commander_1.Command();
|
|
8
11
|
program
|
|
9
12
|
.name("uniqueui")
|
|
10
13
|
.description("Add components from UniqueUI to your project")
|
|
11
|
-
.version(
|
|
14
|
+
.version(pkg.version);
|
|
12
15
|
program
|
|
13
16
|
.command("init")
|
|
14
17
|
.description("Configure your project for UniqueUI")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uniqueui-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
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": {
|
|
@@ -59,4 +59,4 @@
|
|
|
59
59
|
"@types/prompts": "^2.4.9",
|
|
60
60
|
"typescript": "^5.3.3"
|
|
61
61
|
}
|
|
62
|
-
}
|
|
62
|
+
}
|