rc-cli-tool
v1.0.0
Published
A CLI tool for generating React components, APIs, utils, and contexts files and directories.
Downloads
3
Maintainers
Readme
RC CLI Tool
rc
is a simple command-line tool that allows you to quickly generate React components, APIs, utility files, and context files with pre-defined templates. It helps streamline your React project development by creating the necessary boilerplate code for various types of files.
Table of Contents
Installation
Global Installation
To install rc
globally so that you can use it across all your projects:
npm install -g rc-cli-tool
Local Installation
Alternatively, you can install it locally within your project:
npm install rc-cli-tool --save-dev
Usage
After installation, you can use the rc command to generate components, APIs, utils, and context files.
Basic Command Structure
rc g <type> <name>
g or generate: The command to generate a file.
: The type of file to generate. Can be one of component, api, util, or context. : The name of the component, API, util, or context you want to generate.
Commands
Generate a Component
rc g c <ComponentName>
This will create a new React component in src/components//.
ComponentName.component.js ComponentName.component.css
Generate an API File
rc g a <apiName>
This will create a new API file in src/apis/.
.api.js
Generate a Util File
rc g u <utilName>
This will create a new utility file in src/utils/.
.util.js
Generate a Context File
rc g ctx <contextName>
This will create a new context file in src/context/.
.context.js
Examples
Create a New Component
rc g c Header
This will generate the following files:
Copy code
src/
└── components/
└── Header/
├── Header.component.js
└── Header.component.css
Create a New API File
rc g a users
This will generate the following file:
src/
└── apis/
└── users.api.js
Create a New Utility File
rc g u formatDate
This will generate the following file:
src/
└── utils/
└── formatDate.util.js
Create a New Context File
rc g ctx Auth
This will generate the following file:
Copy code
src/
└── context/
└── Auth.context.js
Contributing
If you want to contribute to this project, feel free to submit issues or pull requests. All contributions are welcome!
Fork the repository
Create your feature branch (git checkout -b feature/your-feature) Commit your changes (git commit -am 'Add your feature') Push to the branch (git push origin feature/your-feature) Create a new Pull Request
License
This project is licensed under the MIT License. See the LICENSE file for details.