react-component-genie
Version:
CLI tool for generating themed React components with ease
118 lines (81 loc) • 2.89 kB
Markdown
with consistent structure and best practices. Stop writing boilerplate code and let the Genie do the work for you!
- 🚀 Quick component generation
- 📦 Consistent file structure
- 🎨 Customizable templates
- 🔧 Zero dependencies
- 💡 Smart defaults
- 🎯 TypeScript/JavaScript support
- 🌀 Works with any JS Frameworks like React,Next,Vue
```bash
npm install -g react-component-genie
pnpm install -g react-component-genie
npx react-component-genie
```
```bash
rcg
rcg --help
rcg -h
rcg --version
rcg -v
rcg init
```
```bash
rcg
rcg -t <TEMPLATE_PATH>
rcg -o <OUTPUT_PATH>
rcg -it
rcg -it 0
```
| Property | Description |
| --- | --- |
| outputPath | The folder that genie writes files in to |
| templatePath | The folder that the template file resides |
| includeTypeFile | This creates a type file along with component file (component.type.ts) |
## Variables in Template File
We also support variables in template files.Variables can be wrapped around `{{}}` like `{{componentName}}`
Currently we only support these variables
- componentName
This will be replace with the name given while generating component using `rcg` cmd
Example:
```
import React, { useEffect, useState } from 'react';
import alwaysUse from '../../alwaysUse';
/**
* {{componentName}}
**/
const {{componentName}} = () => {
//===== states =======//
//===== functions =======//
//===== effects =======//
return (
<div> </div>
)
}
export default {{componentName}}
```
It is also possible to use variable in template file names.
for example , if we create a template file like
```{{componentName}}.component.js ```
this will be generated like `Input.component.js` for a component name `Input`
Mohammed Ashik KP - [GitHub](https://github.com/Mohammed-Ashik-KP)
Project Link: [https://github.com/Mohammed-Ashik-KP/react-component-genie](https://github.com/Mohammed-Ashik-KP/react-component-genie)
A magical CLI tool that generates themed React components