ZedBlock UI Library CLI
A powerful CLI tool for managing and deploying UI components with automatic scanning, dependency management, and docs generation.
🚀 Quick Start
npm install
node index.js init
node index.js list
node index.js add button
./scripts/deploy-component.sh button
./scripts/deploy-component-scan-basic.sh
📋 Table of Contents
Installation
- Clone the repository
- Install dependencies:
npm install
- Build the CLI:
npm run build
Commands
init
Initialize the CLI configuration in your project.
node index.js init
list
List all available components in the registry.
node index.js list
add <component-name>
Add a specific component to your project.
node index.js add button
node index.js add card
🆕 Auto-Scan Deployment
Revolutionary Component Detection 🔍
We've introduced intelligent auto-scanning that eliminates the need to manually specify component names. The system automatically detects and deploys components that exist in all required locations.
Requirements for Auto-Deployment
A component will be automatically deployed if it exists in:
cli/ui/<component-name>.tsx - Component implementation file
cli/components.json - Component definition with dependencies
cli/component-variants.tsx - Component variants (optional, but recommended)
Auto-Scan Scripts
🎯 Basic Auto-Scan (Recommended)
./scripts/deploy-component-scan-basic.sh
- Uses existing
deploy-component.sh logic
- Scans and validates all components
- Deploys only components that meet all requirements
- Provides detailed reporting
⚡ Advanced Auto-Scan
./scripts/deploy-component-auto-scan.sh
- Built-in deployment logic
- Automatically updates DynamicComponentRenderer
- Advanced variant handling
- Complete automation
Example Output
🔍 AUTO-SCANNING FOR DEPLOYABLE COMPONENTS (Basic Mode)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
📋 Step 1: Scanning cli/ui/ for component files...
✅ Found 23 component files
📋 Step 2: Validating components...
✅ button: Ready for deployment
✅ card: Ready for deployment
❌ alert: Not ready (missing in components.json)
📊 Validation Summary:
✅ Valid for deployment: 19 components
❌ Invalid/incomplete: 4 components
🚀 Step 3: Deploying 19 valid components...
🎯 Successfully deployed components:
• button → http://localhost:3000/components/button
• card → http://localhost:3000/components/card
• form → http://localhost:3000/components/form
[... and 16 more]
Benefits
- 🔥 Zero Manual Work - No need to specify component names
- 🛡️ Safe Deployment - Only deploys components that meet all requirements
- 📊 Clear Reporting - See what was deployed and what was skipped
- 🔄 Repeatable - Run anytime to deploy new components
- 📦 Dependency Management - Auto-installs all required packages
Component Structure
For a component to be auto-deployable, ensure it has:
1. Component File (cli/ui/<name>.tsx)
import * as React from "react";
import { cn } from "../lib/utils";
export interface ComponentProps {
}
const Component = React.forwardRef<HTMLDivElement, ComponentProps>(
({ className, ...props }, ref) => {
return (
<div ref={ref} className={cn("base-styles", className)} {...props} />
);
}
);
Component.displayName = "Component";
export { Component };
2. Component Definition (cli/components.json)
{
"components": {
"component-name": {
"name": "component-name",
"type": "components:ui",
"dependencies": ["@radix-ui/react-slot"],
"files": [{ "name": "component-name.tsx", "content": "" }],
"category": "Form",
"subcategory": "Input"
}
}
}
3. Component Variants (cli/component-variants.tsx)
export const componentVariants: ComponentVariants = {
"component-name": [
{
name: "Default",
description: "Basic component usage",
code: `import { Component } from "@/components/ui/component-name"
export function ComponentDemo() {
return <Component>Hello World</Component>
}`,
},
],
};
Deployment Scripts
Manual Deployment
./scripts/deploy-component.sh button
./scripts/deploy-component-auto.sh button
./scripts/deploy-all-components.sh
Auto-Scan Deployment (New)
./scripts/deploy-component-scan-basic.sh
./scripts/deploy-component-auto-scan.sh
Sync Scripts
./scripts/sync-component.sh button
./scripts/sync-component-full.sh button
./scripts/sync-all-components.sh
Development Workflow
Adding a New Component
-
Create the component file
touch cli/ui/my-component.tsx
-
Add to components.json
-
Add variants
-
Auto-deploy
./scripts/deploy-component-scan-basic.sh
Updating Components
Simply run the auto-scan script to redeploy all components:
./scripts/deploy-component-scan-basic.sh
🔧 Script Comparison
deploy-component.sh | ✅ | ❌ | ❌ | Single component |
deploy-component-auto.sh | ✅ | ❌ | ✅ | Single component + renderer |
deploy-all-components.sh | ❌ | ⚠️ (basic) | ❌ | All components (old) |
deploy-component-scan-basic.sh | ❌ | ✅ | ❌ | Auto-scan (recommended) |
deploy-component-auto-scan.sh | ❌ | ✅ | ✅ | Auto-scan + advanced features |
Tips for Auto-Scan Success
- Keep components.json updated - Missing entries will cause components to be skipped
- Add variants for better docs - Components without variants will deploy but with warnings
- Run regularly - Auto-scan is safe to run multiple times
- Check skipped components - The script tells you exactly what's missing
Contributing
- Fork the repository
- Create your feature branch
- Add components following the structure above
- Run auto-scan deployment to test
- Submit a pull request
License
MIT License - see LICENSE.md for details.
🚀 Pro Tip: Use ./scripts/deploy-component-scan-basic.sh for the best automated deployment experience!