Skip to content

React template generator that can help you maintain a convention of the team.

Notifications You must be signed in to change notification settings

devethan/react-component-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

React template generator that can help you maintain a convention of the team.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published