react-generate-comp
TypeScript icon, indicating that this package has built-in type declarations

1.5.0 • Public • Published

react-generate-comp

Generate React components in current execute directory by typing with CLI.

Features

  1. Create a basic components with ts / js config.
  2. Follow the practice of react official ts / js docs.
  3. Generate Components / Slice / useState in one line.
  4. 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

  1. Add react native component generate -n flag

- 1.4.5

  1. Add zustand template to rgc --init

- 1.4.3

  1. Cli '-c', '-s' will not overwrite file that already exist in the current path.

- 1.4.1 / 1.4.2

  1. init project javascript will not generate interface folder from now.

- 1.4.0

  1. Added rgc --init prompt features.
  2. Added RTK generate in init project features.

- 1.3.2

  1. Fixing bug on prompt cancel issues.
  2. Fixing RTKSlice Ts spacing issues.
  3. Better reminder prompt.
  4. Added rgc --init functions for init project folder data.

- 1.3.0

  1. Updated generate log syntax.
  2. Now typing rgc will active a prompts interface to select regarding generate stuff.
  3. Color log improvement.

- 1.2.x

  1. Added rgc -u <setState_name> generate function.

Package Sidebar

Install

npm i react-generate-comp

Weekly Downloads

3

Version

1.5.0

License

MIT

Unpacked Size

24.9 kB

Total Files

18

Last publish

Collaborators

  • r48n34