rc-cli-tool
v1.0.0
Published
A CLI tool for generating React components, APIs, utils, and contexts files and directories.
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-toolLocal Installation
Alternatively, you can install it locally within your project:
npm install rc-cli-tool --save-devUsage
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 HeaderThis will generate the following files:
Copy code
src/
└── components/
└── Header/
├── Header.component.js
└── Header.component.cssCreate a New API File
rc g a usersThis will generate the following file:
src/
└── apis/
└── users.api.jsCreate a New Utility File
rc g u formatDateThis will generate the following file:
src/
└── utils/
└── formatDate.util.jsCreate a New Context File
rc g ctx AuthThis will generate the following file:
Copy code
src/
└── context/
└── Auth.context.jsContributing
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.
