@creative-tim/ui 0.4.0-beta ā 0.4.0
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/README.md +244 -13
- package/dist/index.js +43 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,11 +17,29 @@ Built by [Creative Tim](https://creative-tim.com) - Based on shadcn/ui registry
|
|
|
17
17
|
|
|
18
18
|
## Installation
|
|
19
19
|
|
|
20
|
+
### Quick Start
|
|
21
|
+
|
|
20
22
|
```bash
|
|
23
|
+
# Initialize Creative Tim UI in your project
|
|
21
24
|
npx @creative-tim/ui@latest init
|
|
25
|
+
|
|
26
|
+
# Add your first component
|
|
22
27
|
npx @creative-tim/ui@latest add button
|
|
23
28
|
```
|
|
24
29
|
|
|
30
|
+
### Install Specific Version
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Install the latest stable version
|
|
34
|
+
npx @creative-tim/ui@latest add button
|
|
35
|
+
|
|
36
|
+
# Install the beta version
|
|
37
|
+
npx @creative-tim/ui@beta add button
|
|
38
|
+
|
|
39
|
+
# Install a specific version
|
|
40
|
+
npx @creative-tim/ui@0.4.0 add button
|
|
41
|
+
```
|
|
42
|
+
|
|
25
43
|
## Usage
|
|
26
44
|
|
|
27
45
|
### Initialize your project
|
|
@@ -56,44 +74,141 @@ npx @creative-tim/ui@latest add testimonials-01
|
|
|
56
74
|
- `-p, --path <path>` - Specify installation path
|
|
57
75
|
- `--api-key <key>` - API key for accessing private components
|
|
58
76
|
|
|
59
|
-
## Authentication
|
|
77
|
+
## Premium Blocks Authentication
|
|
60
78
|
|
|
61
|
-
Some components are
|
|
79
|
+
Some blocks and components are **premium** and require authentication. These include advanced testimonial sections, pricing tables, and specialized UI components.
|
|
62
80
|
|
|
63
|
-
###
|
|
81
|
+
### How to Get Your API Key
|
|
82
|
+
|
|
83
|
+
1. Visit [Creative Tim Dashboard](https://creative-tim.com/dashboard)
|
|
84
|
+
2. Navigate to **API Keys** section
|
|
85
|
+
3. Copy your API key (starts with `pk_live_`)
|
|
86
|
+
|
|
87
|
+
### Authentication Methods
|
|
88
|
+
|
|
89
|
+
#### 1. Environment Variable (Recommended for Development)
|
|
90
|
+
|
|
91
|
+
Set the environment variable in your shell:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# macOS/Linux
|
|
95
|
+
export CREATIVE_TIM_UI_API_KEY=pk_live_your_key
|
|
96
|
+
|
|
97
|
+
# Windows (PowerShell)
|
|
98
|
+
$env:CREATIVE_TIM_UI_API_KEY="pk_live_your_key"
|
|
99
|
+
|
|
100
|
+
# Windows (CMD)
|
|
101
|
+
set CREATIVE_TIM_UI_API_KEY=pk_live_your_key
|
|
102
|
+
```
|
|
64
103
|
|
|
104
|
+
Then install components normally:
|
|
65
105
|
```bash
|
|
66
|
-
export CREATIVE_TIM_API_KEY=pk_live_your_key
|
|
67
106
|
npx @creative-tim/ui@latest add testimonials-06
|
|
68
107
|
```
|
|
69
108
|
|
|
70
|
-
|
|
109
|
+
Or set it inline:
|
|
110
|
+
```bash
|
|
111
|
+
CREATIVE_TIM_UI_API_KEY=pk_live_your_key npx @creative-tim/ui@latest add testimonials-06
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
#### 2. Config File (Recommended for Teams/CI/CD)
|
|
71
115
|
|
|
72
116
|
Add authentication to your `components.json`:
|
|
73
117
|
|
|
74
118
|
```json
|
|
75
119
|
{
|
|
76
|
-
"
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
120
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
121
|
+
"style": "new-york",
|
|
122
|
+
"rsc": true,
|
|
123
|
+
"tsx": true,
|
|
124
|
+
"tailwind": {
|
|
125
|
+
"config": "tailwind.config.ts",
|
|
126
|
+
"css": "app/globals.css",
|
|
127
|
+
"baseColor": "zinc",
|
|
128
|
+
"cssVariables": true,
|
|
129
|
+
"prefix": ""
|
|
130
|
+
},
|
|
131
|
+
"aliases": {
|
|
132
|
+
"components": "@/components",
|
|
133
|
+
"utils": "@/lib/utils",
|
|
134
|
+
"ui": "@/components/ui",
|
|
135
|
+
"lib": "@/lib",
|
|
136
|
+
"hooks": "@/hooks"
|
|
137
|
+
},
|
|
138
|
+
"registries": {
|
|
139
|
+
"@creative-tim": {
|
|
140
|
+
"url": "https://www.creative-tim.com/ui/r/{name}.json",
|
|
141
|
+
"headers": {
|
|
142
|
+
"Authorization": "Bearer ${CREATIVE_TIM_UI_API_KEY}"
|
|
143
|
+
}
|
|
80
144
|
}
|
|
81
145
|
}
|
|
82
146
|
}
|
|
83
147
|
```
|
|
84
148
|
|
|
85
|
-
|
|
149
|
+
**Benefits:**
|
|
150
|
+
- Team members can use their own API keys
|
|
151
|
+
- Works seamlessly in CI/CD pipelines
|
|
152
|
+
- No need to pass `--api-key` flag every time
|
|
153
|
+
- Supports environment variable expansion (`${VAR_NAME}`)
|
|
154
|
+
|
|
155
|
+
Then use with the environment variable:
|
|
86
156
|
```bash
|
|
87
|
-
|
|
157
|
+
CREATIVE_TIM_UI_API_KEY=pk_live_your_key npx @creative-tim/ui@latest add testimonials-06
|
|
88
158
|
```
|
|
89
159
|
|
|
90
|
-
|
|
160
|
+
#### 3. Command Flag (Quick Testing)
|
|
161
|
+
|
|
162
|
+
Pass the API key directly via command line:
|
|
91
163
|
|
|
92
164
|
```bash
|
|
93
165
|
npx @creative-tim/ui@latest add testimonials-06 --api-key pk_live_your_key
|
|
94
166
|
```
|
|
95
167
|
|
|
96
|
-
**
|
|
168
|
+
**Use this for:**
|
|
169
|
+
- Quick testing
|
|
170
|
+
- One-off installations
|
|
171
|
+
- When you don't want to configure environment variables
|
|
172
|
+
|
|
173
|
+
### CI/CD Setup
|
|
174
|
+
|
|
175
|
+
For GitHub Actions, GitLab CI, or other CI/CD systems:
|
|
176
|
+
|
|
177
|
+
**GitHub Actions:**
|
|
178
|
+
```yaml
|
|
179
|
+
- name: Install Premium Blocks
|
|
180
|
+
env:
|
|
181
|
+
CREATIVE_TIM_UI_API_KEY: ${{ secrets.CREATIVE_TIM_UI_API_KEY }}
|
|
182
|
+
run: npx @creative-tim/ui@latest add testimonials-06
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**GitLab CI:**
|
|
186
|
+
```yaml
|
|
187
|
+
install:
|
|
188
|
+
script:
|
|
189
|
+
- export CREATIVE_TIM_UI_API_KEY=$CREATIVE_TIM_UI_API_KEY
|
|
190
|
+
- npx @creative-tim/ui@latest add testimonials-06
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Premium vs Free Components
|
|
194
|
+
|
|
195
|
+
| Type | Authentication | Examples |
|
|
196
|
+
|------|----------------|----------|
|
|
197
|
+
| **Free Components** | ā Not required | `button`, `card`, `avatar`, `testimonials-01` |
|
|
198
|
+
| **Premium Blocks** | ā
Required | `testimonials-06`, `pricing-05`, `hero-07` |
|
|
199
|
+
|
|
200
|
+
### Troubleshooting
|
|
201
|
+
|
|
202
|
+
**Error: 401 Unauthorized**
|
|
203
|
+
- Check your API key is valid
|
|
204
|
+
- Ensure environment variable is set correctly
|
|
205
|
+
- Verify you're using `CREATIVE_TIM_UI_API_KEY` (not `CREATIVE_TIM_API_KEY`)
|
|
206
|
+
|
|
207
|
+
**Error: 403 Forbidden**
|
|
208
|
+
- Your API key doesn't have access to this premium component
|
|
209
|
+
- Verify your subscription status at [Creative Tim Dashboard](https://creative-tim.com/dashboard)
|
|
210
|
+
|
|
211
|
+
**Note:** Never commit your API key directly in `components.json`. Always use environment variables!
|
|
97
212
|
|
|
98
213
|
## Component Types
|
|
99
214
|
|
|
@@ -115,6 +230,122 @@ npx @creative-tim/ui@latest add testimonials-01
|
|
|
115
230
|
npx @creative-tim/ui@latest add web3-02
|
|
116
231
|
```
|
|
117
232
|
|
|
233
|
+
All available components can be found [here](https://creative-tim.com/ui/docs/components) or explore a list of example blocks [here](https://creative-tim.com/ui/blocks).
|
|
234
|
+
|
|
235
|
+
Explore our collection of ready-to-use blocks organized by category. Each block is fully customizable and can be added to your project with a single command.
|
|
236
|
+
|
|
237
|
+
### Application UI
|
|
238
|
+
|
|
239
|
+
<table>
|
|
240
|
+
<tr>
|
|
241
|
+
<td width="25%">
|
|
242
|
+
<a href="https://creative-tim.com/ui/blocks/modals">
|
|
243
|
+
<img src="https://raw.githubusercontent.com/creativetimofficial/public-assets/refs/heads/master/david-ui/thumbs/modals-thumbnail.jpg" alt="Modals" />
|
|
244
|
+
<br/>
|
|
245
|
+
<strong>Modals</strong><br/>
|
|
246
|
+
<em>5 Blocks</em>
|
|
247
|
+
</a>
|
|
248
|
+
</td>
|
|
249
|
+
<td width="25%">
|
|
250
|
+
<a href="https://creative-tim.com/ui/blocks/account">
|
|
251
|
+
<img src="https://raw.githubusercontent.com/creativetimofficial/public-assets/refs/heads/master/david-ui/thumbs/account-thumbnail.jpg" alt="Account" />
|
|
252
|
+
<br/>
|
|
253
|
+
<strong>Account</strong><br/>
|
|
254
|
+
<em>7 Blocks</em>
|
|
255
|
+
</a>
|
|
256
|
+
</td>
|
|
257
|
+
<td width="25%">
|
|
258
|
+
<a href="https://creative-tim.com/ui/blocks/billing">
|
|
259
|
+
<img src="https://raw.githubusercontent.com/creativetimofficial/public-assets/refs/heads/master/david-ui/thumbs/billing-thumbnail.jpg" alt="Billing" />
|
|
260
|
+
<br/>
|
|
261
|
+
<strong>Billing</strong><br/>
|
|
262
|
+
<em>5 Blocks</em>
|
|
263
|
+
</a>
|
|
264
|
+
</td>
|
|
265
|
+
</tr>
|
|
266
|
+
</table>
|
|
267
|
+
|
|
268
|
+
### Marketing
|
|
269
|
+
|
|
270
|
+
<table>
|
|
271
|
+
<tr>
|
|
272
|
+
<td width="25%">
|
|
273
|
+
<a href="https://creative-tim.com/ui/blocks/testimonials">
|
|
274
|
+
<img src="https://raw.githubusercontent.com/creativetimofficial/public-assets/refs/heads/master/david-ui/thumbs/testimonial-thumbnail.jpg" alt="Testimonial Sections" />
|
|
275
|
+
<br/>
|
|
276
|
+
<strong>Testimonial Sections</strong><br/>
|
|
277
|
+
<em>17 Blocks</em>
|
|
278
|
+
</a>
|
|
279
|
+
</td>
|
|
280
|
+
<td width="25%">
|
|
281
|
+
<a href="https://creative-tim.com/ui/blocks/contact">
|
|
282
|
+
<img src="https://raw.githubusercontent.com/creativetimofficial/public-assets/refs/heads/master/david-ui/thumbs/contact-us-thumbnail.jpg" alt="Contact Sections" />
|
|
283
|
+
<br/>
|
|
284
|
+
<strong>Contact Sections</strong><br/>
|
|
285
|
+
<em>15 Blocks</em>
|
|
286
|
+
</a>
|
|
287
|
+
</td>
|
|
288
|
+
<td width="25%">
|
|
289
|
+
<a href="https://creative-tim.com/ui/blocks/footers">
|
|
290
|
+
<img src="https://raw.githubusercontent.com/creativetimofficial/public-assets/refs/heads/master/david-ui/thumbs/footer-thumbnail.jpg" alt="Footers" />
|
|
291
|
+
<br/>
|
|
292
|
+
<strong>Footers</strong><br/>
|
|
293
|
+
<em>16 Blocks</em>
|
|
294
|
+
</a>
|
|
295
|
+
</td>
|
|
296
|
+
</tr>
|
|
297
|
+
<tr>
|
|
298
|
+
<td width="25%">
|
|
299
|
+
<a href="https://creative-tim.com/ui/blocks/faqs">
|
|
300
|
+
<img src="https://raw.githubusercontent.com/creativetimofficial/public-assets/refs/heads/master/david-ui/thumbs/faq-thumbnail.jpg" alt="FAQs" />
|
|
301
|
+
<br/>
|
|
302
|
+
<strong>FAQs</strong><br/>
|
|
303
|
+
<em>6 Blocks</em>
|
|
304
|
+
</a>
|
|
305
|
+
</td>
|
|
306
|
+
<td width="25%">
|
|
307
|
+
<a href="https://creative-tim.com/ui/blocks/blog">
|
|
308
|
+
<img src="https://raw.githubusercontent.com/creativetimofficial/public-assets/refs/heads/master/david-ui/thumbs/blog-posts-thumbnail.jpg" alt="Blog" />
|
|
309
|
+
<br/>
|
|
310
|
+
<strong>Blog</strong><br/>
|
|
311
|
+
<em>15 Blocks</em>
|
|
312
|
+
</a>
|
|
313
|
+
</td>
|
|
314
|
+
</tr>
|
|
315
|
+
</table>
|
|
316
|
+
|
|
317
|
+
### Ecommerce UI
|
|
318
|
+
Ready-to-use blocks for product listings, shopping carts, and checkout flows.
|
|
319
|
+
|
|
320
|
+
<table>
|
|
321
|
+
<tr>
|
|
322
|
+
<td width="25%">
|
|
323
|
+
<a href="https://creative-tim.com/ui/blocks/ecommerce">
|
|
324
|
+
<img src="https://raw.githubusercontent.com/creativetimofficial/public-assets/refs/heads/master/david-ui/thumbs/ecommerce-thumbnail.jpg" alt="Ecommerce Sections" />
|
|
325
|
+
<br/>
|
|
326
|
+
<strong>Ecommerce Sections</strong><br/>
|
|
327
|
+
<em>14 Blocks</em>
|
|
328
|
+
</a>
|
|
329
|
+
</td>
|
|
330
|
+
</tr>
|
|
331
|
+
</table>
|
|
332
|
+
|
|
333
|
+
### Web 3.0
|
|
334
|
+
Innovative sections built for decentralized applications, blockchain projects, and crypto platforms.
|
|
335
|
+
|
|
336
|
+
<table>
|
|
337
|
+
<tr>
|
|
338
|
+
<td width="25%">
|
|
339
|
+
<a href="https://creative-tim.com/ui/blocks/web3">
|
|
340
|
+
<img src="https://raw.githubusercontent.com/creativetimofficial/public-assets/refs/heads/master/david-ui/thumbs/collections-thumbnail.jpg" alt="Web 3.0 Cards" />
|
|
341
|
+
<br/>
|
|
342
|
+
<strong>Web 3.0 Cards</strong><br/>
|
|
343
|
+
<em>5 Blocks</em>
|
|
344
|
+
</a>
|
|
345
|
+
</td>
|
|
346
|
+
</tr>
|
|
347
|
+
</table>
|
|
348
|
+
|
|
118
349
|
## Documentation
|
|
119
350
|
|
|
120
351
|
Visit [creative-tim.com/ui](https://creative-tim.com/ui/docs) for complete documentation.
|
package/dist/index.js
CHANGED
|
@@ -128,6 +128,22 @@ function getAuthHeaders(cwd, opts) {
|
|
|
128
128
|
return headers;
|
|
129
129
|
}
|
|
130
130
|
const config = loadConfig(cwd);
|
|
131
|
+
if (config?.registries?.["@creative-tim"]) {
|
|
132
|
+
const registry = config.registries["@creative-tim"];
|
|
133
|
+
if (registry.headers) {
|
|
134
|
+
for (const [key, value] of Object.entries(registry.headers)) {
|
|
135
|
+
if (typeof value === "string") {
|
|
136
|
+
const expandedValue = expandEnvVars(value);
|
|
137
|
+
if (expandedValue) {
|
|
138
|
+
headers[key] = expandedValue;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (Object.keys(headers).length > 1) {
|
|
143
|
+
return headers;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
131
147
|
if (config?.registry) {
|
|
132
148
|
if (typeof config.registry === "object" && config.registry.headers) {
|
|
133
149
|
const configHeaders = config.registry.headers;
|
|
@@ -144,8 +160,8 @@ function getAuthHeaders(cwd, opts) {
|
|
|
144
160
|
}
|
|
145
161
|
}
|
|
146
162
|
}
|
|
147
|
-
if (process.env.
|
|
148
|
-
headers["Authorization"] = `Bearer ${process.env.
|
|
163
|
+
if (process.env.CREATIVE_TIM_UI_API_KEY) {
|
|
164
|
+
headers["Authorization"] = `Bearer ${process.env.CREATIVE_TIM_UI_API_KEY}`;
|
|
149
165
|
}
|
|
150
166
|
return headers;
|
|
151
167
|
}
|
|
@@ -160,10 +176,22 @@ var addCommand = new Command().name("add").description("Add a component or block
|
|
|
160
176
|
}
|
|
161
177
|
const cwd = path2.resolve(opts.cwd || process.cwd());
|
|
162
178
|
console.log(pc.cyan("\n\u{1F4E6} Adding components to your project...\n"));
|
|
179
|
+
const results = [];
|
|
163
180
|
for (const component of components) {
|
|
164
|
-
await addComponent(component, cwd, opts);
|
|
181
|
+
const success = await addComponent(component, cwd, opts);
|
|
182
|
+
results.push(success);
|
|
183
|
+
}
|
|
184
|
+
const successCount = results.filter((r) => r).length;
|
|
185
|
+
const failCount = results.filter((r) => !r).length;
|
|
186
|
+
if (successCount > 0 && failCount === 0) {
|
|
187
|
+
console.log(pc.green("\n\u2713 Components added successfully!\n"));
|
|
188
|
+
} else if (successCount > 0 && failCount > 0) {
|
|
189
|
+
console.log(pc.yellow(`
|
|
190
|
+
\u26A0 ${successCount} component(s) added, ${failCount} failed
|
|
191
|
+
`));
|
|
192
|
+
} else if (failCount > 0) {
|
|
193
|
+
console.log(pc.red("\n\u2716 No components were added\n"));
|
|
165
194
|
}
|
|
166
|
-
console.log(pc.green("\n\u2713 Components added successfully!\n"));
|
|
167
195
|
});
|
|
168
196
|
async function addComponent(name, cwd, opts) {
|
|
169
197
|
const spinner = ora(`Fetching ${pc.cyan(name)}...`).start();
|
|
@@ -184,21 +212,23 @@ async function addComponent(name, cwd, opts) {
|
|
|
184
212
|
}
|
|
185
213
|
console.log(pc.dim(`
|
|
186
214
|
This is a private component. Provide an API key using:`));
|
|
187
|
-
console.log(pc.dim(` 1. Environment variable:
|
|
215
|
+
console.log(pc.dim(` 1. Environment variable: CREATIVE_TIM_UI_API_KEY=your_key`));
|
|
188
216
|
console.log(pc.dim(` 2. Config file (components.json):`));
|
|
189
|
-
console.log(pc.dim(` "
|
|
190
|
-
console.log(pc.dim(` "
|
|
191
|
-
console.log(pc.dim(`
|
|
192
|
-
console.log(pc.dim(` "
|
|
217
|
+
console.log(pc.dim(` "registries": {`));
|
|
218
|
+
console.log(pc.dim(` "@creative-tim": {`));
|
|
219
|
+
console.log(pc.dim(` "url": "https://www.creative-tim.com/ui/r/{name}.json",`));
|
|
220
|
+
console.log(pc.dim(` "headers": {`));
|
|
221
|
+
console.log(pc.dim(` "Authorization": "Bearer \${CREATIVE_TIM_UI_API_KEY}"`));
|
|
222
|
+
console.log(pc.dim(` }`));
|
|
193
223
|
console.log(pc.dim(` }`));
|
|
194
224
|
console.log(pc.dim(` }`));
|
|
195
225
|
console.log(pc.dim(` 3. Command flag: --api-key YOUR_KEY
|
|
196
226
|
`));
|
|
197
|
-
return;
|
|
227
|
+
return false;
|
|
198
228
|
}
|
|
199
229
|
spinner.fail(`Component ${pc.cyan(name)} not found`);
|
|
200
230
|
console.log(pc.dim(` Tried: ${url}`));
|
|
201
|
-
return;
|
|
231
|
+
return false;
|
|
202
232
|
}
|
|
203
233
|
const data = await response.json();
|
|
204
234
|
spinner.text = `Installing ${pc.cyan(name)}...`;
|
|
@@ -232,9 +262,11 @@ async function addComponent(name, cwd, opts) {
|
|
|
232
262
|
}
|
|
233
263
|
}
|
|
234
264
|
spinner.succeed(`Added ${pc.cyan(name)}`);
|
|
265
|
+
return true;
|
|
235
266
|
} catch (error) {
|
|
236
267
|
spinner.fail(`Failed to add ${pc.cyan(name)}`);
|
|
237
268
|
console.error(pc.red(` ${error.message}`));
|
|
269
|
+
return false;
|
|
238
270
|
}
|
|
239
271
|
}
|
|
240
272
|
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/commands/add.ts","../src/utils/project.ts","../src/commands/init.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Command } from \"commander\"\nimport pc from \"picocolors\"\nimport { addCommand } from \"./commands/add.js\"\nimport { initCommand } from \"./commands/init.js\"\nimport { readFileSync } from \"fs\"\nimport { fileURLToPath } from \"url\"\nimport { dirname, join } from \"path\"\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = dirname(__filename)\n\n// Read version from package.json\nlet packageVersion = \"0.1.0\"\ntry {\n const packageJsonPath = join(__dirname, \"../package.json\")\n const packageJsonContent = readFileSync(packageJsonPath, \"utf-8\")\n const packageJson = JSON.parse(packageJsonContent)\n packageVersion = packageJson.version\n} catch (error) {\n // Fallback to default version\n}\n\nasync function main() {\n const program = new Command()\n .name(\"creative-tim-ui\")\n .description(\"A CLI for adding Creative Tim UI components to your project\")\n .version(\n packageVersion,\n \"-v, --version\",\n \"display the version number\"\n )\n\n program\n .addCommand(initCommand)\n .addCommand(addCommand)\n\n program.parse()\n}\n\nmain().catch((error) => {\n console.error(pc.red(\"Error:\"), error.message)\n process.exit(1)\n})\n\n","import { Command } from \"commander\"\nimport pc from \"picocolors\"\nimport ora from \"ora\"\nimport path from \"path\"\nimport fs from \"fs-extra\"\nimport fetch from \"node-fetch\"\nimport { detectProject, adjustPathForProject, loadConfig } from \"../utils/project.js\"\n\nconst REGISTRY_URL = \"https://creative-tim.com/ui/r\"\n\n/**\n * Expand environment variables in a string (e.g., \"${API_KEY}\" -> actual value)\n * Supports environment variable substitution in configuration values\n */\nfunction expandEnvVars(value: string): string {\n return value.replace(/\\$\\{([^}]+)\\}/g, (_, varName) => {\n return process.env[varName] || \"\"\n })\n}\n\n/**\n * Get authentication headers from multiple sources (priority order):\n * 1. Command line option --api-key\n * 2. components.json registry.headers configuration (with env var expansion)\n * 3. Environment variable CREATIVE_TIM_API_KEY\n *\n * Supports all auth methods that the API accepts: Authorization Bearer, x-api-key, etc.\n */\nfunction getAuthHeaders(cwd: string, opts: any): Record<string, string> {\n const headers: Record<string, string> = {\n 'Accept': 'application/json',\n }\n\n // 1. Check command line option (highest priority)\n if (opts.apiKey) {\n headers['Authorization'] = `Bearer ${opts.apiKey}`\n return headers\n }\n\n // 2. Check components.json for registry configuration with headers\n const config = loadConfig(cwd)\n if (config?.registry) {\n // Check if registry is an object with headers\n if (typeof config.registry === 'object' && config.registry.headers) {\n const configHeaders = config.registry.headers\n for (const [key, value] of Object.entries(configHeaders)) {\n if (typeof value === 'string') {\n const expandedValue = expandEnvVars(value)\n if (expandedValue) { // Only add header if value is not empty\n headers[key] = expandedValue\n }\n }\n }\n // If we found headers, return them\n if (Object.keys(headers).length > 1) { // More than just Accept\n return headers\n }\n }\n }\n\n // 3. Fallback to environment variable\n if (process.env.CREATIVE_TIM_API_KEY) {\n headers['Authorization'] = `Bearer ${process.env.CREATIVE_TIM_API_KEY}`\n }\n\n return headers\n}\n\ninterface RegistryItem {\n name: string\n type: string\n files: Array<{\n path: string\n content: string\n type: string\n target?: string\n }>\n dependencies?: string[]\n registryDependencies?: string[]\n}\n\nexport const addCommand = new Command()\n .name(\"add\")\n .description(\"Add a component or block to your project\")\n .argument(\"[components...]\", \"The components to add\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .option(\"-o, --overwrite\", \"Overwrite existing files\")\n .option(\"--cwd <path>\", \"The working directory. Defaults to the current directory.\", process.cwd())\n .option(\"-p, --path <path>\", \"The path to add the component to\")\n .option(\"--api-key <key>\", \"API key for accessing private components\")\n .action(async (components: string[], opts) => {\n if (!components || components.length === 0) {\n console.error(pc.red(\"Error: Please specify at least one component to add.\"))\n console.log(pc.dim(\"\\nExample:\"))\n console.log(pc.dim(\" npx @creative-tim/ui add button\"))\n console.log(pc.dim(\" npx @creative-tim/ui add card button\"))\n console.log(pc.dim(\" npx @creative-tim/ui add software-purchase-01\"))\n process.exit(1)\n }\n\n const cwd = path.resolve(opts.cwd || process.cwd())\n\n console.log(pc.cyan(\"\\nš¦ Adding components to your project...\\n\"))\n\n for (const component of components) {\n await addComponent(component, cwd, opts)\n }\n\n console.log(pc.green(\"\\nā Components added successfully!\\n\"))\n })\n\nasync function addComponent(name: string, cwd: string, opts: any) {\n const spinner = ora(`Fetching ${pc.cyan(name)}...`).start()\n\n try {\n // Detect project type\n const projectInfo = detectProject(cwd)\n\n // Get authentication headers (supports Bearer, x-api-key, etc.)\n const headers = getAuthHeaders(cwd, opts)\n\n // Fetch component from registry\n const url = `${REGISTRY_URL}/${name}.json`\n const response = await fetch(url, { headers })\n\n if (!response.ok) {\n if (response.status === 401 || response.status === 403) {\n spinner.fail(`Component ${pc.cyan(name)} requires authentication`)\n\n // Try to get error details from response\n try {\n const errorData = await response.json() as any\n if (errorData.message) {\n console.log(pc.dim(` ${errorData.message}`))\n }\n } catch {\n // Ignore JSON parse errors\n }\n\n console.log(pc.dim(`\\n This is a private component. Provide an API key using:`))\n console.log(pc.dim(` 1. Environment variable: CREATIVE_TIM_API_KEY=your_key`))\n console.log(pc.dim(` 2. Config file (components.json):`))\n console.log(pc.dim(` \"registry\": {`))\n console.log(pc.dim(` \"url\": \"https://creative-tim.com/ui\",`))\n console.log(pc.dim(` \"headers\": {`))\n console.log(pc.dim(` \"Authorization\": \"Bearer \\${CREATIVE_TIM_API_KEY}\"`))\n console.log(pc.dim(` }`))\n console.log(pc.dim(` }`))\n console.log(pc.dim(` 3. Command flag: --api-key YOUR_KEY\\n`))\n return\n }\n\n spinner.fail(`Component ${pc.cyan(name)} not found`)\n console.log(pc.dim(` Tried: ${url}`))\n return\n }\n\n const data = await response.json() as RegistryItem\n\n spinner.text = `Installing ${pc.cyan(name)}...`\n\n // Install files\n for (const file of data.files) {\n // Use target path if available, otherwise use the path field\n let installPath = file.target && file.target !== \"\" ? file.target : file.path\n \n // Adjust path based on project structure (add src/ prefix if needed)\n installPath = adjustPathForProject(installPath, projectInfo)\n \n const filePath = path.join(cwd, installPath)\n const fileDir = path.dirname(filePath)\n\n // Check if file exists\n if (fs.existsSync(filePath) && !opts.overwrite && !opts.yes) {\n spinner.warn(`File ${pc.dim(installPath)} already exists. Use --overwrite to replace.`)\n continue\n }\n\n // Create directory if it doesn't exist\n await fs.ensureDir(fileDir)\n\n // Write file\n await fs.writeFile(filePath, file.content, \"utf-8\")\n }\n\n // Install npm dependencies\n if (data.dependencies && data.dependencies.length > 0) {\n spinner.text = `Installing dependencies for ${pc.cyan(name)}...`\n \n const deps = data.dependencies.join(\" \")\n const { execSync } = await import(\"child_process\")\n \n try {\n execSync(`npm install ${deps}`, { cwd, stdio: \"ignore\" })\n } catch (error) {\n spinner.warn(`Failed to install dependencies: ${deps}`)\n console.log(pc.dim(` Run manually: npm install ${deps}`))\n }\n }\n\n // Handle registry dependencies (other components)\n if (data.registryDependencies && data.registryDependencies.length > 0) {\n spinner.text = `Installing registry dependencies for ${pc.cyan(name)}...`\n \n for (const dep of data.registryDependencies) {\n await addComponent(dep, cwd, { ...opts, yes: true })\n }\n }\n\n spinner.succeed(`Added ${pc.cyan(name)}`)\n\n } catch (error: any) {\n spinner.fail(`Failed to add ${pc.cyan(name)}`)\n console.error(pc.red(` ${error.message}`))\n }\n}\n\n","import { existsSync, readFileSync } from \"fs\"\nimport path from \"path\"\n\nexport type ProjectType = \"nextjs\" | \"vite\" | \"astro\" | \"remix\" | \"unknown\"\n\nexport interface ProjectInfo {\n type: ProjectType\n srcDir: string // \"src\" or \"\"\n hasSrcDir: boolean\n}\n\n/**\n * Detects the project type and structure\n */\nexport function detectProject(cwd: string): ProjectInfo {\n // Check for package.json\n const packageJsonPath = path.join(cwd, \"package.json\")\n let packageJson: any = {}\n \n if (existsSync(packageJsonPath)) {\n try {\n packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf-8\"))\n } catch (error) {\n // Failed to parse package.json\n }\n }\n\n // Check for src directory\n const hasSrcDir = existsSync(path.join(cwd, \"src\"))\n const srcDir = hasSrcDir ? \"src\" : \"\"\n\n // Detect project type by config files and dependencies\n const type = detectProjectType(cwd, packageJson)\n\n return {\n type,\n srcDir,\n hasSrcDir,\n }\n}\n\nfunction detectProjectType(cwd: string, packageJson: any): ProjectType {\n const deps = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n }\n\n // Check for Next.js\n if (\n deps[\"next\"] ||\n existsSync(path.join(cwd, \"next.config.js\")) ||\n existsSync(path.join(cwd, \"next.config.mjs\")) ||\n existsSync(path.join(cwd, \"next.config.ts\"))\n ) {\n return \"nextjs\"\n }\n\n // Check for Astro\n if (\n deps[\"astro\"] ||\n existsSync(path.join(cwd, \"astro.config.mjs\")) ||\n existsSync(path.join(cwd, \"astro.config.ts\"))\n ) {\n return \"astro\"\n }\n\n // Check for Remix\n if (\n deps[\"@remix-run/react\"] ||\n existsSync(path.join(cwd, \"remix.config.js\"))\n ) {\n return \"remix\"\n }\n\n // Check for Vite\n if (\n deps[\"vite\"] ||\n existsSync(path.join(cwd, \"vite.config.js\")) ||\n existsSync(path.join(cwd, \"vite.config.ts\"))\n ) {\n return \"vite\"\n }\n\n return \"unknown\"\n}\n\n/**\n * Adjusts a file path based on project structure\n * @param originalPath - The path from the registry (e.g., \"components/ui/button.tsx\")\n * @param projectInfo - The detected project information\n * @returns The adjusted path for the specific project (e.g., \"src/components/ui/button.tsx\")\n */\nexport function adjustPathForProject(\n originalPath: string,\n projectInfo: ProjectInfo\n): string {\n // For Vite and Astro projects with src directory, prepend src/\n if (\n (projectInfo.type === \"vite\" || projectInfo.type === \"astro\") &&\n projectInfo.hasSrcDir\n ) {\n return path.join(\"src\", originalPath)\n }\n\n // For Next.js and other projects, use the path as-is\n // unless they have a src directory\n if (projectInfo.hasSrcDir && projectInfo.type !== \"nextjs\") {\n return path.join(\"src\", originalPath)\n }\n\n return originalPath\n}\n\n/**\n * Adjusts the CSS path in components.json based on project type\n */\nexport function getDefaultCssPath(projectInfo: ProjectInfo): string {\n switch (projectInfo.type) {\n case \"nextjs\":\n return projectInfo.hasSrcDir ? \"src/app/globals.css\" : \"app/globals.css\"\n case \"vite\":\n return projectInfo.hasSrcDir ? \"src/index.css\" : \"index.css\"\n case \"astro\":\n return projectInfo.hasSrcDir ? \"src/styles/global.css\" : \"styles/global.css\"\n case \"remix\":\n return projectInfo.hasSrcDir ? \"src/styles/globals.css\" : \"app/styles/globals.css\"\n default:\n return projectInfo.hasSrcDir ? \"src/index.css\" : \"styles/globals.css\"\n }\n}\n\n/**\n * Gets the correct alias prefix based on project structure\n */\nexport function getAliasPrefix(projectInfo: ProjectInfo): string {\n // Most projects use @/ which maps to src/ or root\n return \"@/\"\n}\n\n/**\n * Adjusts aliases in components.json based on project structure\n */\nexport function getDefaultAliases(projectInfo: ProjectInfo) {\n const prefix = projectInfo.hasSrcDir ? \"@/\" : \"@/\"\n \n return {\n components: `${prefix}components`,\n utils: `${prefix}lib/utils`,\n ui: `${prefix}components/ui`,\n lib: `${prefix}lib`,\n hooks: `${prefix}hooks`,\n \"creative-tim\": `${prefix}components/creative-tim`,\n }\n}\n\n/**\n * Gets the default tailwind config path\n */\nexport function getTailwindConfigPath(projectInfo: ProjectInfo): string {\n // Check which one exists\n const cwd = process.cwd()\n\n if (existsSync(path.join(cwd, \"tailwind.config.ts\"))) {\n return \"tailwind.config.ts\"\n }\n if (existsSync(path.join(cwd, \"tailwind.config.js\"))) {\n return \"tailwind.config.js\"\n }\n if (existsSync(path.join(cwd, \"tailwind.config.mjs\"))) {\n return \"tailwind.config.mjs\"\n }\n\n // Default\n return \"tailwind.config.ts\"\n}\n\n/**\n * Load configuration from components.json\n */\nexport function loadConfig(cwd: string): any | null {\n const configPath = path.join(cwd, \"components.json\")\n\n if (!existsSync(configPath)) {\n return null\n }\n\n try {\n const content = readFileSync(configPath, \"utf-8\")\n return JSON.parse(content)\n } catch (error) {\n return null\n }\n}\n\n","import { Command } from \"commander\"\nimport pc from \"picocolors\"\nimport prompts from \"prompts\"\nimport { existsSync } from \"fs\"\nimport fs from \"fs-extra\"\nimport path from \"path\"\nimport ora from \"ora\"\nimport {\n detectProject,\n getDefaultCssPath,\n getDefaultAliases,\n getTailwindConfigPath,\n} from \"../utils/project.js\"\n\nexport const initCommand = new Command()\n .name(\"init\")\n .description(\"Initialize your project with Creative Tim UI configuration\")\n .option(\"-y, --yes\", \"Skip prompts and use default values\")\n .option(\"--cwd <path>\", \"The working directory. Defaults to the current directory.\", process.cwd())\n .action(async (opts) => {\n const cwd = path.resolve(opts.cwd || process.cwd())\n \n console.log(pc.cyan(\"\\nāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā\"))\n console.log(pc.cyan(\"ā Welcome to Creative Tim UI ā\"))\n console.log(pc.cyan(\"āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā\\n\"))\n\n // Detect project type\n const projectInfo = detectProject(cwd)\n \n console.log(pc.dim(`Detected project type: ${pc.bold(projectInfo.type)}`))\n if (projectInfo.hasSrcDir) {\n console.log(pc.dim(`Using src directory: ${pc.bold(\"src/\")}`))\n }\n console.log()\n\n // Check if components.json exists\n const componentsJsonPath = path.resolve(cwd, \"components.json\")\n \n if (existsSync(componentsJsonPath) && !opts.yes) {\n const { overwrite } = await prompts({\n type: \"confirm\",\n name: \"overwrite\",\n message: \"components.json already exists. Overwrite?\",\n initial: false\n })\n\n if (!overwrite) {\n console.log(pc.yellow(\"Initialization cancelled.\"))\n return\n }\n }\n\n const spinner = ora(\"Initializing project...\").start()\n\n try {\n // Get project-specific defaults\n const cssPath = getDefaultCssPath(projectInfo)\n const aliases = getDefaultAliases(projectInfo)\n const tailwindConfig = getTailwindConfigPath(projectInfo)\n\n // Create components.json\n const config: any = {\n \"$schema\": \"https://ui.shadcn.com/schema.json\",\n \"style\": \"default\",\n \"rsc\": projectInfo.type === \"nextjs\", // Only Next.js supports RSC by default\n \"tsx\": true,\n \"tailwind\": {\n \"config\": tailwindConfig,\n \"css\": cssPath,\n \"baseColor\": \"slate\",\n \"cssVariables\": true,\n \"prefix\": \"\"\n },\n \"aliases\": aliases,\n \"registry\": \"https://creative-tim.com/ui\"\n }\n\n // Add registry configuration example in comment for Pro users\n // Users can uncomment and configure this for private components\n config.$comment = \"For private components, configure registry with headers. Example: \\\"registry\\\": { \\\"url\\\": \\\"https://creative-tim.com/ui\\\", \\\"headers\\\": { \\\"Authorization\\\": \\\"Bearer ${CREATIVE_TIM_API_KEY}\\\" } }\"\n\n await fs.writeJSON(componentsJsonPath, config, { spaces: 2 })\n\n spinner.succeed(\"Project initialized successfully!\")\n \n console.log(pc.green(\"\\nā Created components.json\"))\n console.log(pc.dim(`ā Configured for ${projectInfo.type} project`))\n if (projectInfo.hasSrcDir) {\n console.log(pc.dim(`ā Components will be installed in src/ directory`))\n }\n console.log(pc.dim(\"\\nNext steps:\"))\n console.log(pc.dim(\" 1. Review your components.json\"))\n console.log(pc.dim(\" 2. Run: npx @creative-tim/ui add button\"))\n console.log(pc.dim(\" 3. Start using Creative Tim UI components!\\n\"))\n\n } catch (error) {\n spinner.fail(\"Failed to initialize project\")\n throw error\n }\n })\n\n"],"mappings":";;;AACA,SAAS,WAAAA,gBAAe;AACxB,OAAOC,SAAQ;;;ACFf,SAAS,eAAe;AACxB,OAAO,QAAQ;AACf,OAAO,SAAS;AAChB,OAAOC,W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","readFileSync","Command","pc"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/commands/add.ts","../src/utils/project.ts","../src/commands/init.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Command } from \"commander\"\nimport pc from \"picocolors\"\nimport { addCommand } from \"./commands/add.js\"\nimport { initCommand } from \"./commands/init.js\"\nimport { readFileSync } from \"fs\"\nimport { fileURLToPath } from \"url\"\nimport { dirname, join } from \"path\"\n\nconst __filename = fileURLToPath(import.meta.url)\nconst __dirname = dirname(__filename)\n\n// Read version from package.json\nlet packageVersion = \"0.1.0\"\ntry {\n const packageJsonPath = join(__dirname, \"../package.json\")\n const packageJsonContent = readFileSync(packageJsonPath, \"utf-8\")\n const packageJson = JSON.parse(packageJsonContent)\n packageVersion = packageJson.version\n} catch (error) {\n // Fallback to default version\n}\n\nasync function main() {\n const program = new Command()\n .name(\"creative-tim-ui\")\n .description(\"A CLI for adding Creative Tim UI components to your project\")\n .version(\n packageVersion,\n \"-v, --version\",\n \"display the version number\"\n )\n\n program\n .addCommand(initCommand)\n .addCommand(addCommand)\n\n program.parse()\n}\n\nmain().catch((error) => {\n console.error(pc.red(\"Error:\"), error.message)\n process.exit(1)\n})\n\n","import { Command } from \"commander\"\nimport pc from \"picocolors\"\nimport ora from \"ora\"\nimport path from \"path\"\nimport fs from \"fs-extra\"\nimport fetch from \"node-fetch\"\nimport { detectProject, adjustPathForProject, loadConfig } from \"../utils/project.js\"\n\nconst REGISTRY_URL = \"https://creative-tim.com/ui/r\"\n\n/**\n * Expand environment variables in a string (e.g., \"${API_KEY}\" -> actual value)\n * Supports environment variable substitution in configuration values\n */\nfunction expandEnvVars(value: string): string {\n return value.replace(/\\$\\{([^}]+)\\}/g, (_, varName) => {\n return process.env[varName] || \"\"\n })\n}\n\n/**\n * Get authentication headers from multiple sources (priority order):\n * 1. Command line option --api-key\n * 2. components.json registries[@creative-tim].headers configuration (with env var expansion)\n * 3. components.json registry.headers configuration (with env var expansion)\n * 4. Environment variable CREATIVE_TIM_UI_API_KEY\n *\n * Supports all auth methods that the API accepts: Authorization Bearer, x-api-key, etc.\n */\nfunction getAuthHeaders(cwd: string, opts: any): Record<string, string> {\n const headers: Record<string, string> = {\n 'Accept': 'application/json',\n }\n\n // 1. Check command line option (highest priority)\n if (opts.apiKey) {\n headers['Authorization'] = `Bearer ${opts.apiKey}`\n return headers\n }\n\n // 2. Check components.json for registries configuration (namespaced)\n const config = loadConfig(cwd)\n if (config?.registries?.['@creative-tim']) {\n const registry = config.registries['@creative-tim']\n if (registry.headers) {\n for (const [key, value] of Object.entries(registry.headers)) {\n if (typeof value === 'string') {\n const expandedValue = expandEnvVars(value)\n if (expandedValue) {\n headers[key] = expandedValue\n }\n }\n }\n // If we found headers, return them\n if (Object.keys(headers).length > 1) {\n return headers\n }\n }\n }\n\n // 3. Check components.json for registry configuration with headers (backward compatible)\n if (config?.registry) {\n // Check if registry is an object with headers\n if (typeof config.registry === 'object' && config.registry.headers) {\n const configHeaders = config.registry.headers\n for (const [key, value] of Object.entries(configHeaders)) {\n if (typeof value === 'string') {\n const expandedValue = expandEnvVars(value)\n if (expandedValue) { // Only add header if value is not empty\n headers[key] = expandedValue\n }\n }\n }\n // If we found headers, return them\n if (Object.keys(headers).length > 1) { // More than just Accept\n return headers\n }\n }\n }\n\n // 4. Fallback to environment variable\n if (process.env.CREATIVE_TIM_UI_API_KEY) {\n headers['Authorization'] = `Bearer ${process.env.CREATIVE_TIM_UI_API_KEY}`\n }\n\n return headers\n}\n\ninterface RegistryItem {\n name: string\n type: string\n files: Array<{\n path: string\n content: string\n type: string\n target?: string\n }>\n dependencies?: string[]\n registryDependencies?: string[]\n}\n\nexport const addCommand = new Command()\n .name(\"add\")\n .description(\"Add a component or block to your project\")\n .argument(\"[components...]\", \"The components to add\")\n .option(\"-y, --yes\", \"Skip confirmation prompt\")\n .option(\"-o, --overwrite\", \"Overwrite existing files\")\n .option(\"--cwd <path>\", \"The working directory. Defaults to the current directory.\", process.cwd())\n .option(\"-p, --path <path>\", \"The path to add the component to\")\n .option(\"--api-key <key>\", \"API key for accessing private components\")\n .action(async (components: string[], opts) => {\n if (!components || components.length === 0) {\n console.error(pc.red(\"Error: Please specify at least one component to add.\"))\n console.log(pc.dim(\"\\nExample:\"))\n console.log(pc.dim(\" npx @creative-tim/ui add button\"))\n console.log(pc.dim(\" npx @creative-tim/ui add card button\"))\n console.log(pc.dim(\" npx @creative-tim/ui add software-purchase-01\"))\n process.exit(1)\n }\n\n const cwd = path.resolve(opts.cwd || process.cwd())\n\n console.log(pc.cyan(\"\\nš¦ Adding components to your project...\\n\"))\n\n const results: boolean[] = []\n for (const component of components) {\n const success = await addComponent(component, cwd, opts)\n results.push(success)\n }\n\n // Show summary based on results\n const successCount = results.filter(r => r).length\n const failCount = results.filter(r => !r).length\n\n if (successCount > 0 && failCount === 0) {\n console.log(pc.green(\"\\nā Components added successfully!\\n\"))\n } else if (successCount > 0 && failCount > 0) {\n console.log(pc.yellow(`\\nā ${successCount} component(s) added, ${failCount} failed\\n`))\n } else if (failCount > 0) {\n console.log(pc.red(\"\\nā No components were added\\n\"))\n }\n })\n\nasync function addComponent(name: string, cwd: string, opts: any) {\n const spinner = ora(`Fetching ${pc.cyan(name)}...`).start()\n\n try {\n // Detect project type\n const projectInfo = detectProject(cwd)\n\n // Get authentication headers (supports Bearer, x-api-key, etc.)\n const headers = getAuthHeaders(cwd, opts)\n\n // Fetch component from registry\n const url = `${REGISTRY_URL}/${name}.json`\n const response = await fetch(url, { headers })\n\n if (!response.ok) {\n if (response.status === 401 || response.status === 403) {\n spinner.fail(`Component ${pc.cyan(name)} requires authentication`)\n\n // Try to get error details from response\n try {\n const errorData = await response.json() as any\n if (errorData.message) {\n console.log(pc.dim(` ${errorData.message}`))\n }\n } catch {\n // Ignore JSON parse errors\n }\n\n console.log(pc.dim(`\\n This is a private component. Provide an API key using:`))\n console.log(pc.dim(` 1. Environment variable: CREATIVE_TIM_UI_API_KEY=your_key`))\n console.log(pc.dim(` 2. Config file (components.json):`))\n console.log(pc.dim(` \"registries\": {`))\n console.log(pc.dim(` \"@creative-tim\": {`))\n console.log(pc.dim(` \"url\": \"https://www.creative-tim.com/ui/r/{name}.json\",`))\n console.log(pc.dim(` \"headers\": {`))\n console.log(pc.dim(` \"Authorization\": \"Bearer \\${CREATIVE_TIM_UI_API_KEY}\"`))\n console.log(pc.dim(` }`))\n console.log(pc.dim(` }`))\n console.log(pc.dim(` }`))\n console.log(pc.dim(` 3. Command flag: --api-key YOUR_KEY\\n`))\n return false\n }\n\n spinner.fail(`Component ${pc.cyan(name)} not found`)\n console.log(pc.dim(` Tried: ${url}`))\n return false\n }\n\n const data = await response.json() as RegistryItem\n\n spinner.text = `Installing ${pc.cyan(name)}...`\n\n // Install files\n for (const file of data.files) {\n // Use target path if available, otherwise use the path field\n let installPath = file.target && file.target !== \"\" ? file.target : file.path\n \n // Adjust path based on project structure (add src/ prefix if needed)\n installPath = adjustPathForProject(installPath, projectInfo)\n \n const filePath = path.join(cwd, installPath)\n const fileDir = path.dirname(filePath)\n\n // Check if file exists\n if (fs.existsSync(filePath) && !opts.overwrite && !opts.yes) {\n spinner.warn(`File ${pc.dim(installPath)} already exists. Use --overwrite to replace.`)\n continue\n }\n\n // Create directory if it doesn't exist\n await fs.ensureDir(fileDir)\n\n // Write file\n await fs.writeFile(filePath, file.content, \"utf-8\")\n }\n\n // Install npm dependencies\n if (data.dependencies && data.dependencies.length > 0) {\n spinner.text = `Installing dependencies for ${pc.cyan(name)}...`\n \n const deps = data.dependencies.join(\" \")\n const { execSync } = await import(\"child_process\")\n \n try {\n execSync(`npm install ${deps}`, { cwd, stdio: \"ignore\" })\n } catch (error) {\n spinner.warn(`Failed to install dependencies: ${deps}`)\n console.log(pc.dim(` Run manually: npm install ${deps}`))\n }\n }\n\n // Handle registry dependencies (other components)\n if (data.registryDependencies && data.registryDependencies.length > 0) {\n spinner.text = `Installing registry dependencies for ${pc.cyan(name)}...`\n \n for (const dep of data.registryDependencies) {\n await addComponent(dep, cwd, { ...opts, yes: true })\n }\n }\n\n spinner.succeed(`Added ${pc.cyan(name)}`)\n return true\n\n } catch (error: any) {\n spinner.fail(`Failed to add ${pc.cyan(name)}`)\n console.error(pc.red(` ${error.message}`))\n return false\n }\n}\n\n","import { existsSync, readFileSync } from \"fs\"\nimport path from \"path\"\n\nexport type ProjectType = \"nextjs\" | \"vite\" | \"astro\" | \"remix\" | \"unknown\"\n\nexport interface ProjectInfo {\n type: ProjectType\n srcDir: string // \"src\" or \"\"\n hasSrcDir: boolean\n}\n\n/**\n * Detects the project type and structure\n */\nexport function detectProject(cwd: string): ProjectInfo {\n // Check for package.json\n const packageJsonPath = path.join(cwd, \"package.json\")\n let packageJson: any = {}\n \n if (existsSync(packageJsonPath)) {\n try {\n packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf-8\"))\n } catch (error) {\n // Failed to parse package.json\n }\n }\n\n // Check for src directory\n const hasSrcDir = existsSync(path.join(cwd, \"src\"))\n const srcDir = hasSrcDir ? \"src\" : \"\"\n\n // Detect project type by config files and dependencies\n const type = detectProjectType(cwd, packageJson)\n\n return {\n type,\n srcDir,\n hasSrcDir,\n }\n}\n\nfunction detectProjectType(cwd: string, packageJson: any): ProjectType {\n const deps = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n }\n\n // Check for Next.js\n if (\n deps[\"next\"] ||\n existsSync(path.join(cwd, \"next.config.js\")) ||\n existsSync(path.join(cwd, \"next.config.mjs\")) ||\n existsSync(path.join(cwd, \"next.config.ts\"))\n ) {\n return \"nextjs\"\n }\n\n // Check for Astro\n if (\n deps[\"astro\"] ||\n existsSync(path.join(cwd, \"astro.config.mjs\")) ||\n existsSync(path.join(cwd, \"astro.config.ts\"))\n ) {\n return \"astro\"\n }\n\n // Check for Remix\n if (\n deps[\"@remix-run/react\"] ||\n existsSync(path.join(cwd, \"remix.config.js\"))\n ) {\n return \"remix\"\n }\n\n // Check for Vite\n if (\n deps[\"vite\"] ||\n existsSync(path.join(cwd, \"vite.config.js\")) ||\n existsSync(path.join(cwd, \"vite.config.ts\"))\n ) {\n return \"vite\"\n }\n\n return \"unknown\"\n}\n\n/**\n * Adjusts a file path based on project structure\n * @param originalPath - The path from the registry (e.g., \"components/ui/button.tsx\")\n * @param projectInfo - The detected project information\n * @returns The adjusted path for the specific project (e.g., \"src/components/ui/button.tsx\")\n */\nexport function adjustPathForProject(\n originalPath: string,\n projectInfo: ProjectInfo\n): string {\n // For Vite and Astro projects with src directory, prepend src/\n if (\n (projectInfo.type === \"vite\" || projectInfo.type === \"astro\") &&\n projectInfo.hasSrcDir\n ) {\n return path.join(\"src\", originalPath)\n }\n\n // For Next.js and other projects, use the path as-is\n // unless they have a src directory\n if (projectInfo.hasSrcDir && projectInfo.type !== \"nextjs\") {\n return path.join(\"src\", originalPath)\n }\n\n return originalPath\n}\n\n/**\n * Adjusts the CSS path in components.json based on project type\n */\nexport function getDefaultCssPath(projectInfo: ProjectInfo): string {\n switch (projectInfo.type) {\n case \"nextjs\":\n return projectInfo.hasSrcDir ? \"src/app/globals.css\" : \"app/globals.css\"\n case \"vite\":\n return projectInfo.hasSrcDir ? \"src/index.css\" : \"index.css\"\n case \"astro\":\n return projectInfo.hasSrcDir ? \"src/styles/global.css\" : \"styles/global.css\"\n case \"remix\":\n return projectInfo.hasSrcDir ? \"src/styles/globals.css\" : \"app/styles/globals.css\"\n default:\n return projectInfo.hasSrcDir ? \"src/index.css\" : \"styles/globals.css\"\n }\n}\n\n/**\n * Gets the correct alias prefix based on project structure\n */\nexport function getAliasPrefix(projectInfo: ProjectInfo): string {\n // Most projects use @/ which maps to src/ or root\n return \"@/\"\n}\n\n/**\n * Adjusts aliases in components.json based on project structure\n */\nexport function getDefaultAliases(projectInfo: ProjectInfo) {\n const prefix = projectInfo.hasSrcDir ? \"@/\" : \"@/\"\n \n return {\n components: `${prefix}components`,\n utils: `${prefix}lib/utils`,\n ui: `${prefix}components/ui`,\n lib: `${prefix}lib`,\n hooks: `${prefix}hooks`,\n \"creative-tim\": `${prefix}components/creative-tim`,\n }\n}\n\n/**\n * Gets the default tailwind config path\n */\nexport function getTailwindConfigPath(projectInfo: ProjectInfo): string {\n // Check which one exists\n const cwd = process.cwd()\n\n if (existsSync(path.join(cwd, \"tailwind.config.ts\"))) {\n return \"tailwind.config.ts\"\n }\n if (existsSync(path.join(cwd, \"tailwind.config.js\"))) {\n return \"tailwind.config.js\"\n }\n if (existsSync(path.join(cwd, \"tailwind.config.mjs\"))) {\n return \"tailwind.config.mjs\"\n }\n\n // Default\n return \"tailwind.config.ts\"\n}\n\n/**\n * Load configuration from components.json\n */\nexport function loadConfig(cwd: string): any | null {\n const configPath = path.join(cwd, \"components.json\")\n\n if (!existsSync(configPath)) {\n return null\n }\n\n try {\n const content = readFileSync(configPath, \"utf-8\")\n return JSON.parse(content)\n } catch (error) {\n return null\n }\n}\n\n","import { Command } from \"commander\"\nimport pc from \"picocolors\"\nimport prompts from \"prompts\"\nimport { existsSync } from \"fs\"\nimport fs from \"fs-extra\"\nimport path from \"path\"\nimport ora from \"ora\"\nimport {\n detectProject,\n getDefaultCssPath,\n getDefaultAliases,\n getTailwindConfigPath,\n} from \"../utils/project.js\"\n\nexport const initCommand = new Command()\n .name(\"init\")\n .description(\"Initialize your project with Creative Tim UI configuration\")\n .option(\"-y, --yes\", \"Skip prompts and use default values\")\n .option(\"--cwd <path>\", \"The working directory. Defaults to the current directory.\", process.cwd())\n .action(async (opts) => {\n const cwd = path.resolve(opts.cwd || process.cwd())\n \n console.log(pc.cyan(\"\\nāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā\"))\n console.log(pc.cyan(\"ā Welcome to Creative Tim UI ā\"))\n console.log(pc.cyan(\"āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā\\n\"))\n\n // Detect project type\n const projectInfo = detectProject(cwd)\n \n console.log(pc.dim(`Detected project type: ${pc.bold(projectInfo.type)}`))\n if (projectInfo.hasSrcDir) {\n console.log(pc.dim(`Using src directory: ${pc.bold(\"src/\")}`))\n }\n console.log()\n\n // Check if components.json exists\n const componentsJsonPath = path.resolve(cwd, \"components.json\")\n \n if (existsSync(componentsJsonPath) && !opts.yes) {\n const { overwrite } = await prompts({\n type: \"confirm\",\n name: \"overwrite\",\n message: \"components.json already exists. Overwrite?\",\n initial: false\n })\n\n if (!overwrite) {\n console.log(pc.yellow(\"Initialization cancelled.\"))\n return\n }\n }\n\n const spinner = ora(\"Initializing project...\").start()\n\n try {\n // Get project-specific defaults\n const cssPath = getDefaultCssPath(projectInfo)\n const aliases = getDefaultAliases(projectInfo)\n const tailwindConfig = getTailwindConfigPath(projectInfo)\n\n // Create components.json\n const config: any = {\n \"$schema\": \"https://ui.shadcn.com/schema.json\",\n \"style\": \"default\",\n \"rsc\": projectInfo.type === \"nextjs\", // Only Next.js supports RSC by default\n \"tsx\": true,\n \"tailwind\": {\n \"config\": tailwindConfig,\n \"css\": cssPath,\n \"baseColor\": \"slate\",\n \"cssVariables\": true,\n \"prefix\": \"\"\n },\n \"aliases\": aliases,\n \"registry\": \"https://creative-tim.com/ui\"\n }\n\n // Add registry configuration example in comment for Pro users\n // Users can uncomment and configure this for private components\n config.$comment = \"For private components, configure registry with headers. Example: \\\"registry\\\": { \\\"url\\\": \\\"https://creative-tim.com/ui\\\", \\\"headers\\\": { \\\"Authorization\\\": \\\"Bearer ${CREATIVE_TIM_API_KEY}\\\" } }\"\n\n await fs.writeJSON(componentsJsonPath, config, { spaces: 2 })\n\n spinner.succeed(\"Project initialized successfully!\")\n \n console.log(pc.green(\"\\nā Created components.json\"))\n console.log(pc.dim(`ā Configured for ${projectInfo.type} project`))\n if (projectInfo.hasSrcDir) {\n console.log(pc.dim(`ā Components will be installed in src/ directory`))\n }\n console.log(pc.dim(\"\\nNext steps:\"))\n console.log(pc.dim(\" 1. Review your components.json\"))\n console.log(pc.dim(\" 2. Run: npx @creative-tim/ui add button\"))\n console.log(pc.dim(\" 3. Start using Creative Tim UI components!\\n\"))\n\n } catch (error) {\n spinner.fail(\"Failed to initialize project\")\n throw error\n }\n })\n\n"],"mappings":";;;AACA,SAAS,WAAAA,gBAAe;AACxB,OAAOC,SAAQ;;;ACFf,SAAS,eAAe;AACxB,OAAO,QAAQ;AACf,OAAO,SAAS;AAChB,OAAOC,WAAU;AACjB,OAAO,QAAQ;AACf,OAAO,WAAW;;;ACLlB,SAAS,YAAY,oBAAoB;AACzC,OAAO,UAAU;AAaV,SAAS,cAAc,KAA0B;AAEtD,QAAM,kBAAkB,KAAK,KAAK,KAAK,cAAc;AACrD,MAAI,cAAmB,CAAC;AAExB,MAAI,WAAW,eAAe,GAAG;AAC/B,QAAI;AACF,oBAAc,KAAK,MAAM,aAAa,iBAAiB,OAAO,CAAC;AAAA,IACjE,SAAS,OAAO;AAAA,IAEhB;AAAA,EACF;AAGA,QAAM,YAAY,WAAW,KAAK,KAAK,KAAK,KAAK,CAAC;AAClD,QAAM,SAAS,YAAY,QAAQ;AAGnC,QAAM,OAAO,kBAAkB,KAAK,WAAW;AAE/C,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEA,SAAS,kBAAkB,KAAa,aAA+B;AACrE,QAAM,OAAO;AAAA,IACX,GAAG,YAAY;AAAA,IACf,GAAG,YAAY;AAAA,EACjB;AAGA,MACE,KAAK,MAAM,KACX,WAAW,KAAK,KAAK,KAAK,gBAAgB,CAAC,KAC3C,WAAW,KAAK,KAAK,KAAK,iBAAiB,CAAC,KAC5C,WAAW,KAAK,KAAK,KAAK,gBAAgB,CAAC,GAC3C;AACA,WAAO;AAAA,EACT;AAGA,MACE,KAAK,OAAO,KACZ,WAAW,KAAK,KAAK,KAAK,kBAAkB,CAAC,KAC7C,WAAW,KAAK,KAAK,KAAK,iBAAiB,CAAC,GAC5C;AACA,WAAO;AAAA,EACT;AAGA,MACE,KAAK,kBAAkB,KACvB,WAAW,KAAK,KAAK,KAAK,iBAAiB,CAAC,GAC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IAAIA,IAAG,IAAI,yBAAoB,YAAY,IAAI,UAAU,CAAC;AAClE,QAAI,YAAY,WAAW;AACzB,cAAQ,IAAIA,IAAG,IAAI,uDAAkD,CAAC;AAAA,IACxE;AACA,YAAQ,IAAIA,IAAG,IAAI,eAAe,CAAC;AACnC,YAAQ,IAAIA,IAAG,IAAI,kCAAkC,CAAC;AACtD,YAAQ,IAAIA,IAAG,IAAI,2CAA2C,CAAC;AAC/D,YAAQ,IAAIA,IAAG,IAAI,gDAAgD,CAAC;AAAA,EAEtE,SAAS,OAAO;AACd,YAAQ,KAAK,8BAA8B;AAC3C,UAAM;AAAA,EACR;AACF,CAAC;;;AH9FH,SAAS,gBAAAI,qBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,SAAS,YAAY;AAE9B,IAAM,aAAa,cAAc,YAAY,GAAG;AAChD,IAAM,YAAY,QAAQ,UAAU;AAGpC,IAAI,iBAAiB;AACrB,IAAI;AACF,QAAM,kBAAkB,KAAK,WAAW,iBAAiB;AACzD,QAAM,qBAAqBA,cAAa,iBAAiB,OAAO;AAChE,QAAM,cAAc,KAAK,MAAM,kBAAkB;AACjD,mBAAiB,YAAY;AAC/B,SAAS,OAAO;AAEhB;AAEA,eAAe,OAAO;AACpB,QAAM,UAAU,IAAIC,SAAQ,EACzB,KAAK,iBAAiB,EACtB,YAAY,6DAA6D,EACzE;AAAA,IACC;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEF,UACG,WAAW,WAAW,EACtB,WAAW,UAAU;AAExB,UAAQ,MAAM;AAChB;AAEA,KAAK,EAAE,MAAM,CAAC,UAAU;AACtB,UAAQ,MAAMC,IAAG,IAAI,QAAQ,GAAG,MAAM,OAAO;AAC7C,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["Command","pc","path","path","Command","pc","existsSync","fs","path","ora","Command","path","pc","existsSync","ora","fs","readFileSync","Command","pc"]}
|