Skip to content

Commit 8a2564a

Browse files
committed
feat: update dependencies, improve CLI utility creation, and enhance CreativePricing component styling
1 parent cecd592 commit 8a2564a

File tree

5 files changed

+51
-28
lines changed

5 files changed

+51
-28
lines changed

registry-cli.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,11 @@
130130
"name": "future-navbar",
131131
"type": "registry:component",
132132
"devDependencies": [],
133-
"dependencies": ["lucide-react", "class-variance-authority"],
133+
"dependencies": [
134+
"lucide-react",
135+
"class-variance-authority",
136+
"@left4code/svg-renderer"
137+
],
134138
"registryDependencies": [],
135139
"files": [
136140
{
@@ -470,7 +474,6 @@
470474
}
471475
]
472476
},
473-
474477

475478
{
476479
"name": "playing-card",
@@ -1020,4 +1023,4 @@
10201023
]
10211024
}
10221025
]
1023-
}
1026+
}

src/cli/bin/index.js

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,13 @@ try {
135135
process.exit(1);
136136
}
137137

138+
const hasSrc = fs.existsSync(path.join(process.cwd(), "src"));
139+
const baseLibDir = hasSrc
140+
? path.join(process.cwd(), "src", "lib")
141+
: path.join(process.cwd(), "lib");
142+
138143
const cnContent = {
139-
ts: `import { ClassValue, clsx } from "clsx";
144+
ts: `import { type ClassValue, clsx } from "clsx";
140145
import { twMerge } from "tailwind-merge";
141146
142147
export function cn(...inputs: ClassValue[]) {
@@ -150,16 +155,22 @@ try {
150155
}`,
151156
};
152157

153-
const utilsPath = path.join(process.cwd(), "lib");
154158
const cnPath = path.join(
155-
utilsPath,
159+
baseLibDir,
156160
`utils.${language === "js" ? "js" : "ts"}`,
157161
);
158162

163+
let utilsCreated = false;
164+
// Create utils file if it doesn't exist
159165
if (!fs.existsSync(cnPath)) {
160-
await fs.promises.mkdir(utilsPath, { recursive: true });
166+
await fs.promises.mkdir(baseLibDir, { recursive: true });
161167
await fs.promises.writeFile(cnPath, cnContent[language], "utf8");
162-
console.log(colors.green(`🛠️ Created lib/utils${language}`));
168+
console.log(
169+
colors.green(
170+
`🛠️ Created ${hasSrc ? "src/lib" : "lib"}/utils.${language}`,
171+
),
172+
);
173+
utilsCreated = true;
163174
}
164175

165176
for (const file of match.files) {
@@ -171,19 +182,28 @@ try {
171182
if (match?.dependencies?.length) {
172183
const pm = detectPackageManager();
173184
const s2 = spinner();
174-
s2.start(
175-
`📦 Installing dependencies with ${pm}: ${match.dependencies.join(", ")}`,
176-
);
177185

178-
const cmd = ["add", ...match.dependencies];
179-
const fallback = ["install", ...match.dependencies];
186+
const deps = [...(match.dependencies || [])];
187+
if (utilsCreated) {
188+
deps.push("clsx", "tailwind-merge");
189+
}
180190

181-
try {
182-
await execa(pm, pm === "npm" ? fallback : cmd, { stdio: "inherit" });
183-
s2.stop(colors.green("✅ Dependencies installed."));
184-
} catch (err) {
185-
s2.stop(colors.red("❌ Failed to install dependencies."));
186-
console.error(err);
191+
if (deps.length > 0) {
192+
const uniqueDeps = [...new Set(deps)];
193+
s2.start(
194+
`📦 Installing dependencies with ${pm}: ${uniqueDeps.join(", ")}`,
195+
);
196+
197+
const cmd = ["add", ...uniqueDeps];
198+
const fallback = ["install", ...uniqueDeps];
199+
200+
try {
201+
await execa(pm, pm === "npm" ? fallback : cmd, { stdio: "inherit" });
202+
s2.stop(colors.green("✅ Dependencies installed."));
203+
} catch (err) {
204+
s2.stop(colors.red("❌ Failed to install dependencies."));
205+
console.error(err);
206+
}
187207
}
188208
}
189209

src/cli/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nurui",
3-
"version": "1.0.10",
3+
"version": "1.0.11",
44
"description": "Add beautiful components with one command",
55
"bin": {
66
"nurui": "./bin/index.js"

src/components/nurui/creative-pricing.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ function CreativePricing({
2525
}) {
2626
return (
2727
<div className="w-full max-w-6xl mx-auto px-4">
28-
<div className="text-center space-y-6 mb-16">
29-
<div className="font-handwritten text-xl text-blue-500 rotate-[-1deg]">
28+
<div className="text-center space-y-6 mb-6 lg:mb-16">
29+
<div className="font-handwritten text-xl text-blue-500 rotate-[-1deg] hidden lg:block">
3030
{tag}
3131
</div>
3232
<div className="relative">
33-
<h2 className="text-4xl md:text-5xl font-bold font-handwritten text-zinc-900 dark:text-white rotate-[-1deg]">
33+
<h2 className="text-2xl md:text-5xl font-bold font-handwritten text-zinc-900 dark:text-white rotate-[-1deg]">
3434
{title}
35-
<div className="absolute -right-12 top-0 text-amber-500 rotate-12">
35+
<div className="absolute -right-12 top-0 text-amber-500 rotate-12 hidden lg:block">
3636
3737
</div>
38-
<div className="absolute -left-8 bottom-0 text-blue-500 -rotate-12">
38+
<div className="absolute -left-8 bottom-0 text-blue-500 -rotate-12 hidden lg:block">
3939
⭐️
4040
</div>
4141
</h2>
@@ -156,7 +156,7 @@ function CreativePricing({
156156
</div>
157157
))}
158158
</div>
159-
<div className="absolute -z-10 inset-0 overflow-hidden">
159+
<div className="absolute -z-10 inset-0 overflow-hidden hidden lg:block">
160160
<div className="absolute top-40 left-20 text-4xl rotate-12"></div>
161161
<div className="absolute bottom-40 right-20 text-4xl -rotate-12">
162162
✏️

0 commit comments

Comments
 (0)