0.1.18 • Published 7 years ago
generator-react-domain v0.1.18
generator-react-domain
This Generator helps you create connected React components with the Domain file structure :snowflake:
$ tree
.
├── Component.fixtures.js
├── Component.js
├── ComponentActions.js
├── ComponentConstants.js
├── ComponentHelper.js
├── ComponentReducer.js
├── ComponentSelectors.js
├── __tests__
│ ├── Component.test.js
│ ├── ComponentActions.test.js
│ ├── ComponentIntegration.test.js
│ ├── ComponentReducer.test.js
│ └── ComponentSelectors.test.js
├── component.scss
└── index.jsUsage
# install
npm install --global yo generator-react-domain
# run it # destination # name
yo react-domain src/components ComponentNameOptions
--redux- Create Redux files.
Tests
This generator is using an external package called react-redux-test-utils to create light and readable test templates for your components. The package uses enzyme at its core.
Config
create a .yo-rc.json file in your project's root folder and fill it:
{
"generator-react-domain": {
"templatesPath": "path to your templates folder",
"componentsPath": "path to your components folder",
"redux": true # create redux files,
"yarn": true # use yarn instead of npm
}
}Replacing Templates
To learn how to create Templates, refer to ejs.co
1) fill your .yo-rc.json file in your project's root folder with templatesPath as seen above.
- Put supported files in your templates folder, make sure to be case-sensitive.
| File | Description | Has Template |
|---|---|---|
| Component.js | Component | :white_check_mark: |
| Component_test.js | Component Test | :white_check_mark: |
| Actions.js | Redux Actions | :white_check_mark: |
| Actions_test.js | Actions Test | :white_check_mark: |
| Reducer.js | Redux Reducer | :white_check_mark: |
| Reducer_test.js | Reducer Test | :white_check_mark: |
| Selectors.js | Redux Selectors | :white_check_mark: |
| Selectors_test.js | Selectors Test | :white_check_mark: |
| index.js | Index file | :white_check_mark: |
| Integration_test.js | Redux Flow Test | :white_check_mark: |
| Constants.js | Constants | :white_check_mark: |
| Helper.js | Helper methods | |
| Scss.js | SCSS File | |
| Fixtures.js | Fixtures/Mocks |
All Templates receive the following props
<%= name %> # Pascal case name
<%= name_upper %> # Capitalized name
<%= name_lower %> # Camel case nameLicense
0.1.18
7 years ago
0.1.17
7 years ago
0.1.16
7 years ago
0.1.15
7 years ago
0.1.14
7 years ago
0.1.13
7 years ago
0.1.12
7 years ago
0.1.11
7 years ago
0.1.10
7 years ago
0.1.9
7 years ago
0.1.8
7 years ago
0.1.7
7 years ago
0.1.6
7 years ago
0.1.5
7 years ago
0.1.4
7 years ago
0.1.3
7 years ago
0.1.2
7 years ago
0.1.1
7 years ago
0.1.0
7 years ago