wpd-cli-polaris
v1.0.0
Published
A command-line interface for managing and installing React Native components from the WPD component registry.
Maintainers
Readme
WPD CLI - Component Library Manager
A command-line interface for managing and installing React Native components from the WPD component registry.
Installation
npm install -g @weprodev/wpd-cli-polarisOr use it directly with npx:
npx @weprodev/wpd-cli-polaris <command>Quick Start
Initialize a new project:
wpd initList available components:
wpd listAdd a component:
wpd add button
Commands
wpd init
Initializes a new wpd-cli project in the current directory.
wpd initWhat it does:
- Creates
wpd.config.jsonconfiguration file - Sets up the components directory structure
- Installs required dependencies
- Optionally installs core dependencies (react-native-unistyles, react-native-reanimated)
wpd list
Lists all available components from the registry.
wpd list [options]Options:
-c, --category <category>- Filter by category (components, forms, sheets, configs, utilities, types)
Examples:
# List all components
wpd list
# List only UI components
wpd list --category components
# List utility functions
wpd list --category utilities
# List TypeScript types
wpd list --category typeswpd add
Adds a component from the registry to your project.
wpd add <component> [options]Arguments:
<component>- Name of the component to add
Options:
-c, --category <category>- Component category (components, forms, sheets, configs, utilities, types)--overwrite- Overwrite existing files without confirmation-y, --yes- Skip all confirmation prompts
Examples:
# Add a button component
wpd add button
# Add a form component
wpd add sign-in-form --category forms
# Add utility functions
wpd add helper-styles --category utilities
# Add with auto-confirmation
wpd add confirmation-input --yes
# Force overwrite existing files
wpd add text-input --overwriteComponent Categories
The WPD registry organizes components into the following categories:
📦 Components
UI components like buttons, inputs, progress bars, etc.
button- Customizable button componenttext-input- Text input with validationconfirmation-input- OTP/confirmation code inputselect-box- Dropdown select component- And many more...
📋 Forms
Complete form components with validation.
sign-in-form- User authentication formsign-up-form- User registration formforgot-password-form- Password recovery formnew-password-form- Password reset form
📄 Sheets
Bottom sheet and modal components.
verification-code-sheet- OTP verification modal
⚙️ Configs
Configuration and theme files.
theme- Complete theme setup with styling configuration
🛠️ Utilities
Helper functions and styling utilities.
helper-styles- Dynamic styling utilitiesutils- Collection of utility functions
📝 Types
TypeScript type definitions.
types- Input states and theme declarations
Configuration
The wpd.config.json file is created during initialization and contains:
{
"version": "1.0.0",
"componentsDir": "./src/shared/components",
"aliases": {
"@components": "./src/shared/components",
"@styles": "./src/shared/styles",
"@types": "./src/shared/types"
}
}Configuration Options:
version- CLI versioncomponentsDir- Directory where components will be installedaliases- Path aliases for different component types
Dependencies
Components may require the following peer dependencies:
react-native-unistyles- Styling systemreact-native-reanimated- Animation libraryreact-native-nitro-modules- Required by unistylesreact-native-edge-to-edge- Required by unistyles
The CLI will notify you of required dependencies when adding components.
Internal Dependencies
Components can have internal dependencies that are automatically resolved:
- When you add a component, the CLI automatically installs its dependencies
- Dependencies are resolved across different categories (e.g., a component can depend on utilities or types)
- No manual intervention required - everything is handled automatically
Example:
When adding confirmation-input, the CLI automatically installs:
helper-styles(from utilities category)types(from types category)
File Structure
After initialization and adding components, your project structure will look like:
your-project/
├── wpd.config.json
├── src/
│ └── shared/
│ ├── components/
│ │ ├── Button/
│ │ ├── TextInput/
│ │ └── ConfirmationInput/
│ ├── styles/
│ │ └── helper.style.ts
│ └── types/
│ ├── input.type.ts
│ └── react-native-unistyles.d.ts
└── ...Environment Variables
For development or custom registry usage, you can set:
# GitHub token for private repositories (optional)
export GITHUB_TOKEN=your_github_token
# Custom registry URL (optional)
export WPD_REGISTRY_URL=https://your-custom-registry.com/registry.jsonTroubleshooting
Component not found
❌ Component "my-component" not found in registrySolution: Check available components with wpd list or verify the component name.
No wpd-cli project found
❌ No wpd-cli project found. Run "wpd init" first.Solution: Run wpd init in your project directory first.
File already exists
File Button.tsx already exists. Overwrite? (y/N)Solution: Use --overwrite flag or --yes to skip confirmations.
Missing dependencies
📋 Required packages for components to work properly:
Make sure you have these packages installed:
• react-native-unistyles
• react-native-reanimatedSolution: Install the listed dependencies using your package manager.
Contributing
To contribute to the WPD CLI or component registry:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
License
MIT License - see LICENSE file for details.
Support
For issues and questions:
- GitHub Issues: Create an issue
- Documentation: This README file
Happy coding with WPD CLI! 🚀
