UNPKG

reactjs-component-cli

Version:

React component generator CLI

70 lines (49 loc) โ€ข 2.17 kB
# 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 ```bash 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 ```bash 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 ```bash 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 |