+10
-7
@@ -7,9 +7,12 @@ import chalk from "chalk"; | ||
| const __dirname = path.dirname(__filename); | ||
| // PascalCase: animatedtabs → Animatedtabs | ||
| const pascalCase = (str) => str.replace(/(^\w|-\w)/g, (match) => match.replace("-", "").toUpperCase()); | ||
| export async function addComponent(name) { | ||
| const componentName = pascalCase(name); // animated-tabs -> AnimatedTabs | ||
| const source = path.resolve(__dirname, "../../src/components", componentName); | ||
| const target = path.resolve(process.cwd(), "components/ui", componentName); | ||
| if (!(await fs.pathExists(source))) { | ||
| console.log(chalk.red(`❌ Component "${componentName}" not found.`)); | ||
| const folderName = pascalCase(name); // Folder: Animatedtabs | ||
| const fileName = `${name}.tsx`; // File: animatedtabs.tsx | ||
| const source = path.resolve(__dirname, "../../src/components/ui", folderName, fileName); | ||
| const target = path.resolve(process.cwd(), "components/ui", folderName, fileName); | ||
| const exists = await fs.pathExists(source); | ||
| if (!exists) { | ||
| console.log(chalk.red(`❌ Component "${name}" not found.\nExpected at: ${source}`)); | ||
| return; | ||
@@ -19,4 +22,4 @@ } | ||
| await fs.copy(source, target); | ||
| console.log(chalk.green(`✅ Copied ${componentName} to components/ui/${componentName}`)); | ||
| console.log(chalk.yellow(`👉 Make sure Tailwind is configured if this component uses classes or animations.`)); | ||
| console.log(chalk.green(`✅ Copied ${fileName} to components/ui/${folderName}/`)); | ||
| console.log(chalk.yellow(`👉 Usage: import { AnimatedTabs } from "@/components/ui/${folderName}/${fileName.replace(".tsx", "")}"`)); | ||
| } |
+1
-1
| { | ||
| "name": "zedblock", | ||
| "version": "0.0.11", | ||
| "version": "0.0.12", | ||
| "type": "module", | ||
@@ -5,0 +5,0 @@ "bin": { |
Unpublished package
Supply chain riskPackage version was not found on the registry. It may exist on a different registry and need to be configured to pull from that registry.
Unpublished package
Supply chain riskPackage version was not found on the registry. It may exist on a different registry and need to be configured to pull from that registry.
2467
7.21%49
6.52%