@creative-tim/ui 0.3.0 ā 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 +40 -0
- package/dist/index.js +74 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -54,6 +54,46 @@ npx @creative-tim/ui@latest add testimonials-01
|
|
|
54
54
|
- `-o, --overwrite` - Overwrite existing files
|
|
55
55
|
- `--cwd <path>` - Specify working directory
|
|
56
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).
|
|
57
97
|
|
|
58
98
|
## Component Types
|
|
59
99
|
|
package/dist/index.js
CHANGED
|
@@ -99,10 +99,57 @@ function getTailwindConfigPath(projectInfo) {
|
|
|
99
99
|
}
|
|
100
100
|
return "tailwind.config.ts";
|
|
101
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
|
+
}
|
|
102
114
|
|
|
103
115
|
// src/commands/add.ts
|
|
104
116
|
var REGISTRY_URL = "https://creative-tim.com/ui/r";
|
|
105
|
-
|
|
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) => {
|
|
106
153
|
if (!components || components.length === 0) {
|
|
107
154
|
console.error(pc.red("Error: Please specify at least one component to add."));
|
|
108
155
|
console.log(pc.dim("\nExample:"));
|
|
@@ -122,9 +169,33 @@ async function addComponent(name, cwd, opts) {
|
|
|
122
169
|
const spinner = ora(`Fetching ${pc.cyan(name)}...`).start();
|
|
123
170
|
try {
|
|
124
171
|
const projectInfo = detectProject(cwd);
|
|
172
|
+
const headers = getAuthHeaders(cwd, opts);
|
|
125
173
|
const url = `${REGISTRY_URL}/${name}.json`;
|
|
126
|
-
const response = await fetch(url);
|
|
174
|
+
const response = await fetch(url, { headers });
|
|
127
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
|
+
}
|
|
128
199
|
spinner.fail(`Component ${pc.cyan(name)} not found`);
|
|
129
200
|
console.log(pc.dim(` Tried: ${url}`));
|
|
130
201
|
return;
|
|
@@ -220,6 +291,7 @@ var initCommand = new Command2().name("init").description("Initialize your proje
|
|
|
220
291
|
"aliases": aliases,
|
|
221
292
|
"registry": "https://creative-tim.com/ui"
|
|
222
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}" } }';
|
|
223
295
|
await fs2.writeJSON(componentsJsonPath, config, { spaces: 2 });
|
|
224
296
|
spinner.succeed("Project initialized successfully!");
|
|
225
297
|
console.log(pc2.green("\n\u2713 Created components.json"));
|
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 } 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,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,O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E,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"]}
|
|
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,KAAK,cAAc;AACrD,MAAI,cAAmB,CAAC;AAExB,MAAI,WAAW,eAAe,GAAG;AAC/B,QAAI;AACF,oBAAc,KAAK,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,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
|
-
|