@creative-tim/ui 0.2.0-beta → 0.3.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 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
+ [![npm version](https://img.shields.io/npm/v/@creative-tim/ui.svg)](https://www.npmjs.com/package/@creative-tim/ui)
8
+ [![npm downloads](https://img.shields.io/npm/dm/@creative-tim/ui.svg)](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
 
package/dist/index.js CHANGED
@@ -8,9 +8,99 @@ import pc3 from "picocolors";
8
8
  import { Command } from "commander";
9
9
  import pc from "picocolors";
10
10
  import ora from "ora";
11
- import path from "path";
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
+
103
+ // src/commands/add.ts
14
104
  var REGISTRY_URL = "https://creative-tim.com/ui/r";
15
105
  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").action(async (components, opts) => {
16
106
  if (!components || components.length === 0) {
@@ -21,7 +111,7 @@ var addCommand = new Command().name("add").description("Add a component or block
21
111
  console.log(pc.dim(" npx @creative-tim/ui add software-purchase-01"));
22
112
  process.exit(1);
23
113
  }
24
- const cwd = path.resolve(opts.cwd || process.cwd());
114
+ const cwd = path2.resolve(opts.cwd || process.cwd());
25
115
  console.log(pc.cyan("\n\u{1F4E6} Adding components to your project...\n"));
26
116
  for (const component of components) {
27
117
  await addComponent(component, cwd, opts);
@@ -31,6 +121,7 @@ var addCommand = new Command().name("add").description("Add a component or block
31
121
  async function addComponent(name, cwd, opts) {
32
122
  const spinner = ora(`Fetching ${pc.cyan(name)}...`).start();
33
123
  try {
124
+ const projectInfo = detectProject(cwd);
34
125
  const url = `${REGISTRY_URL}/${name}.json`;
35
126
  const response = await fetch(url);
36
127
  if (!response.ok) {
@@ -41,9 +132,10 @@ async function addComponent(name, cwd, opts) {
41
132
  const data = await response.json();
42
133
  spinner.text = `Installing ${pc.cyan(name)}...`;
43
134
  for (const file of data.files) {
44
- const installPath = file.target && file.target !== "" ? file.target : file.path;
45
- const filePath = path.join(cwd, installPath);
46
- const fileDir = path.dirname(filePath);
135
+ let installPath = file.target && file.target !== "" ? file.target : file.path;
136
+ installPath = adjustPathForProject(installPath, projectInfo);
137
+ const filePath = path2.join(cwd, installPath);
138
+ const fileDir = path2.dirname(filePath);
47
139
  if (fs.existsSync(filePath) && !opts.overwrite && !opts.yes) {
48
140
  spinner.warn(`File ${pc.dim(installPath)} already exists. Use --overwrite to replace.`);
49
141
  continue;
@@ -79,17 +171,23 @@ async function addComponent(name, cwd, opts) {
79
171
  import { Command as Command2 } from "commander";
80
172
  import pc2 from "picocolors";
81
173
  import prompts from "prompts";
82
- import { existsSync } from "fs";
174
+ import { existsSync as existsSync2 } from "fs";
83
175
  import fs2 from "fs-extra";
84
- import path2 from "path";
176
+ import path3 from "path";
85
177
  import ora2 from "ora";
86
178
  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 = path2.resolve(opts.cwd || process.cwd());
179
+ const cwd = path3.resolve(opts.cwd || process.cwd());
88
180
  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
181
  console.log(pc2.cyan("\u2502 Welcome to Creative Tim UI \u2502"));
90
182
  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 componentsJsonPath = path2.resolve(cwd, "components.json");
92
- if (existsSync(componentsJsonPath) && !opts.yes) {
183
+ const projectInfo = detectProject(cwd);
184
+ console.log(pc2.dim(`Detected project type: ${pc2.bold(projectInfo.type)}`));
185
+ if (projectInfo.hasSrcDir) {
186
+ console.log(pc2.dim(`Using src directory: ${pc2.bold("src/")}`));
187
+ }
188
+ console.log();
189
+ const componentsJsonPath = path3.resolve(cwd, "components.json");
190
+ if (existsSync2(componentsJsonPath) && !opts.yes) {
93
191
  const { overwrite } = await prompts({
94
192
  type: "confirm",
95
193
  name: "overwrite",
@@ -103,31 +201,32 @@ var initCommand = new Command2().name("init").description("Initialize your proje
103
201
  }
104
202
  const spinner = ora2("Initializing project...").start();
105
203
  try {
204
+ const cssPath = getDefaultCssPath(projectInfo);
205
+ const aliases = getDefaultAliases(projectInfo);
206
+ const tailwindConfig = getTailwindConfigPath(projectInfo);
106
207
  const config = {
107
208
  "$schema": "https://ui.shadcn.com/schema.json",
108
209
  "style": "default",
109
- "rsc": true,
210
+ "rsc": projectInfo.type === "nextjs",
211
+ // Only Next.js supports RSC by default
110
212
  "tsx": true,
111
213
  "tailwind": {
112
- "config": "tailwind.config.ts",
113
- "css": "app/globals.css",
214
+ "config": tailwindConfig,
215
+ "css": cssPath,
114
216
  "baseColor": "slate",
115
217
  "cssVariables": true,
116
218
  "prefix": ""
117
219
  },
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
- },
220
+ "aliases": aliases,
126
221
  "registry": "https://creative-tim.com/ui"
127
222
  };
128
223
  await fs2.writeJSON(componentsJsonPath, config, { spaces: 2 });
129
224
  spinner.succeed("Project initialized successfully!");
130
225
  console.log(pc2.green("\n\u2713 Created components.json"));
226
+ console.log(pc2.dim(`\u2713 Configured for ${projectInfo.type} project`));
227
+ if (projectInfo.hasSrcDir) {
228
+ console.log(pc2.dim(`\u2713 Components will be installed in src/ directory`));
229
+ }
131
230
  console.log(pc2.dim("\nNext steps:"));
132
231
  console.log(pc2.dim(" 1. Review your components.json"));
133
232
  console.log(pc2.dim(" 2. Run: npx @creative-tim/ui add button"));
@@ -139,7 +238,7 @@ var initCommand = new Command2().name("init").description("Initialize your proje
139
238
  });
140
239
 
141
240
  // src/index.ts
142
- import { readFileSync } from "fs";
241
+ import { readFileSync as readFileSync2 } from "fs";
143
242
  import { fileURLToPath } from "url";
144
243
  import { dirname, join } from "path";
145
244
  var __filename = fileURLToPath(import.meta.url);
@@ -147,7 +246,7 @@ var __dirname = dirname(__filename);
147
246
  var packageVersion = "0.1.0";
148
247
  try {
149
248
  const packageJsonPath = join(__dirname, "../package.json");
150
- const packageJsonContent = readFileSync(packageJsonPath, "utf-8");
249
+ const packageJsonContent = readFileSync2(packageJsonPath, "utf-8");
151
250
  const packageJson = JSON.parse(packageJsonContent);
152
251
  packageVersion = packageJson.version;
153
252
  } 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(\" 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,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,OAAO,WAAW;AAElB,IAAM,eAAe;AAed,IAAM,aAAa,IAAI,QAAQ,EACnC,KAAK,KAAK,EACV,YAAY,0CAA0C,EACtD,SAAS,mBAAmB,uBAAuB,EACnD,OAAO,aAAa,0BAA0B,EAC9C,OAAO,mBAAmB,0BAA0B,EACpD,OAAO,gBAAgB,6DAA6D,QAAQ,IAAI,CAAC,EACjG,OAAO,qBAAqB,kCAAkC,EAC9D,OAAO,OAAO,YAAsB,SAAS;AAC5C,MAAI,CAAC,cAAc,WAAW,WAAW,GAAG;AAC1C,YAAQ,MAAM,GAAG,IAAI,sDAAsD,CAAC;AAC5E,YAAQ,IAAI,GAAG,IAAI,YAAY,CAAC;AAChC,YAAQ,IAAI,GAAG,IAAI,mCAAmC,CAAC;AACvD,YAAQ,IAAI,GAAG,IAAI,wCAAwC,CAAC;AAC5D,YAAQ,IAAI,GAAG,IAAI,iDAAiD,CAAC;AACrE,YAAQ,KAAK,CAAC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B;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,qBAAqB,aAAa,iBAAiB,OAAO;AAChE,QAAM,cAAc,KAAK,MAAM,kBAAkB;AACjD,mBAAiB,YAAY;AAC/B,SAAS,OAAO;AAEhB;AAEA,eAAe,OAAO;AACpB,QAAM,UAAU,IAAII,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","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 } from \"../utils/project.js\"\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 // Detect project type\n const projectInfo = detectProject(cwd)\n\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 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","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 = {\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 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,KAA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AAiB,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.2.0-beta",
3
+ "version": "0.3.0",
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",