forked from BiosBoy/coconat
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request BiosBoy#5 from BiosBoy/packageJson-upgrade
Package json upgrade
- Loading branch information
Showing
23 changed files
with
2,290 additions
and
377 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
// Jest tesitng config. Responce for app tests. | ||
module.exports = { | ||
cacheDirectory: '<rootDir>/.tmp/jest', | ||
coverageDirectory: './.tmp/coverage', | ||
moduleNameMapper: { | ||
'^.+\\.(scss)$': 'identity-obj-proxy' | ||
'^.+\\.(css|scss|cssmodule)$': 'identity-obj-proxy' | ||
}, | ||
modulePaths: ['<rootDir>'], | ||
moduleFileExtensions: ['js', 'jsx', 'json'], | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'], | ||
globals: { | ||
NODE_ENV: 'test' | ||
}, | ||
verbose: true, | ||
testRegex: '(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$', | ||
testRegex: '(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js|jsx)$', | ||
testPathIgnorePatterns: ['/node_modules/', '/__tests__/mocks/.*'], | ||
transformIgnorePatterns: ['.*(node_modules)(?!.*torn.*).*$'], | ||
coveragePathIgnorePatterns: ['typings.d.ts'], | ||
transformIgnorePatterns: ['.*(node_modules).*$'], | ||
transform: { | ||
'^.+\\.js$': 'babel-jest' | ||
'^.+\\.jsx?$': 'babel-jest', | ||
'^.+\\.tsx?$': 'ts-jest' | ||
}, | ||
setupFiles: ['<rootDir>/setupTests.js'], | ||
setupFiles: ['<rootDir>/setupTests.js', '<rootDir>/node_modules/whatwg-fetch/fetch.js'], | ||
snapshotSerializers: ['enzyme-to-json/serializer'] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const COUNT_ADD = 'COUNT_ADD'; | ||
// consts for Saga asyc actions, probably you do not need this below | ||
export const SOME_SAGA = 'SOME_SAGA'; | ||
export const SOME_ASYNC_ACTION = 'SOME_ASYNC_ACTION'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,24 @@ | ||
import React, { PureComponent } from 'react'; | ||
import { PropTypes } from 'prop-types'; | ||
import React from 'react'; | ||
import { Provider } from 'react-redux'; | ||
import { Header, Footer, HelloWorld } from '../components'; | ||
import styles from '../styles/index.scss'; | ||
|
||
class AppContainer extends PureComponent { | ||
render() { | ||
return ( | ||
const AppContainer = ({ store, history }) => { | ||
return ( | ||
<Provider store={store} history={history}> | ||
<div className={styles.appWrapper}> | ||
<Header /> | ||
<HelloWorld /> | ||
<Footer /> | ||
</div> | ||
); | ||
} | ||
} | ||
</Provider> | ||
); | ||
}; | ||
|
||
AppContainer.propTypes = { | ||
store: PropTypes.object.isRequired, | ||
history: PropTypes.object.isRequired | ||
}; | ||
|
||
export default AppContainer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { COUNT_ADD, SOME_ASYNC_ACTION } from '../constants'; | ||
|
||
const addCount = count => ({ | ||
type: COUNT_ADD, | ||
count | ||
}); | ||
|
||
const someAsyncAction = payload => ({ | ||
type: SOME_ASYNC_ACTION, | ||
payload | ||
}); | ||
|
||
export { addCount, someAsyncAction }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const initialState = { | ||
common: { | ||
appName: 'react-suspense' | ||
} | ||
}; | ||
|
||
export default initialState; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import logger from './reduxLogger'; | ||
import makeRootReducer, { injectReducer } from './rootReducer'; | ||
import sagaMiddleware, { rootSaga, cancelTask, injectSaga, runSaga } from './rootSaga'; | ||
|
||
export { logger, makeRootReducer, injectReducer, sagaMiddleware, rootSaga, cancelTask, injectSaga, runSaga }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { createLogger } from 'redux-logger'; | ||
|
||
const logger = createLogger({ | ||
collapsed: true, | ||
timestamp: false, | ||
diff: true | ||
}); | ||
|
||
export default logger; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { combineReducers } from 'redux'; | ||
import { routerReducer as routing } from 'react-router-redux'; | ||
import common from '../reducers'; | ||
|
||
const makeRootReducer = asyncReducers => { | ||
return combineReducers({ | ||
...asyncReducers, | ||
common, | ||
routing | ||
}); | ||
}; | ||
|
||
export const injectReducer = (store, { key, reducer }) => { | ||
if (Object.hasOwnProperty.call(store.asyncReducers, key)) return; | ||
store.asyncReducers[key] = reducer; | ||
|
||
store.replaceReducer(makeRootReducer(store.asyncReducers)); | ||
}; | ||
|
||
export default makeRootReducer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// saga entry point - propbably you do not need it | ||
import createSagaMiddleware from 'redux-saga'; | ||
import { all } from 'redux-saga/effects'; | ||
import createSagaMiddlewareHelpers from 'redux-saga-watch-actions/lib/middleware'; | ||
import someSaga from '../saga'; | ||
|
||
const sagaMiddleware = createSagaMiddleware(); | ||
const runSaga = saga => sagaMiddleware.run(saga); | ||
|
||
const { injectSaga, cancelTask } = createSagaMiddlewareHelpers(sagaMiddleware); // <-- bind to sagaMiddleware.run | ||
|
||
export function* rootSaga() { | ||
yield all([someSaga()]); | ||
} | ||
|
||
export { cancelTask, injectSaga, runSaga }; | ||
export default sagaMiddleware; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { COUNT_ADD, SOME_ASYNC_ACTION } from '../constants'; | ||
import initialState from './initialState'; | ||
|
||
// ------------------------------------ | ||
// Action Handlers | ||
// ------------------------------------ | ||
const ACTION_HANDLERS = { | ||
[COUNT_ADD]: (state, action) => ({ | ||
...state, | ||
count: action.count, | ||
countDoubl: action.count % 2 === 0 ? action.count : state.countDoubl | ||
}), | ||
[SOME_ASYNC_ACTION]: (state, action) => ({ | ||
...state, | ||
...action.payload | ||
}) | ||
}; | ||
|
||
// ------------------------------------ | ||
// Reducer | ||
// ------------------------------------ | ||
const reducer = (state = initialState, action) => { | ||
const handler = ACTION_HANDLERS[action.type]; | ||
|
||
return handler ? handler(state, action) : state; | ||
}; | ||
|
||
export default reducer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { takeLatest } from 'redux-saga/effects'; | ||
import { testSaga } from './testSaga'; | ||
import { SOME_SAGA } from '../../constants'; | ||
|
||
export default function* watchSagas() { | ||
yield takeLatest(SOME_SAGA, testSaga); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { put } from 'redux-saga/effects'; | ||
import { someAsyncAction } from '../actions'; | ||
|
||
export function* testSaga() { | ||
try { | ||
const payload = yield fetch('https://www.github.com'); | ||
|
||
// some payload from the responce recived | ||
if (!payload) { | ||
throw new Error('Error in payload!'); | ||
} | ||
yield put(someAsyncAction(payload)); | ||
} catch (error) { | ||
throw new Error('Some error in sagas occured!'); | ||
} | ||
} | ||
|
||
export default testSaga; |
Oops, something went wrong.