A command line interface tool for generating template for React/Redux. Inspired by mantra-cli.
npm install -g overreact
The available commands are:
Currently, CLI expects you to be in the app root directory.
alias: g
Generate a file of type
and name specified name
.
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.
The name should follow the format featureName:entityName
.
Example
overreact generate component todos:subHeader
overreact generate container todos:list
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.
- The number of spaces for indentation. Default: 2.
- Type: number
e.g.
tabSize: 4
- 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
.
- Type of the template
- Possible values:
container
,component
- 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
MIT