+11
-12
@@ -5,17 +5,16 @@ import chalk from "chalk"; | ||
| import { fileURLToPath } from "url"; | ||
| import { toPascalCase } from "../utils/fs.js"; | ||
| const __filename = fileURLToPath(import.meta.url); | ||
| const __dirname = path.dirname(__filename); | ||
| /** | ||
| * Copy the AnimatedTabs component from: | ||
| * src/components/ui/AnimatedTabs/animated-tabs.tsx | ||
| */ | ||
| function toPascalCase(str) { | ||
| return str.replace(/(^\w|-\w)/g, (m) => m.replace("-", "").toUpperCase()); | ||
| } | ||
| export async function addComponent(name) { | ||
| const pascalName = toPascalCase(name); // animatedtabs → AnimatedTabs | ||
| const sourceFile = path.resolve(__dirname, "../../src/components/ui", pascalName, `${name}.tsx`); | ||
| const targetDir = path.resolve(process.cwd(), "components/ui", pascalName); | ||
| const targetFile = path.join(targetDir, `${name}.tsx`); | ||
| const folderName = toPascalCase(name); // e.g. Animatedtabs | ||
| const fileName = `${folderName}.tsx`; // e.g. Animatedtabs.tsx | ||
| const sourceFile = path.resolve(__dirname, "../../src/components/ui", folderName, fileName); | ||
| const targetDir = path.resolve(process.cwd(), "components/ui", folderName); | ||
| const targetFile = path.join(targetDir, fileName); | ||
| const exists = await fs.pathExists(sourceFile); | ||
| if (!exists) { | ||
| console.log(chalk.red(`❌ Component "${pascalName}" not found at ${sourceFile}`)); | ||
| console.log(chalk.red(`❌ Component not found.\nExpected at: ${sourceFile}\nMake sure the component folder and file follow PascalCase.`)); | ||
| return; | ||
@@ -25,4 +24,4 @@ } | ||
| await fs.copyFile(sourceFile, targetFile); | ||
| console.log(chalk.green(`✅ Copied ${name}.tsx to components/ui/${pascalName}/`)); | ||
| console.log(chalk.yellow(`👉 Make sure Tailwind plugins or animation utilities are set up if needed.`)); | ||
| console.log(chalk.green(`✅ ${fileName} copied to components/ui/${folderName}/`)); | ||
| console.log(chalk.yellow(`👉 Import using: import { AnimatedTabs } from "@/components/ui/Animatedtabs/Animatedtabs";`)); | ||
| } |
+1
-1
| { | ||
| "name": "zedblock", | ||
| "version": "0.0.6", | ||
| "version": "0.0.7", | ||
| "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.
3185
2.54%76
-1.3%