Simple React Cli (Typescript)
Developed upon the work of vue-generate-component.
Developed within a couple of hours so expect bugs.
CLI util for generating React components.
READ THIS FIRST
This is not a replacement for react. You must have setup React project separately
Installation
npm install -g @pratheeshrussell/simple-react-cli
OR
- Clone the repository
- Run
npm install
- Build the Files
npm run build
- Install from local folder
npm install -g PATH_TO_CLONED FOLDER
OR
npm install -g https://github.com/pratheeshrussell/simple-react-cli
Usage
Create new component
src-ts -g -c Header
Will generate a folder called headerComponent
inside src folder If you are in project root folder or your current directory
check the options available by
src-ts -g -h
Create new hook
src-ts -g --hook something
Will get back to this once I learn more about react hooks. For now it will generate a function that starts with the keyword use
and export it.
Redux toolkit options
src-ts --rtk --store storage
Will generate a store
src-ts --rtk --slice auth
will generate a slice but you must manually add it to the store.
src-ts --rtk --api auth
will generate a sample Query and a Mutation but you must manually add it to the store.
Will add more commands once I learn more about it.
Serve
src-ts -s
check the options available by
src-ts -s -h
Build
src-ts -b
Disclaimer
This project tries to solve tedious copy&paste operations from our daily workflow. Please notice that the generated files will require some external libraries for react and redux toolkit. Make sure these libraries are available in your project.
TODO
- Do some manual testing atleast
- ...