summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-core
diff options
context:
space:
mode:
Diffstat (limited to 'packages/gitbook-core')
-rw-r--r--packages/gitbook-core/package.json3
-rw-r--r--packages/gitbook-core/src/createPlugin.js2
-rw-r--r--packages/gitbook-core/src/createStore.js6
3 files changed, 7 insertions, 4 deletions
diff --git a/packages/gitbook-core/package.json b/packages/gitbook-core/package.json
index c75f05d..387a610 100644
--- a/packages/gitbook-core/package.json
+++ b/packages/gitbook-core/package.json
@@ -24,7 +24,8 @@
"scripts": {
"dist-lib": "rm -rf lib/ && babel -d lib/ src/",
"dist-standalone": "browserify -r ./lib/index.js:gitbook-core -r react -r react-dom ./lib/index.js | uglifyjs -c > gitbook.core.min.js",
- "prepublish": "npm run dist-lib && npm run dist-standalone"
+ "dist": "npm run dist-lib && npm run dist-standalone",
+ "prepublish": "npm run dist"
},
"repository": {
"type": "git",
diff --git a/packages/gitbook-core/src/createPlugin.js b/packages/gitbook-core/src/createPlugin.js
index c26d745..d00c99d 100644
--- a/packages/gitbook-core/src/createPlugin.js
+++ b/packages/gitbook-core/src/createPlugin.js
@@ -7,6 +7,8 @@
* @return {Plugin}
*/
function createPlugin(onInitialState, onReduceState) {
+ onReduceState = onReduceState || ((state, action) => state);
+
const plugin = {
onInitialState,
onReduceState
diff --git a/packages/gitbook-core/src/createStore.js b/packages/gitbook-core/src/createStore.js
index c13f219..4873190 100644
--- a/packages/gitbook-core/src/createStore.js
+++ b/packages/gitbook-core/src/createStore.js
@@ -13,12 +13,12 @@ const reducers = require('./reducers');
*/
function createStore(plugins, initialState) {
const pluginReducers = plugins.map(plugin => plugin.onReduceState);
+ console.log(pluginReducers);
const reducer = Redux.compose(reducers, ...pluginReducers);
-
const store = Redux.createStore(
- reducer,
+ reducers,
initialState,
- Redux.applyMiddleware(ReduxThunk)
+ Redux.compose(Redux.applyMiddleware(ReduxThunk))
);
// Initialize the plugins