diff --git a/Makefile b/Makefile index 31b25c1..1a9314e 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ test: prepare-when-local ifeq ($(CI),true) npx jest --ci else - npx jest --watch + npx --node-arg --inspect=9241 jest --watch endif deploy: diff --git a/README.md b/README.md index a71a3e7..8aa8154 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,8 @@ what will be the action's payload (or, if you'd prefer, you can return both a payload and meta.) ```typescript +import { createActions } from 'redux-easy-mode' + export default createActions('example', { // A simple action with no arguments or payload increment: () => undefined, @@ -54,6 +56,8 @@ export default createActions('example', { It uses a builder pattern, so return types are inferred for you. ```typescript +import { createReducer } from 'redux-easy-mode' + import actions from './actions' const initialState = { @@ -132,7 +136,7 @@ This will dispatch 3 actions, in this order: ```typescript import { applyMiddleware, createStore } from 'redux' -import asyncMiddleware from 'redux-easy-mode/async/asyncMiddleware' +import { asyncMiddleware } from 'redux-easy-mode' const configureStore = applyMiddleware(asyncMiddleware())(createStore) ``` @@ -248,7 +252,7 @@ of the state changes based on a selector. ```typescript import { applyMiddleware, createStore } from 'redux' -import sideEffectMiddleware from 'redux-easy-mode/sideEffects/sideEffectMiddleware' +import { sideEffectMiddleware } from 'redux-easy-mode' const configureStore = applyMiddleware(sideEffectMiddleware())(createStore) ``` @@ -260,6 +264,8 @@ given access to the store, and can optionally return a function to do some cleanup. ```ts +import { reduxActionSideEffect } from 'redux-easy-mode' + reduxActionSideEffect(actions.increment, ({ action, dispatch, getState }) => { console.log(`${actions.increment.actionConstant} was dispatched`) @@ -278,6 +284,8 @@ changed. You are given access to the store, and can optionally return a function to do some cleanup. ```ts +import { reduxSelectorSideEffect } from 'redux-easy-mode' + reduxSelectorSideEffect( (state: RootState) => state.some.value, ({ value, previousValue, dispatch, getState }) => { diff --git a/package.json b/package.json index 9e2970f..b1e88a2 100755 --- a/package.json +++ b/package.json @@ -36,6 +36,8 @@ "lib/createReducer.js", "lib/createReducer.test.d.ts", "lib/createReducer.test.js", + "lib/index.d.ts", + "lib/index.js", "lib/isReduxActionCreator.d.ts", "lib/isReduxActionCreator.js", "lib/sideEffects/reduxActionSideEffect.d.ts", @@ -47,14 +49,6 @@ "lib/sideEffects/reduxSelectorSideEffect.test.d.ts", "lib/sideEffects/reduxSelectorSideEffect.test.js", "lib/sideEffects/sideEffectMiddleware.d.ts", - "lib/sideEffects/sideEffectMiddleware.js", - "lib/test/helpers/setup.d.ts", - "lib/test/helpers/setup.js", - "lib/test/testActions.d.ts", - "lib/test/testActions.js", - "lib/test/testReducer.d.ts", - "lib/test/testReducer.js", - "lib/test/testStore.d.ts", - "lib/test/testStore.js" + "lib/sideEffects/sideEffectMiddleware.js" ] } diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..7c9a670 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,6 @@ +export { default as createActions } from './createActions' +export { default as createReducer } from './createReducer' +export { default as asyncMiddleware } from './async/asyncMiddleware' +export { default as sideEffectMiddleware } from './sideEffects/sideEffectMiddleware' +export { default as reduxActionSideEffect } from './sideEffects/reduxActionSideEffect' +export { default as reduxSelectorSideEffect } from './sideEffects/reduxSelectorSideEffect'