0.0.4 ⢠Published 5 years ago
@enoveh/react-component-generator v0.0.4
react-component-generator
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. š
Installation
Module install
# npm
npm install @enoveh/react-component-generator
# yarn
yarn add -D @enoveh/react-component-generatorAdd script
// package.json on rootDir
{
"scripts": {
"comgen-init": "comgen init",
"comgen-generate": "comgen generate"
}
}Usages
Init
yarn run comgen-initYou 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.jsonGenerate Component
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.
Result
<specified_component_root_loc> // default as src/components
āā __tests__
ā āā Component.test.tsx
āā index.tsx
āā styles.tsx
āā types.ts
āā config.jsonTODO
- Put in the name of component when the component generated
- Error handling
- Configure options for
jsx,tsx - Setup options on CLI