Your Component Library Scaffold Tool
Component Dock is a powerful CLI tool that helps you quickly scaffold modern React component libraries with shadcn/ui integration, TypeScript support, and production-ready build configuration.
Modern React projects heavily rely on third-party component libraries like shadcn/ui, which work great for small teams and projects. However, as teams grow and projects scale, several critical issues emerge:
🚨 Team Collaboration Challenges:
- Multiple developers modifying the same components simultaneously
- One person's changes breaking existing functionality for others
- Inconsistent component implementations across different features
- Difficulty tracking who changed what and when
- No centralized control over component behavior and styling
- Duplicated component logic scattered across the codebase
- Hard to maintain design system consistency
- Challenging to implement organization-wide design updates
🔧 Maintenance Nightmares:
- Direct dependency on external component libraries without abstraction
- Breaking changes in third-party libraries affecting the entire project
- Difficulty in customizing components to match specific requirements
- No version control over component modifications
🎯 Standardization & Control:
- Centralized component definitions that everyone follows
- Version-controlled component changes with proper review processes
- Consistent API and behavior across your entire organization
- Custom components tailored to your specific design requirements
👥 Team Efficiency:
- Clear ownership and contribution guidelines for components
- Reusable components across multiple projects
- Reduced development time through shared component ecosystem
- Better collaboration through well-defined component interfaces
🔄 Long-term Maintainability:
- Easy to update, test, and deploy component changes
- Independence from third-party library breaking changes
- Ability to gradually migrate or update underlying technologies
- Documentation and examples that grow with your team's needs
Component Dock bridges this gap by providing you with a production-ready foundation to build and maintain your own component library, giving you the best of both worlds: the speed of shadcn/ui components and the control of your own ecosystem.
- 🚀 Quick Setup - Create a complete component library in seconds
- 📦 Dual Package Support - Builds both CommonJS and ESM formats
- 🔧 TypeScript Ready - Full TypeScript support with proper declarations
- 🎭 Tailwind CSS - Pre-configured with custom design tokens
- 📱 Modern Build Stack - Rollup, PostCSS, and optimized bundling
- 🎯 Interactive Setup - Guided project configuration
- 📖 Complete Documentation - Generated README and usage examples
npm install -g component-docknpx component-dock create my-librarycomponent create my-awesome-libraryThe CLI will guide you through an interactive setup:
🚀 Creating component library: my-awesome-library
? Library description: A collection of awesome React components
? Choose package manager: npm
my-awesome-library/
├── src/
│ ├── components/
│ │ └── ui/ # shadcn/ui components go here
│ ├── lib/
│ │ └── utils.ts # Utility functions (cn helper)
│ ├── styles/
│ │ └── globals.css # Global styles and CSS variables
│ └── index.ts # Main export file
├── dist/ # Built files (generated)
│ ├── cjs/ # CommonJS build
│ ├── esm/ # ES Modules build
│ ├── styles/ # Compiled CSS
│ └── index.d.ts # Type declarations
├── package.json # Package configuration
├── tsconfig.json # TypeScript configuration
├── rollup.config.js # Build configuration
├── tailwind.config.js # Tailwind CSS configuration
├── postcss.config.js # PostCSS configuration
├── components.json # shadcn/ui configuration
└── README.md # Project documentation
# Create a new component library
component create <project-name>
# Create with options
component create my-library --skip-install
# Show help
component --help
# Show version
component --versionCreates a new component library project.
Options:
--skip-install- Skip automatic dependency installation
Example:
component create design-system --skip-installAfter creating your library, navigate to the project directory and start developing:
cd my-awesome-library
# Install dependencies (if not already installed)
npm install
# Start development with watch mode
npm run dev
# Build the library
npm run build
# Type checking
npm run type-check
# Clean build artifacts
npm run cleanYou're absolutely right! The "Adding Components" section should be more comprehensive and flexible. Here's a better version:
Your project comes pre-configured for shadcn/ui components, but you have complete flexibility in how you build your component library:
# Add specific components
npx shadcn-ui@latest add button input
# Interactive component selection
npx shadcn-ui@latest addCreate your own components from scratch:
# Create a new component directory
mkdir src/components/ui/custom-button
# Add your component files
touch src/components/ui/custom-button/index.tsx
touch src/components/ui/custom-button/custom-button.stories.tsxInstall and integrate components from other libraries:
# Radix UI primitives
npm install @radix-ui/react-dialog @radix-ui/react-dropdown-menu
You can also copy and adapt components from:
- shadcn/ui components - Copy source code directly
- Radix UI examples - Use their component patterns
- Tailwind UI - Adapt their component designs
- Other open-source component libraries
After adding any components, make sure to export them from your main index.ts file:
// src/index.ts
export { Button } from './components/ui/button';
export { Input } from './components/ui/input';
export { CustomButton } from './components/ui/custom-button';The generated project includes these npm scripts:
{
"scripts": {
"build": "rollup -c",
"dev": "rollup -c -w",
"lint": "eslint src --ext .ts,.tsx",
"type-check": "tsc --noEmit",
"clean": "rm -rf dist"
}
}The build process generates:
dist/cjs/- CommonJS modules for Node.js compatibilitydist/esm/- ES modules for modern bundlersdist/index.d.ts- TypeScript declaration filesdist/styles/- Compiled CSS files
Your component library comes with:
Runtime Dependencies:
@radix-ui/react-slot- Primitive componentsclass-variance-authority- Variant API for componentsclsx- Conditional className utilitytailwind-merge- Tailwind class merginglucide-react- Icon librarytslib- TypeScript runtime helpers
Development Dependencies:
- Full TypeScript support
- Rollup build configuration
- Tailwind CSS with plugins
- ESLint setup
After building and publishing your library:
npm install my-awesome-libraryimport { Button, Input } from 'my-awesome-library';
import 'my-awesome-library/dist/styles/globals.css';
function App() {
return (
<div>
<Button variant="primary">Click me</Button>
<Input placeholder="Enter text..." />
</div>
);
}# Build your library
npm run build
# Publish to npm
npm publishWe welcome contributions! Please feel free to submit a Pull Request.
# Clone the repository
git clone https://github.com/aaqeb11/component-dock.git
# Install dependencies
npm install
# Link for local development
npm link
# Test the CLI
component create test-libraryMIT License - see the LICENSE file for details.
Component Dock - ⚓ Scaffold your component libraries with confidence