ui-test-package-001
v1.0.2
Published
Neuland UI component library built with React, TypeScript, and Tailwind CSS
Downloads
14
Maintainers
Readme
@nhoo-test/ui
A UI component library that automatically syncs components from the root project.
🚀 Quick Start
Copy Components from Root Project
This package automatically copies components from your root project. You have several options:
Option 1: Copy Default Components (Button + Input)
npm run copyOption 2: Copy Specific Components
# Copy only button and input
npm run copy:button-input
# Copy all available components
npm run copy:all
# Copy specific components using Node.js script
npm run copy:js button input cardOption 3: Use Node.js Script Directly
# Copy specific components
node copy-components.js button input card
# Copy default components (button, input)
node copy-components.jsBuild the Package
npm run build📦 Available Scripts
npm run copy- Copy default components (button, input) using batch filenpm run copy:js- Copy default components using Node.js scriptnpm run copy:all- Copy all available componentsnpm run copy:button-input- Copy only button and input componentsnpm run build- Copy components and build the packagenpm run dev- Watch mode for developmentnpm run type-check- Run TypeScript type checking
🔄 Workflow
- Make changes to components in your root project (
src/components/ui/) - Copy components to the UI package:
npm run copy - Build the package:
npm run build - Publish or use the updated package
📁 File Structure
packages/ui/
├── src/
│ ├── components/
│ │ ├── button/
│ │ │ ├── button.tsx
│ │ │ └── index.ts
│ │ └── input/
│ │ ├── input.tsx
│ │ └── index.ts
│ ├── lib/
│ │ └── utils.ts
│ └── index.ts
├── dist/ # Built package
├── copy-components.bat # Windows batch script
├── copy-components.js # Node.js script
└── package.json🎯 Usage in Other Projects
import { Button, Input } from '@nhoo-test/ui';
function MyComponent() {
return (
<div>
<Button variant="default">Click me</Button>
<Input placeholder="Enter text" />
</div>
);
}⚙️ Configuration
The copy scripts automatically:
- ✅ Copy components from
../../src/components/ui/tosrc/components/ - ✅ Update import paths from
@/lib/utilsto../../lib/utils - ✅ Clean up utils.ts to remove external dependencies
- ✅ Generate proper index.ts files
- ✅ Update the main index.ts with all components
🔧 Adding New Components
To add new components to the package:
- Add the component to your root project (
src/components/ui/) - Update the copy script to include the new component:
# Copy specific components including the new one npm run copy:js button input card dialog - Build the package:
npm run build
📝 Notes
- The package automatically resolves import paths
- External dependencies are cleaned up in utils.ts
- All components maintain the same API as the root project
- TypeScript declarations are automatically generated
