An open API service indexing awesome lists of open source software.

https://github.com/robertherber/template-redux-module

SAO template to generate Redux Modules under an existing project
https://github.com/robertherber/template-redux-module

duck-typing javascript modules react react-native redux sao template

Last synced: 3 months ago
JSON representation

SAO template to generate Redux Modules under an existing project

Awesome Lists containing this project

README

          

# template-redux-module

[![CircleCI]( https://img.shields.io/circleci/project/github/robertherber/template-redux-module.svg)](https://circleci.com/gh/robertherber/template-redux-module) ![NMPVersion](https://img.shields.io/npm/v/template-redux-module.svg)

> SAO template to generate a Redux Module

[SAO](https://github.com/egoist/sao) is a scaffolding tool.

Use this SAO template to generate one new redux module in your project. This is not meant to set up the base structure - but rather add new modules adhering to the structure that's described below.

The template will generate a folder with the following files:
* `modules//actions.js`
* `modules//reducer.js`
* `modules//selectors.js`

It will also generate a `__tests__` folder with corresponding files and example tests:
* `modules//__tests__/actions.js`
* `modules//__tests__/reducer.js`
* `modules//__tests__/selectors.js`

If you want to put your module at another relative path - use the second parameter to SAO to specify another folder (see Usage for examples).

Obviously this is an opinionated Redux structure and is meant as such. For me I find it easy to work with - and I feel it scales well in bigger projects. Do feel free to contribute your thoughts on how to improve this template.

## Usage

Install [SAO](https://github.com/egoist/sao) first.

```bash
yarn global add sao
# or
npm i -g sao
```

### From npm

```bash
sao redux-module
```

or if you want to specify your own folder instead of 'modules/':

```bash
sao redux-module redux-stuff/my-own-modules-folder
```

### From git

```bash
sao robertherber/template-redux-module
```

or if you want to specify your own folder instead of 'modules/':

```bash
sao robertherber/template-redux-module redux-stuff/my-own-modules-folder
```

## License

MIT © [Robert Herber](https://github.com/robertherber)