From aef4bf27709cac77ca5965853d78b47f9b423e2e Mon Sep 17 00:00:00 2001 From: Shota Matsushita Date: Thu, 24 Nov 2016 00:58:04 +0900 Subject: [PATCH] =?UTF-8?q?reactotron=E5=B0=8E=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/Config/Reactotron.js | 9 +++++++++ App/Stores/Store.development.js | 8 +++++--- App/Stores/Store.production.js | 28 ++++++++++++++++++++++++++++ package.json | 3 +++ 4 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 App/Config/Reactotron.js diff --git a/App/Config/Reactotron.js b/App/Config/Reactotron.js new file mode 100644 index 0000000..82e07a1 --- /dev/null +++ b/App/Config/Reactotron.js @@ -0,0 +1,9 @@ +import Reactotron from 'reactotron-react-js'; +import { reactotronRedux } from 'reactotron-redux'; +import sagaPlugin from 'reactotron-redux-saga'; + +export default Reactotron + .configure({ name: 'difftron connect' }) + .use(reactotronRedux()) + .use(sagaPlugin()) + .connect(); diff --git a/App/Stores/Store.development.js b/App/Stores/Store.development.js index d2367c9..e2bc998 100644 --- a/App/Stores/Store.development.js +++ b/App/Stores/Store.development.js @@ -1,12 +1,14 @@ -import { createStore, applyMiddleware, compose } from 'redux'; +import { applyMiddleware, compose } from 'redux'; import createSagaMiddleware from 'redux-saga'; import { autoRehydrate } from 'redux-persist'; import rootReducer from '../Reducers/'; import sagas from '../Sagas/'; import persistTransform from '../Services/ImmutablePersistenceTransform'; +import Reactotron from '../Config/Reactotron'; const middleware = []; -const sagaMiddleware = createSagaMiddleware(); +const sagaMonitor = Reactotron.createSagaMonitor(); +const sagaMiddleware = createSagaMiddleware({ sagaMonitor }); middleware.push(sagaMiddleware); const enhancers = []; @@ -17,7 +19,7 @@ export default () => { enhancers.push(autoRehydrate()); // Store生成 - const store = createStore(rootReducer, compose(...enhancers)); + const store = Reactotron.createStore(rootReducer, compose(...enhancers)); // state永続化設定 persistTransform(store); diff --git a/App/Stores/Store.production.js b/App/Stores/Store.production.js index e69de29..d2367c9 100644 --- a/App/Stores/Store.production.js +++ b/App/Stores/Store.production.js @@ -0,0 +1,28 @@ +import { createStore, applyMiddleware, compose } from 'redux'; +import createSagaMiddleware from 'redux-saga'; +import { autoRehydrate } from 'redux-persist'; +import rootReducer from '../Reducers/'; +import sagas from '../Sagas/'; +import persistTransform from '../Services/ImmutablePersistenceTransform'; + +const middleware = []; +const sagaMiddleware = createSagaMiddleware(); +middleware.push(sagaMiddleware); + +const enhancers = []; + +// createStore +export default () => { + enhancers.push(applyMiddleware(...middleware)); + enhancers.push(autoRehydrate()); + + // Store生成 + const store = createStore(rootReducer, compose(...enhancers)); + // state永続化設定 + persistTransform(store); + + // run sagas + sagaMiddleware.run(sagas); + + return store; +}; diff --git a/package.json b/package.json index 410dd33..348f970 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,9 @@ "extract-text-webpack-plugin": "^1.0.1", "nyc": "^10.0.0", "proxyquire": "^1.7.10", + "reactotron-react-js": "^1.5.2", + "reactotron-redux": "^1.5.2", + "reactotron-redux-saga": "^1.5.2", "style-loader": "^0.13.1", "webpack": "^1.13.2", "webpack-dev-middleware": "^1.8.4",