Customized component template generator for React-native. (ReactJS will also be added)
Once setup this module on your project, you can easily add a component that follow your specific guideline. 👍
# npm
npm install @enoveh/react-component-generator
# yarn
yarn add -D @enoveh/react-component-generator
// package.json on rootDir
{
"scripts": {
"comgen-init": "comgen init",
"comgen-generate": "comgen generate"
}
}
yarn run comgen-init
You can configure where the component will be generated. And then .comgen
folder will be created on <rootDir>
. This includes all of the .comgen
configurations following below structure.
.comgen/
├─ templates // each properties presents thier template
│ └─ Component.tsx
│ └─ Component.test.tsx
│ └─ styles.tsx
│ └─ types.ts
└─ config.json
yarn run comgen-generate <Component_name>
Just executes above command, it can generate all of files of the component to the location that you've specified.
You want to change the file structure? All you have to do is change the code.
<specified_component_root_loc> // default as src/components
├─ __tests__
│ └─ Component.test.tsx
├─ index.tsx
├─ styles.tsx
├─ types.ts
└─ config.json
- Put in the name of component when the component generated
- Error handling
- Configure options for
jsx
,tsx
- Setup options on CLI