@creative-tim/ui 0.2.0-beta ā 0.4.0-beta
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 +53 -1
- package/dist/index.js +196 -25
- package/dist/index.js.map +1 -1
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -2,11 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
A CLI for adding [Creative Tim UI](https://creative-tim.com/ui) components and blocks to your project.
|
|
4
4
|
|
|
5
|
-
Built by [Creative Tim](https://creative-tim.com) - Based on shadcn/ui registry system.
|
|
5
|
+
Built by [Creative Tim](https://creative-tim.com) - Based on shadcn/ui registry system.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@creative-tim/ui)
|
|
8
|
+
[](https://www.npmjs.com/package/@creative-tim/ui)
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
⨠**Automatic Framework Detection** - Works with Next.js, Vite, Astro, and Remix
|
|
13
|
+
š **Smart Path Resolution** - Components install in the correct location
|
|
14
|
+
šØ **53 UI Components** - Beautiful, accessible components
|
|
15
|
+
š§© **111 Blocks** - Pre-built sections and page templates
|
|
16
|
+
š§ **Zero Configuration** - Just run init and start using
|
|
6
17
|
|
|
7
18
|
## Installation
|
|
8
19
|
|
|
9
20
|
```bash
|
|
21
|
+
npx @creative-tim/ui@latest init
|
|
10
22
|
npx @creative-tim/ui@latest add button
|
|
11
23
|
```
|
|
12
24
|
|
|
@@ -42,6 +54,46 @@ npx @creative-tim/ui@latest add testimonials-01
|
|
|
42
54
|
- `-o, --overwrite` - Overwrite existing files
|
|
43
55
|
- `--cwd <path>` - Specify working directory
|
|
44
56
|
- `-p, --path <path>` - Specify installation path
|
|
57
|
+
- `--api-key <key>` - API key for accessing private components
|
|
58
|
+
|
|
59
|
+
## Authentication
|
|
60
|
+
|
|
61
|
+
Some components are private and require authentication. You can authenticate in three ways:
|
|
62
|
+
|
|
63
|
+
### 1. Environment Variable (Recommended)
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
export CREATIVE_TIM_API_KEY=pk_live_your_key
|
|
67
|
+
npx @creative-tim/ui@latest add testimonials-06
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 2. Config File
|
|
71
|
+
|
|
72
|
+
Add authentication to your `components.json`:
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"registry": {
|
|
77
|
+
"url": "https://creative-tim.com/ui",
|
|
78
|
+
"headers": {
|
|
79
|
+
"Authorization": "Bearer ${CREATIVE_TIM_API_KEY}"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Then use:
|
|
86
|
+
```bash
|
|
87
|
+
CREATIVE_TIM_API_KEY=pk_live_your_key npx @creative-tim/ui@latest add testimonials-06
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 3. Command Flag
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
npx @creative-tim/ui@latest add testimonials-06 --api-key pk_live_your_key
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Note:** You can get your API key from your [Creative Tim account dashboard](https://creative-tim.com/dashboard).
|
|
45
97
|
|
|
46
98
|
## Component Types
|
|
47
99
|
|
package/dist/index.js
CHANGED
|
@@ -8,11 +8,148 @@ import pc3 from "picocolors";
|
|
|
8
8
|
import { Command } from "commander";
|
|
9
9
|
import pc from "picocolors";
|
|
10
10
|
import ora from "ora";
|
|
11
|
-
import
|
|
11
|
+
import path2 from "path";
|
|
12
12
|
import fs from "fs-extra";
|
|
13
13
|
import fetch from "node-fetch";
|
|
14
|
+
|
|
15
|
+
// src/utils/project.ts
|
|
16
|
+
import { existsSync, readFileSync } from "fs";
|
|
17
|
+
import path from "path";
|
|
18
|
+
function detectProject(cwd) {
|
|
19
|
+
const packageJsonPath = path.join(cwd, "package.json");
|
|
20
|
+
let packageJson = {};
|
|
21
|
+
if (existsSync(packageJsonPath)) {
|
|
22
|
+
try {
|
|
23
|
+
packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
24
|
+
} catch (error) {
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const hasSrcDir = existsSync(path.join(cwd, "src"));
|
|
28
|
+
const srcDir = hasSrcDir ? "src" : "";
|
|
29
|
+
const type = detectProjectType(cwd, packageJson);
|
|
30
|
+
return {
|
|
31
|
+
type,
|
|
32
|
+
srcDir,
|
|
33
|
+
hasSrcDir
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function detectProjectType(cwd, packageJson) {
|
|
37
|
+
const deps = {
|
|
38
|
+
...packageJson.dependencies,
|
|
39
|
+
...packageJson.devDependencies
|
|
40
|
+
};
|
|
41
|
+
if (deps["next"] || existsSync(path.join(cwd, "next.config.js")) || existsSync(path.join(cwd, "next.config.mjs")) || existsSync(path.join(cwd, "next.config.ts"))) {
|
|
42
|
+
return "nextjs";
|
|
43
|
+
}
|
|
44
|
+
if (deps["astro"] || existsSync(path.join(cwd, "astro.config.mjs")) || existsSync(path.join(cwd, "astro.config.ts"))) {
|
|
45
|
+
return "astro";
|
|
46
|
+
}
|
|
47
|
+
if (deps["@remix-run/react"] || existsSync(path.join(cwd, "remix.config.js"))) {
|
|
48
|
+
return "remix";
|
|
49
|
+
}
|
|
50
|
+
if (deps["vite"] || existsSync(path.join(cwd, "vite.config.js")) || existsSync(path.join(cwd, "vite.config.ts"))) {
|
|
51
|
+
return "vite";
|
|
52
|
+
}
|
|
53
|
+
return "unknown";
|
|
54
|
+
}
|
|
55
|
+
function adjustPathForProject(originalPath, projectInfo) {
|
|
56
|
+
if ((projectInfo.type === "vite" || projectInfo.type === "astro") && projectInfo.hasSrcDir) {
|
|
57
|
+
return path.join("src", originalPath);
|
|
58
|
+
}
|
|
59
|
+
if (projectInfo.hasSrcDir && projectInfo.type !== "nextjs") {
|
|
60
|
+
return path.join("src", originalPath);
|
|
61
|
+
}
|
|
62
|
+
return originalPath;
|
|
63
|
+
}
|
|
64
|
+
function getDefaultCssPath(projectInfo) {
|
|
65
|
+
switch (projectInfo.type) {
|
|
66
|
+
case "nextjs":
|
|
67
|
+
return projectInfo.hasSrcDir ? "src/app/globals.css" : "app/globals.css";
|
|
68
|
+
case "vite":
|
|
69
|
+
return projectInfo.hasSrcDir ? "src/index.css" : "index.css";
|
|
70
|
+
case "astro":
|
|
71
|
+
return projectInfo.hasSrcDir ? "src/styles/global.css" : "styles/global.css";
|
|
72
|
+
case "remix":
|
|
73
|
+
return projectInfo.hasSrcDir ? "src/styles/globals.css" : "app/styles/globals.css";
|
|
74
|
+
default:
|
|
75
|
+
return projectInfo.hasSrcDir ? "src/index.css" : "styles/globals.css";
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function getDefaultAliases(projectInfo) {
|
|
79
|
+
const prefix = projectInfo.hasSrcDir ? "@/" : "@/";
|
|
80
|
+
return {
|
|
81
|
+
components: `${prefix}components`,
|
|
82
|
+
utils: `${prefix}lib/utils`,
|
|
83
|
+
ui: `${prefix}components/ui`,
|
|
84
|
+
lib: `${prefix}lib`,
|
|
85
|
+
hooks: `${prefix}hooks`,
|
|
86
|
+
"creative-tim": `${prefix}components/creative-tim`
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function getTailwindConfigPath(projectInfo) {
|
|
90
|
+
const cwd = process.cwd();
|
|
91
|
+
if (existsSync(path.join(cwd, "tailwind.config.ts"))) {
|
|
92
|
+
return "tailwind.config.ts";
|
|
93
|
+
}
|
|
94
|
+
if (existsSync(path.join(cwd, "tailwind.config.js"))) {
|
|
95
|
+
return "tailwind.config.js";
|
|
96
|
+
}
|
|
97
|
+
if (existsSync(path.join(cwd, "tailwind.config.mjs"))) {
|
|
98
|
+
return "tailwind.config.mjs";
|
|
99
|
+
}
|
|
100
|
+
return "tailwind.config.ts";
|
|
101
|
+
}
|
|
102
|
+
function loadConfig(cwd) {
|
|
103
|
+
const configPath = path.join(cwd, "components.json");
|
|
104
|
+
if (!existsSync(configPath)) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
const content = readFileSync(configPath, "utf-8");
|
|
109
|
+
return JSON.parse(content);
|
|
110
|
+
} catch (error) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// src/commands/add.ts
|
|
14
116
|
var REGISTRY_URL = "https://creative-tim.com/ui/r";
|
|
15
|
-
|
|
117
|
+
function expandEnvVars(value) {
|
|
118
|
+
return value.replace(/\$\{([^}]+)\}/g, (_, varName) => {
|
|
119
|
+
return process.env[varName] || "";
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function getAuthHeaders(cwd, opts) {
|
|
123
|
+
const headers = {
|
|
124
|
+
"Accept": "application/json"
|
|
125
|
+
};
|
|
126
|
+
if (opts.apiKey) {
|
|
127
|
+
headers["Authorization"] = `Bearer ${opts.apiKey}`;
|
|
128
|
+
return headers;
|
|
129
|
+
}
|
|
130
|
+
const config = loadConfig(cwd);
|
|
131
|
+
if (config?.registry) {
|
|
132
|
+
if (typeof config.registry === "object" && config.registry.headers) {
|
|
133
|
+
const configHeaders = config.registry.headers;
|
|
134
|
+
for (const [key, value] of Object.entries(configHeaders)) {
|
|
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
|
+
}
|
|
147
|
+
if (process.env.CREATIVE_TIM_API_KEY) {
|
|
148
|
+
headers["Authorization"] = `Bearer ${process.env.CREATIVE_TIM_API_KEY}`;
|
|
149
|
+
}
|
|
150
|
+
return headers;
|
|
151
|
+
}
|
|
152
|
+
var addCommand = new Command().name("add").description("Add a component or block to your project").argument("[components...]", "The components to add").option("-y, --yes", "Skip confirmation prompt").option("-o, --overwrite", "Overwrite existing files").option("--cwd <path>", "The working directory. Defaults to the current directory.", process.cwd()).option("-p, --path <path>", "The path to add the component to").option("--api-key <key>", "API key for accessing private components").action(async (components, opts) => {
|
|
16
153
|
if (!components || components.length === 0) {
|
|
17
154
|
console.error(pc.red("Error: Please specify at least one component to add."));
|
|
18
155
|
console.log(pc.dim("\nExample:"));
|
|
@@ -21,7 +158,7 @@ var addCommand = new Command().name("add").description("Add a component or block
|
|
|
21
158
|
console.log(pc.dim(" npx @creative-tim/ui add software-purchase-01"));
|
|
22
159
|
process.exit(1);
|
|
23
160
|
}
|
|
24
|
-
const cwd =
|
|
161
|
+
const cwd = path2.resolve(opts.cwd || process.cwd());
|
|
25
162
|
console.log(pc.cyan("\n\u{1F4E6} Adding components to your project...\n"));
|
|
26
163
|
for (const component of components) {
|
|
27
164
|
await addComponent(component, cwd, opts);
|
|
@@ -31,9 +168,34 @@ var addCommand = new Command().name("add").description("Add a component or block
|
|
|
31
168
|
async function addComponent(name, cwd, opts) {
|
|
32
169
|
const spinner = ora(`Fetching ${pc.cyan(name)}...`).start();
|
|
33
170
|
try {
|
|
171
|
+
const projectInfo = detectProject(cwd);
|
|
172
|
+
const headers = getAuthHeaders(cwd, opts);
|
|
34
173
|
const url = `${REGISTRY_URL}/${name}.json`;
|
|
35
|
-
const response = await fetch(url);
|
|
174
|
+
const response = await fetch(url, { headers });
|
|
36
175
|
if (!response.ok) {
|
|
176
|
+
if (response.status === 401 || response.status === 403) {
|
|
177
|
+
spinner.fail(`Component ${pc.cyan(name)} requires authentication`);
|
|
178
|
+
try {
|
|
179
|
+
const errorData = await response.json();
|
|
180
|
+
if (errorData.message) {
|
|
181
|
+
console.log(pc.dim(` ${errorData.message}`));
|
|
182
|
+
}
|
|
183
|
+
} catch {
|
|
184
|
+
}
|
|
185
|
+
console.log(pc.dim(`
|
|
186
|
+
This is a private component. Provide an API key using:`));
|
|
187
|
+
console.log(pc.dim(` 1. Environment variable: CREATIVE_TIM_API_KEY=your_key`));
|
|
188
|
+
console.log(pc.dim(` 2. Config file (components.json):`));
|
|
189
|
+
console.log(pc.dim(` "registry": {`));
|
|
190
|
+
console.log(pc.dim(` "url": "https://creative-tim.com/ui",`));
|
|
191
|
+
console.log(pc.dim(` "headers": {`));
|
|
192
|
+
console.log(pc.dim(` "Authorization": "Bearer \${CREATIVE_TIM_API_KEY}"`));
|
|
193
|
+
console.log(pc.dim(` }`));
|
|
194
|
+
console.log(pc.dim(` }`));
|
|
195
|
+
console.log(pc.dim(` 3. Command flag: --api-key YOUR_KEY
|
|
196
|
+
`));
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
37
199
|
spinner.fail(`Component ${pc.cyan(name)} not found`);
|
|
38
200
|
console.log(pc.dim(` Tried: ${url}`));
|
|
39
201
|
return;
|
|
@@ -41,9 +203,10 @@ async function addComponent(name, cwd, opts) {
|
|
|
41
203
|
const data = await response.json();
|
|
42
204
|
spinner.text = `Installing ${pc.cyan(name)}...`;
|
|
43
205
|
for (const file of data.files) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
206
|
+
let installPath = file.target && file.target !== "" ? file.target : file.path;
|
|
207
|
+
installPath = adjustPathForProject(installPath, projectInfo);
|
|
208
|
+
const filePath = path2.join(cwd, installPath);
|
|
209
|
+
const fileDir = path2.dirname(filePath);
|
|
47
210
|
if (fs.existsSync(filePath) && !opts.overwrite && !opts.yes) {
|
|
48
211
|
spinner.warn(`File ${pc.dim(installPath)} already exists. Use --overwrite to replace.`);
|
|
49
212
|
continue;
|
|
@@ -79,17 +242,23 @@ async function addComponent(name, cwd, opts) {
|
|
|
79
242
|
import { Command as Command2 } from "commander";
|
|
80
243
|
import pc2 from "picocolors";
|
|
81
244
|
import prompts from "prompts";
|
|
82
|
-
import { existsSync } from "fs";
|
|
245
|
+
import { existsSync as existsSync2 } from "fs";
|
|
83
246
|
import fs2 from "fs-extra";
|
|
84
|
-
import
|
|
247
|
+
import path3 from "path";
|
|
85
248
|
import ora2 from "ora";
|
|
86
249
|
var initCommand = new Command2().name("init").description("Initialize your project with Creative Tim UI configuration").option("-y, --yes", "Skip prompts and use default values").option("--cwd <path>", "The working directory. Defaults to the current directory.", process.cwd()).action(async (opts) => {
|
|
87
|
-
const cwd =
|
|
250
|
+
const cwd = path3.resolve(opts.cwd || process.cwd());
|
|
88
251
|
console.log(pc2.cyan("\n\u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510"));
|
|
89
252
|
console.log(pc2.cyan("\u2502 Welcome to Creative Tim UI \u2502"));
|
|
90
253
|
console.log(pc2.cyan("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n"));
|
|
91
|
-
const
|
|
92
|
-
|
|
254
|
+
const projectInfo = detectProject(cwd);
|
|
255
|
+
console.log(pc2.dim(`Detected project type: ${pc2.bold(projectInfo.type)}`));
|
|
256
|
+
if (projectInfo.hasSrcDir) {
|
|
257
|
+
console.log(pc2.dim(`Using src directory: ${pc2.bold("src/")}`));
|
|
258
|
+
}
|
|
259
|
+
console.log();
|
|
260
|
+
const componentsJsonPath = path3.resolve(cwd, "components.json");
|
|
261
|
+
if (existsSync2(componentsJsonPath) && !opts.yes) {
|
|
93
262
|
const { overwrite } = await prompts({
|
|
94
263
|
type: "confirm",
|
|
95
264
|
name: "overwrite",
|
|
@@ -103,31 +272,33 @@ var initCommand = new Command2().name("init").description("Initialize your proje
|
|
|
103
272
|
}
|
|
104
273
|
const spinner = ora2("Initializing project...").start();
|
|
105
274
|
try {
|
|
275
|
+
const cssPath = getDefaultCssPath(projectInfo);
|
|
276
|
+
const aliases = getDefaultAliases(projectInfo);
|
|
277
|
+
const tailwindConfig = getTailwindConfigPath(projectInfo);
|
|
106
278
|
const config = {
|
|
107
279
|
"$schema": "https://ui.shadcn.com/schema.json",
|
|
108
280
|
"style": "default",
|
|
109
|
-
"rsc":
|
|
281
|
+
"rsc": projectInfo.type === "nextjs",
|
|
282
|
+
// Only Next.js supports RSC by default
|
|
110
283
|
"tsx": true,
|
|
111
284
|
"tailwind": {
|
|
112
|
-
"config":
|
|
113
|
-
"css":
|
|
285
|
+
"config": tailwindConfig,
|
|
286
|
+
"css": cssPath,
|
|
114
287
|
"baseColor": "slate",
|
|
115
288
|
"cssVariables": true,
|
|
116
289
|
"prefix": ""
|
|
117
290
|
},
|
|
118
|
-
"aliases":
|
|
119
|
-
"components": "@/components",
|
|
120
|
-
"utils": "@/lib/utils",
|
|
121
|
-
"ui": "@/components/ui",
|
|
122
|
-
"lib": "@/lib",
|
|
123
|
-
"hooks": "@/hooks",
|
|
124
|
-
"creative-tim": "@/components/creative-tim"
|
|
125
|
-
},
|
|
291
|
+
"aliases": aliases,
|
|
126
292
|
"registry": "https://creative-tim.com/ui"
|
|
127
293
|
};
|
|
294
|
+
config.$comment = 'For private components, configure registry with headers. Example: "registry": { "url": "https://creative-tim.com/ui", "headers": { "Authorization": "Bearer ${CREATIVE_TIM_API_KEY}" } }';
|
|
128
295
|
await fs2.writeJSON(componentsJsonPath, config, { spaces: 2 });
|
|
129
296
|
spinner.succeed("Project initialized successfully!");
|
|
130
297
|
console.log(pc2.green("\n\u2713 Created components.json"));
|
|
298
|
+
console.log(pc2.dim(`\u2713 Configured for ${projectInfo.type} project`));
|
|
299
|
+
if (projectInfo.hasSrcDir) {
|
|
300
|
+
console.log(pc2.dim(`\u2713 Components will be installed in src/ directory`));
|
|
301
|
+
}
|
|
131
302
|
console.log(pc2.dim("\nNext steps:"));
|
|
132
303
|
console.log(pc2.dim(" 1. Review your components.json"));
|
|
133
304
|
console.log(pc2.dim(" 2. Run: npx @creative-tim/ui add button"));
|
|
@@ -139,7 +310,7 @@ var initCommand = new Command2().name("init").description("Initialize your proje
|
|
|
139
310
|
});
|
|
140
311
|
|
|
141
312
|
// src/index.ts
|
|
142
|
-
import { readFileSync } from "fs";
|
|
313
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
143
314
|
import { fileURLToPath } from "url";
|
|
144
315
|
import { dirname, join } from "path";
|
|
145
316
|
var __filename = fileURLToPath(import.meta.url);
|
|
@@ -147,7 +318,7 @@ var __dirname = dirname(__filename);
|
|
|
147
318
|
var packageVersion = "0.1.0";
|
|
148
319
|
try {
|
|
149
320
|
const packageJsonPath = join(__dirname, "../package.json");
|
|
150
|
-
const packageJsonContent =
|
|
321
|
+
const packageJsonContent = readFileSync2(packageJsonPath, "utf-8");
|
|
151
322
|
const packageJson = JSON.parse(packageJsonContent);
|
|
152
323
|
packageVersion = packageJson.version;
|
|
153
324
|
} catch (error) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/commands/add.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\"\n\nconst REGISTRY_URL = \"https://creative-tim.com/ui/r\"\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 .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 // Fetch component from registry\n const url = `${REGISTRY_URL}/${name}.json`\n const response = await fetch(url)\n\n if (!response.ok) {\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 const installPath = file.target && file.target !== \"\" ? file.target : file.path\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 { 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\"\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 // 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 // Create components.json\n const config = {\n \"$schema\": \"https://ui.shadcn.com/schema.json\",\n \"style\": \"default\",\n \"rsc\": true,\n \"tsx\": true,\n \"tailwind\": {\n \"config\": \"tailwind.config.ts\",\n \"css\": \"app/globals.css\",\n \"baseColor\": \"slate\",\n \"cssVariables\": true,\n \"prefix\": \"\"\n },\n \"aliases\": {\n \"components\": \"@/components\",\n \"utils\": \"@/lib/utils\",\n \"ui\": \"@/components/ui\",\n \"lib\": \"@/lib\",\n \"hooks\": \"@/hooks\",\n \"creative-tim\": \"@/components/creative-tim\"\n },\n \"registry\": \"https://creative-tim.com/ui\"\n }\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(\"\\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(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DAA6D,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","Command","pc","fs","path","ora","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 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,WAAU;AACjB,OAAO,QAAQ;AACf,OAAO,WAAW;;;ACLlB,SAAS,YAAY,oBAAoB;AACzC,OAAO,UAAU;AAaV,SAAS,cAAc,KAA0B;AAEtD,QAAM,kBAAkB,KAAK,KAAK,K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W;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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@creative-tim/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0-beta",
|
|
4
4
|
"description": "A CLI for adding Creative Tim UI components, blocks and AI agents to your project",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Creative Tim",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"type": "module",
|
|
12
12
|
"exports": "./dist/index.js",
|
|
13
13
|
"bin": {
|
|
14
|
-
"creative-tim-ui": "
|
|
15
|
-
"creative-tim": "
|
|
14
|
+
"creative-tim-ui": "dist/index.js",
|
|
15
|
+
"creative-tim": "dist/index.js"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
18
|
"dist",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"repository": {
|
|
29
29
|
"type": "git",
|
|
30
|
-
"url": "https://github.com/creativetimofficial/ui.git",
|
|
30
|
+
"url": "git+https://github.com/creativetimofficial/ui.git",
|
|
31
31
|
"directory": "packages/cli"
|
|
32
32
|
},
|
|
33
33
|
"homepage": "https://creative-tim.com/ui",
|
|
@@ -68,4 +68,3 @@
|
|
|
68
68
|
"typescript": "^5.3.3"
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
|