0.0.4 ā€¢ Published 3 years ago

@enoveh/react-component-generator v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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-generator

Add script

// package.json on rootDir
{
  "scripts": {
    "comgen-init": "comgen init",
    "comgen-generate": "comgen generate"
  }
}

Usages

Init

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

Generate 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.json

TODO

  • Put in the name of component when the component generated
  • Error handling
  • Configure options for jsx, tsx
  • Setup options on CLI
0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago