react-generate-comp
v1.5.0
Published
Generate React components in current execute directory by typing with CLI.
Downloads
18
Maintainers
Readme
react-generate-comp
Generate React components in current execute directory by typing with CLI.
Features
- Create a basic components with ts / js config.
- Follow the practice of react official ts / js docs.
- Generate Components / Slice / useState in one line.
- No configs, easy to use with prompts.
Setup / Install:
npm i -g react-generate-comp
Usage:
Generate Components
rgc <typescript Flag> -c <Components name>
rgc <typescript Flag> -c <Components name>
Generate RTK Slice
rgc <typescript Flag> -s <Slice name>
<typescript Flag>
-t, --typescript For enable typescript tsx generate
<react native Flag>
-n, --native For generate react native components
<Components name>
-c, --generateComp for Generate comp name
<Slice name>
-s, --generateRTKSlice Generate RTK slice
<useState name>
-u, --generateUseState Generate useState line code to your clipboard
Usage:
Create a tsx components named "HelloComp" for `React`
rgc -t -c "helloComp"
rgc -tc "helloComp"
Create a jsx components named "Yolocomp" for `React`
rgc -c "yolocomp"
Create a tsx components named "HelloComp" for `React native`
rgc -t -n -c "helloComp"
rgc -tnc "helloComp"
Create a jsx components named "Yolocomp" for `React native`
rgc -n -c "yolocomp"
rgc -nc "yolocomp"
Create a jsx RTK Slice named "NotTodoSlice"
rgc -s "notTodo"
Create a useState named with "[ number, setNumber ]"
rgc -u number
Create a set of folder and file for init the new Vite / CRP project
rgc --init
Generated template
rgc -t -c "testComp"
or rgc -tc "testComp"
Template
rgc -c "hiComp"
Template
rgc -t -s "todo"
or rgc -ts "todo"
Template
rgc -s "todo"
Template
Road map
- [x] First class typescript support
- [x] Generate other related stuff
- [ ] Init more template
Dev logs
- 1.5.0
- Add react native component generate
-n
flag
- 1.4.5
- Add zustand template to
rgc --init
- 1.4.3
- Cli '-c', '-s' will not overwrite file that already exist in the current path.
- 1.4.1 / 1.4.2
init project javascript
will not generate interface folder from now.
- 1.4.0
- Added
rgc --init
prompt features. - Added RTK generate in init project features.
- 1.3.2
- Fixing bug on prompt cancel issues.
- Fixing RTKSlice Ts spacing issues.
- Better reminder prompt.
- Added
rgc --init
functions for init project folder data.
- 1.3.0
- Updated generate log syntax.
- Now typing
rgc
will active a prompts interface to select regarding generate stuff. - Color log improvement.
- 1.2.x
- Added
rgc -u <setState_name>
generate function.