reactjs-component-cli
v3.0.9
Published
React component generator CLI
Maintainers
Readme
Hi, I'm Dewanshu! 👋
Made with ❤️ for React developers.
🛠️ CLI for React
A powerful and flexible CLI tool to interactively generate React components, pages, context, or providers — with full support for JavaScript or TypeScript, styles, testing, and configurable paths.
✨ Features
- 🔧 Interactive CLI
- ⚛️ Generate:
- React Components
- Pages
- 🧠 Supports both JavaScript and TypeScript
- 🎨 Style file support (
css,scss, with optional CSS Modules) - 🧪 Optional test file using React Testing Library
- 📂 Custom output path or generate in the current directory
- 🛠️ Configurable via
.componentclirc.json
📦 Installation
You can use it globally or locally — your choice!
📌 Option 1: Global install
npm install -g reactjs-component-cli
create-component [options]
Example 1: create-component -c
Example 2: create-component --path < your custom path >📌 Option 2: Use via npx
npm install reactjs-component-cli
npx create-component [options]
Example 1: npx create-component -c
Example 2: npx create-component --path < your custom path >📌 Option 3: As an npm script in your project
Step 1: npm install reactjs-component-cli
Step 2: Add this to package.json scripts:
"scripts": {
"generate": "create-component"
},
Step 3: Run this command in terminal "npm run generate [options]"
Example 1: npm run generate -c
Example 2: npm run generate --path < your custom path >🛠️ CLI Options
| Parameter | Type | Description |
| :---------------- | :-------- | :---------------------------------------------------------------------------- |
| <ComponentName> | string | Required. Name of the React component to generate |
| --path,-p | string | Custom relative path to place the component (e.g. shared/ui) |
| --current,-c | boolean | Generate the component inside a components/ folder in the current directory |
