babel-plugin-s2s-reducer-root

generate state types

Usage no npm install needed!

<script type="module">
  import babelPluginS2sReducerRoot from 'https://cdn.skypack.dev/babel-plugin-s2s-reducer-root';
</script>

README

babel-plugin-s2s-reducer-root

s2s plugin: compose state types

Install

$ npm install --save-dev babel-plugin-s2s-reducer-root

Example

IN:


OUT:

// @flow
import { combineReducers } from 'redux';
import App from "../__fixtures__/app/reducer";
import Bob from "../__fixtures__/bob/reducer";

export default combineReducers({
  App,
  Bob
});

Usage

{
  ['s2s-reducer-root', {
    input: 'containers/**/reducer.js',
    output: 'reducer.js',
    globOptions: {}
  }]
}

input

type: string
required: true

glob pattern.

output

type: string
required: true

outputh path.

globOptions

type: Object
default: {}

See https://github.com/isaacs/node-glob#options

combineReducers

type: string
required: false
defualt: "redux"

If you need customized combineReducers like redux-persist, set that path or module name.

{
  ['s2s-reducer-root', { combineReducers: './path/to/yourCombineReducers'}]
}

Output:

import { combineReducers } from './path/to/yourCombineReducers'