Skip to content

kmhigashioka/overreact

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overreact

Build Status

A command line interface tool for generating template for React/Redux. Inspired by mantra-cli.

Installation

npm install -g overreact

Documentation

The available commands are:

Currently, CLI expects you to be in the app root directory.


overreact generate [type] [name]

alias: g

Generate a file of type and name specified name.

type

Possible values are:

  • component

Generates component using ES2015 class extending React.Component. overreact generate component todos:add

  • container

Generates a container and its corresponding component with duck.js. overreact generate component todos:add

For component, container tests will also be generated.

name

The name should follow the format featureName:entityName.

Example

overreact generate component todos:subHeader
overreact generate container todos:list

Customization

overreact allows you to easily customize its behaviors. Currently, you can customize:

  • tab size
  • templates

You may customize overreact by editing overreact_cli.yaml on the root directory of your project.

tab size

  • The number of spaces for indentation. Default: 2.
  • Type: number

e.g.

tabSize: 4

templates

  • The content of the templates generated by CLI
  • Type: array

e.g.

templates:
  - name: 'component'
    text: |
      import React from 'react';
      const <%= componentName %> = ({}) => {
        return (
          <div>
            <%= componentName %>
          </div>
        );
      }

Individual template configurations must have name, and text.

name

  • Type of the template
  • Possible values: container, component

text

  • The content of the template to be generated by the CLI.

Internally, this template will be evaluated by lodash's template function to dynamically insert variables. You need to pass variable names surrounded by <%= and %>.

If you pass insufficient variable names, the CLI will throw you an error.

Variables needed for each templates are:

component

  • componentName
  • featureName

container

  • componentName
  • componentFileName
  • containerName
  • featureName

License

MIT