A Yeoman generator for React & Redux for projects basing on the ducks structure structured on routes.
This generator works for vertically integrated React and Redux projects. The sub-generator will create modules/features for you with a smaller version of the ducks structure. Each module is self-contained.
For this generator to work, Yeoman must be globally installed.
npm install -g yoThen you can install this react-redux-ducks-structure-generator module.
npm install -g react-redux-ducks-structure-generatorCreates the base project. Loosely based off React-starter-kit. The entrie app is not ducks structure yet.
yo react-redux-ducks-structure-generatorThis will compile base files, including the Source, and Tools folders. (tests pending)
| Option | Description | Default |
|---|---|---|
-h, --help |
Print the generator's options and usage | |
--skip-cache |
Do not remember prompt answers | Default: false |
--skip-install |
Do not automatically install dependencies | Default: false |
The sub generators assumes you already have a project up and running. They are to help you through developing new modules, components, etc.
When you need to start creating new modules/features, simple use the sub-generator module.
yo react-redux-ducks-structure-generator:module [options] <moduleName>Within the module sub-generator, the following default files are generated for you. Replace with your own module name.
| Option | Description | Default |
|---|---|---|
-h, --help |
Print the generator's options and usage | |
--skip-cache |
Do not remember prompt answers | Default: false |
--skip-install |
Do not automatically install dependencies | Default: false |
| Arguments | Description | Type | Required |
|---|---|---|---|
| moduleName | Name of the module | String | true |
The following command will generate the following:
yo react-redux-modules:module auth
# Generates the auth folder feature with all necessary filesIf you want to create a component other modules depend on, this sub-generator will create the files needed for you.
Within the component sub-generator, the following default files are generated for you. Replace #{CommonComponentName} with your own module name.
.
└── src
└── common
└── components
└── CommonComponentName
├── CommonComponentName.js
├── CommonComponentName.scss
└── package.json| Arguments | Description | Type | Required |
|---|---|---|---|
| componentName | Name of the module | String | true |
| componentRoot | Name of the module | String | true |
| Option | Description | Default |
|---|---|---|
-h, --help |
Print the generator's options and usage | |
--skip-cache |
Do not remember prompt answers | Default: false |
--skip-install |
Do not automatically install dependencies | Default: false |
--raw |
Use user input raw format for component name | Default: false |
The following command will generate the following:
yo react-redux-modules:component TextBox ./src/common/components --raw
# Generates the following:
.
└── src
└── common
└── components
└── TextBox
├── TextBox.js
├── TextBox.scss
└── package.jsonIf you want to generate an action test, for a known module, this sub-generator will help.
Within the component sub-generator, the following default files are generated for you.
Replace #{module} and #{action} with your own module and action names.
.
└── test
└── unit
└── module
└── actions
└── action.spec.js| Arguments | Description | Type | Required |
|---|---|---|---|
| module | Name of the module | String | true |
| action | Name of the action | String | true |
The following command will generate the following:
yo react-redux-modules:actionTests Analytics Partners
# Generates the following:
.
└── test
└── unit
└── Analytics
└── actions
└── Partners.spec.js