1.0.4 • Published 8 years ago
generator-comp-react v1.0.4
React generator is a simple command line tool to generate React and React Native components, including stateless components and redux connected components, and redux containers.
Install
npm install -g generator-comp-react
or
yarn global add generator-comp-react
Usage
generator-comp-react [options...]
Options
-H or --help: displays the usage--componentPath: defaults to./src/components. Root folder of the components location.--containerPath: defaults to./src/containers. Root folder of the containers location.--functional=true|false: defaults tofalse. If true, creates a functional component.--pure=true|false: defaults totrue. If true, extends PureComponent instead of Component.--container=true|false: defaults tofalse. If true, creates a redux connected component. Thefunctionaloption won't be used in that case. Creates the associated component in thecomponentPathlocation.--withRedux=true|false: defaults tofalse. If true, connect the component with redux. Defaults totruewhencontaineristrue--native=true|false: defaults tofalse. If true, imports the basic stuff from react-native (View, StyleSheet), renders a View instead of a div, and creates a basic StyleSheet. When native is false, a separate css file is created.--name=ComponentName: defaults toMyComponent. Sets the component name. Whencontaineris set to true, will automatically suffix the name withContainer, so for exampleMyAwesomeComponentwill transform intoMyAwesomeComponentContainer.--withPropTypes=true|false: defaults totrue. If set to true, imports the prop-types package and add thepropTypesanddefaultPropsfields to the component.--separateDir=true|false: defaults totrue. If set to true, will create a folder with the component's name, with an index.js, the component's file and its css (if not native). If set to false, will just create the component's file and its css into thecomponentPathfolder.
Note: passing an option without any value will be considered as a true value if it can evaluate to true, for example --withPropTypes is the same as --withPropTypes=true but --componentPath wont update the componentPath value.