From 818c95d42a8047bca0a97ccb902175a93b5486bc Mon Sep 17 00:00:00 2001 From: Yevhen Uzhva Date: Sat, 6 May 2017 13:54:46 +0300 Subject: [PATCH 1/8] =?UTF-8?q?=D0=A1onfigure=20the=20Redux=20+=20react-re?= =?UTF-8?q?dux.=20Create=20global=20store?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 +++- src/index.js | 8 +++++++- src/store.js | 7 +++++++ yarn.lock | 58 ++++++++++++++++++++++++++++++++++++++++++---------- 4 files changed, 64 insertions(+), 13 deletions(-) create mode 100644 src/store.js diff --git a/package.json b/package.json index 8caf2b6..edf45a8 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,9 @@ "private": true, "dependencies": { "react": "^15.5.4", - "react-dom": "^15.5.4" + "react-dom": "^15.5.4", + "react-redux": "^5.0.4", + "redux": "^3.6.0" }, "devDependencies": { "react-scripts": "0.9.5" diff --git a/src/index.js b/src/index.js index 54c5ef1..6f20bec 100644 --- a/src/index.js +++ b/src/index.js @@ -1,9 +1,15 @@ import React from 'react'; import ReactDOM from 'react-dom'; +import { Provider } from 'react-redux'; + +import store from './store'; + import App from './App'; import './index.css'; ReactDOM.render( - , + + + , document.getElementById('root') ); diff --git a/src/store.js b/src/store.js new file mode 100644 index 0000000..44e9ee6 --- /dev/null +++ b/src/store.js @@ -0,0 +1,7 @@ +import { createStore } from 'redux'; + +const store = createStore( + () => {} // empty function to init store; +); + +export default store; diff --git a/yarn.lock b/yarn.lock index b89ed1d..f448f00 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1318,6 +1318,13 @@ cosmiconfig@^2.1.0, cosmiconfig@^2.1.1: parse-json "^2.2.0" require-from-string "^1.1.0" +create-react-class@^15.5.1: + version "15.5.2" + resolved "https://registry.yarnpkg.com/create-react-class/-/create-react-class-15.5.2.tgz#6a8758348df660b88326a0e764d569f274aad681" + dependencies: + fbjs "^0.8.9" + object-assign "^4.1.1" + cross-spawn@4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41" @@ -2358,6 +2365,10 @@ hoek@2.x.x: version "2.16.3" resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" +hoist-non-react-statics@^1.0.3: + version "1.2.0" + resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-1.2.0.tgz#aa448cf0986d55cc40773b17174b7dd066cb7cfb" + home-or-tmp@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz#e36c3f2d2cae7d746a857e38d18d5f32a7882db8" @@ -2461,14 +2472,10 @@ https-browserify@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-0.0.1.tgz#3f91365cabe60b77ed0ebba24b454e3e09d95a82" -iconv-lite@0.4.13: +iconv-lite@0.4.13, iconv-lite@~0.4.13: version "0.4.13" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.13.tgz#1f88aba4ab0b1508e8312acc39345f36e992e2f2" -iconv-lite@~0.4.13: - version "0.4.17" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.17.tgz#4fdaa3b38acbc2c031b045d0edcdfe1ecab18c8d" - icss-replace-symbols@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/icss-replace-symbols/-/icss-replace-symbols-1.0.2.tgz#cb0b6054eb3af6edc9ab1d62d01933e2d4c8bfa5" @@ -2538,7 +2545,7 @@ interpret@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.3.tgz#cbc35c62eeee73f19ab7b10a801511401afc0f90" -invariant@^2.2.0, invariant@^2.2.2: +invariant@^2.0.0, invariant@^2.2.0, invariant@^2.2.2: version "2.2.2" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" dependencies: @@ -3146,6 +3153,10 @@ loader-utils@0.2.x, loader-utils@^0.2.11, loader-utils@^0.2.16, loader-utils@^0. json5 "^0.5.0" object-assign "^4.0.1" +lodash-es@^4.2.0, lodash-es@^4.2.1: + version "4.17.4" + resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.4.tgz#dcc1d7552e150a0640073ba9cb31d70f032950e7" + lodash._arraycopy@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/lodash._arraycopy/-/lodash._arraycopy-3.0.0.tgz#76e7b7c1f1fb92547374878a562ed06a3e50f6e1" @@ -3235,7 +3246,7 @@ lodash.uniq@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773" -"lodash@>=3.5 <5", lodash@^4.0.0, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.16.4, lodash@^4.17.2, lodash@^4.2.0, lodash@^4.3.0: +"lodash@>=3.5 <5", lodash@^4.0.0, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.16.4, lodash@^4.17.2, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" @@ -3555,7 +3566,7 @@ oauth-sign@~0.8.1: version "0.8.2" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" -object-assign@4.1.1, object-assign@^4.0.1, object-assign@^4.1.0: +object-assign@4.1.1, object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" @@ -4068,7 +4079,7 @@ promise@7.1.1, promise@^7.1.1: dependencies: asap "~2.0.3" -prop-types@^15.5.7, prop-types@~15.5.7: +prop-types@^15.0.0, prop-types@^15.5.7, prop-types@~15.5.7: version "15.5.8" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.5.8.tgz#6b7b2e141083be38c8595aa51fc55775c7199394" dependencies: @@ -4163,7 +4174,7 @@ react-dev-utils@^0.5.2: sockjs-client "1.0.1" strip-ansi "3.0.1" -react-dom@15.5.4: +react-dom@^15.5.4: version "15.5.4" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-15.5.4.tgz#ba0c28786fd52ed7e4f2135fe0288d462aef93da" dependencies: @@ -4172,6 +4183,18 @@ react-dom@15.5.4: object-assign "^4.1.0" prop-types "~15.5.7" +react-redux@^5.0.4: + version "5.0.4" + resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-5.0.4.tgz#1563babadcfb2672f57f9ceaa439fb16bf85d55b" + dependencies: + create-react-class "^15.5.1" + hoist-non-react-statics "^1.0.3" + invariant "^2.0.0" + lodash "^4.2.0" + lodash-es "^4.2.0" + loose-envify "^1.1.0" + prop-types "^15.0.0" + react-scripts@0.9.5: version "0.9.5" resolved "https://registry.yarnpkg.com/react-scripts/-/react-scripts-0.9.5.tgz#e9f05c8427e27131662a9b9d7a9786d1ff16bb3f" @@ -4217,7 +4240,7 @@ react-scripts@0.9.5: optionalDependencies: fsevents "1.0.17" -react@15.5.4: +react@^15.5.4: version "15.5.4" resolved "https://registry.yarnpkg.com/react/-/react-15.5.4.tgz#fa83eb01506ab237cdc1c8c3b1cea8de012bf047" dependencies: @@ -4311,6 +4334,15 @@ reduce-function-call@^1.0.1: dependencies: balanced-match "^0.4.2" +redux@^3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/redux/-/redux-3.6.0.tgz#887c2b3d0b9bd86eca2be70571c27654c19e188d" + dependencies: + lodash "^4.2.1" + lodash-es "^4.2.1" + loose-envify "^1.1.0" + symbol-observable "^1.0.2" + regenerate@^1.2.1: version "1.3.2" resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.3.2.tgz#d1941c67bad437e1be76433add5b385f95b19260" @@ -4809,6 +4841,10 @@ svgo@^0.7.0: sax "~1.2.1" whet.extend "~0.9.9" +symbol-observable@^1.0.2: + version "1.0.4" + resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d" + symbol-tree@^3.2.1: version "3.2.2" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.2.tgz#ae27db38f660a7ae2e1c3b7d1bc290819b8519e6" From 95eca618e56f4857282027845f96e238cfa56ca0 Mon Sep 17 00:00:00 2001 From: Yevhen Uzhva Date: Sat, 6 May 2017 14:38:41 +0300 Subject: [PATCH 2/8] =?UTF-8?q?=D0=A1onfigure=20the=20react-router=20+=20r?= =?UTF-8?q?eact-router-redux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 3 +++ src/index.js | 4 +-- src/routes.js | 14 +++++++++++ src/store.js | 15 ++++++++++-- yarn.lock | 67 ++++++++++++++++++++++++++++++++++++++++++++++++--- 5 files changed, 95 insertions(+), 8 deletions(-) create mode 100644 src/routes.js diff --git a/package.json b/package.json index edf45a8..e0a9129 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,12 @@ "version": "0.1.0", "private": true, "dependencies": { + "history": "^4.6.1", "react": "^15.5.4", "react-dom": "^15.5.4", "react-redux": "^5.0.4", + "react-router-dom": "^4.1.1", + "react-router-redux": "^5.0.0-alpha.6", "redux": "^3.6.0" }, "devDependencies": { diff --git a/src/index.js b/src/index.js index 6f20bec..b85d912 100644 --- a/src/index.js +++ b/src/index.js @@ -3,13 +3,13 @@ import ReactDOM from 'react-dom'; import { Provider } from 'react-redux'; import store from './store'; +import routes from './routes'; -import App from './App'; import './index.css'; ReactDOM.render( - + {routes} , document.getElementById('root') ); diff --git a/src/routes.js b/src/routes.js new file mode 100644 index 0000000..43209db --- /dev/null +++ b/src/routes.js @@ -0,0 +1,14 @@ +import React from 'react'; +import { Route } from 'react-router-dom'; +import { ConnectedRouter } from 'react-router-redux'; + +import { history } from './store'; + +import App from './App'; + +const routes = ( + + + +); +export default routes; diff --git a/src/store.js b/src/store.js index 44e9ee6..387c7c8 100644 --- a/src/store.js +++ b/src/store.js @@ -1,7 +1,18 @@ -import { createStore } from 'redux'; +import { createStore, combineReducers, applyMiddleware } from 'redux'; +import { routerMiddleware, routerReducer } from 'react-router-redux'; + +import createHistory from 'history/createBrowserHistory'; + +export const history = createHistory(); + +// Middleware for intercepting and dispatching navigation actions +const middleware = routerMiddleware(history); const store = createStore( - () => {} // empty function to init store; + combineReducers({ + router: routerReducer + }), + applyMiddleware(middleware) ); export default store; diff --git a/yarn.lock b/yarn.lock index f448f00..010e3ca 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2361,11 +2361,21 @@ he@1.1.x: version "1.1.1" resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" +history@^4.5.1, history@^4.6.0, history@^4.6.1: + version "4.6.1" + resolved "https://registry.yarnpkg.com/history/-/history-4.6.1.tgz#911cf8eb65728555a94f2b12780a0c531a14d2fd" + dependencies: + invariant "^2.2.1" + loose-envify "^1.2.0" + resolve-pathname "^2.0.0" + value-equal "^0.2.0" + warning "^3.0.0" + hoek@2.x.x: version "2.16.3" resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" -hoist-non-react-statics@^1.0.3: +hoist-non-react-statics@^1.0.3, hoist-non-react-statics@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-1.2.0.tgz#aa448cf0986d55cc40773b17174b7dd066cb7cfb" @@ -2545,7 +2555,7 @@ interpret@^1.0.0: version "1.0.3" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.0.3.tgz#cbc35c62eeee73f19ab7b10a801511401afc0f90" -invariant@^2.0.0, invariant@^2.2.0, invariant@^2.2.2: +invariant@^2.0.0, invariant@^2.2.0, invariant@^2.2.1, invariant@^2.2.2: version "2.2.2" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.2.tgz#9e1f56ac0acdb6bf303306f338be3b204ae60360" dependencies: @@ -3254,7 +3264,7 @@ longest@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" -loose-envify@^1.0.0, loose-envify@^1.1.0: +loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" dependencies: @@ -3716,6 +3726,12 @@ path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" +path-to-regexp@^1.5.3: + version "1.7.0" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.7.0.tgz#59fde0f435badacba103a84e9d3bc64e96b9937d" + dependencies: + isarray "0.0.1" + path-type@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441" @@ -4079,7 +4095,7 @@ promise@7.1.1, promise@^7.1.1: dependencies: asap "~2.0.3" -prop-types@^15.0.0, prop-types@^15.5.7, prop-types@~15.5.7: +prop-types@^15.0.0, prop-types@^15.5.4, prop-types@^15.5.7, prop-types@~15.5.7: version "15.5.8" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.5.8.tgz#6b7b2e141083be38c8595aa51fc55775c7199394" dependencies: @@ -4195,6 +4211,35 @@ react-redux@^5.0.4: loose-envify "^1.1.0" prop-types "^15.0.0" +react-router-dom@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-4.1.1.tgz#3021ade1f2c160af97cf94e25594c5f294583025" + dependencies: + history "^4.5.1" + loose-envify "^1.3.1" + prop-types "^15.5.4" + react-router "^4.1.1" + +react-router-redux@^5.0.0-alpha.6: + version "5.0.0-alpha.6" + resolved "https://registry.yarnpkg.com/react-router-redux/-/react-router-redux-5.0.0-alpha.6.tgz#7418663c2ecd3c51be856fcf28f3d1deecc1a576" + dependencies: + history "^4.5.1" + prop-types "^15.5.4" + react-router "^4.1.1" + +react-router@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/react-router/-/react-router-4.1.1.tgz#d448f3b7c1b429a6fbb03395099949c606b1fe95" + dependencies: + history "^4.6.0" + hoist-non-react-statics "^1.2.0" + invariant "^2.2.2" + loose-envify "^1.3.1" + path-to-regexp "^1.5.3" + prop-types "^15.5.4" + warning "^3.0.0" + react-scripts@0.9.5: version "0.9.5" resolved "https://registry.yarnpkg.com/react-scripts/-/react-scripts-0.9.5.tgz#e9f05c8427e27131662a9b9d7a9786d1ff16bb3f" @@ -4478,6 +4523,10 @@ resolve-from@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226" +resolve-pathname@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-2.1.0.tgz#e8358801b86b83b17560d4e3c382d7aef2100944" + resolve@1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" @@ -5101,6 +5150,10 @@ validate-npm-package-license@^3.0.1: spdx-correct "~1.0.0" spdx-expression-parse "~1.0.0" +value-equal@^0.2.0: + version "0.2.1" + resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-0.2.1.tgz#c220a304361fce6994dbbedaa3c7e1a1b895871d" + vary@~1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.1.tgz#67535ebb694c1d52257457984665323f587e8d37" @@ -5127,6 +5180,12 @@ walker@~1.0.5: dependencies: makeerror "1.0.x" +warning@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/warning/-/warning-3.0.0.tgz#32e5377cb572de4ab04753bdf8821c01ed605b7c" + dependencies: + loose-envify "^1.0.0" + watch@~0.10.0: version "0.10.0" resolved "https://registry.yarnpkg.com/watch/-/watch-0.10.0.tgz#77798b2da0f9910d595f1ace5b0c2258521f21dc" From 878f43c710598e5fb618f8ca5cbcefecc3054ad6 Mon Sep 17 00:00:00 2001 From: Yevhen Uzhva Date: Sat, 6 May 2017 15:04:54 +0300 Subject: [PATCH 3/8] =?UTF-8?q?=D0=A1onfigure=20ESlint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.json | 15 ++++++++ package.json | 5 +++ src/App.js | 28 ++++++-------- src/index.js | 2 +- src/routes.js | 2 +- src/store.js | 4 +- yarn.lock | 101 +++++++++++++++++++++++++++++++++++++++++++++++-- 7 files changed, 133 insertions(+), 24 deletions(-) create mode 100644 .eslintrc.json diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..3baf1d9 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,15 @@ +{ + "extends": "airbnb", + "env": { + "browser": true, + "jest": true + }, + "plugins": [ + "react", + "jsx-a11y", + "import" + ], + "rules": { + "react/jsx-filename-extension": 0 + } +} diff --git a/package.json b/package.json index e0a9129..5132a8f 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,11 @@ "redux": "^3.6.0" }, "devDependencies": { + "eslint": "^3.19.0", + "eslint-config-airbnb": "^14.1.0", + "eslint-plugin-import": "^2.2.0", + "eslint-plugin-jsx-a11y": "4.0.0", + "eslint-plugin-react": "^7.0.0", "react-scripts": "0.9.5" }, "scripts": { diff --git a/src/App.js b/src/App.js index d7d52a7..2c49d78 100644 --- a/src/App.js +++ b/src/App.js @@ -1,21 +1,17 @@ -import React, { Component } from 'react'; +import React from 'react'; import logo from './logo.svg'; import './App.css'; -class App extends Component { - render() { - return ( -
-
- logo -

Welcome to React

-
-

- To get started, edit src/App.js and save to reload. -

-
- ); - } -} +const App = () => ( +
+
+ logo +

Welcome to React

+
+

+ To get started, edit src/App.js and save to reload. +

+
+); export default App; diff --git a/src/index.js b/src/index.js index b85d912..e4d8484 100644 --- a/src/index.js +++ b/src/index.js @@ -11,5 +11,5 @@ ReactDOM.render( {routes} , - document.getElementById('root') + document.getElementById('root'), ); diff --git a/src/routes.js b/src/routes.js index 43209db..fae5617 100644 --- a/src/routes.js +++ b/src/routes.js @@ -8,7 +8,7 @@ import App from './App'; const routes = ( - + ); export default routes; diff --git a/src/store.js b/src/store.js index 387c7c8..0ff9db4 100644 --- a/src/store.js +++ b/src/store.js @@ -10,9 +10,9 @@ const middleware = routerMiddleware(history); const store = createStore( combineReducers({ - router: routerReducer + router: routerReducer, }), - applyMiddleware(middleware) + applyMiddleware(middleware), ); export default store; diff --git a/yarn.lock b/yarn.lock index 010e3ca..d442242 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1240,7 +1240,7 @@ concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" -concat-stream@^1.4.6: +concat-stream@^1.4.6, concat-stream@^1.5.2: version "1.6.0" resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" dependencies: @@ -1572,13 +1572,20 @@ doctrine@1.3.x: esutils "^2.0.2" isarray "^1.0.0" -doctrine@^1.2.2: +doctrine@1.5.0, doctrine@^1.2.2: version "1.5.0" resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-1.5.0.tgz#379dce730f6166f76cefa4e6707a159b02c5a6fa" dependencies: esutils "^2.0.2" isarray "^1.0.0" +doctrine@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-2.0.0.tgz#c73d8d2909d22291e1a007a395804da8b665fe63" + dependencies: + esutils "^2.0.2" + isarray "^1.0.0" + dom-converter@~0.1: version "0.1.4" resolved "https://registry.yarnpkg.com/dom-converter/-/dom-converter-0.1.4.tgz#a45ef5727b890c9bffe6d7c876e7b19cb0e17f3b" @@ -1767,6 +1774,16 @@ escope@^3.6.0: esrecurse "^4.1.0" estraverse "^4.1.1" +eslint-config-airbnb-base@^11.1.0: + version "11.1.3" + resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-11.1.3.tgz#0e8db71514fa36b977fbcf977c01edcf863e0cf0" + +eslint-config-airbnb@^14.1.0: + version "14.1.0" + resolved "https://registry.yarnpkg.com/eslint-config-airbnb/-/eslint-config-airbnb-14.1.0.tgz#355d290040bbf8e00bf8b4b19f4b70cbe7c2317f" + dependencies: + eslint-config-airbnb-base "^11.1.0" + eslint-config-react-app@^0.6.2: version "0.6.2" resolved "https://registry.yarnpkg.com/eslint-config-react-app/-/eslint-config-react-app-0.6.2.tgz#ee535cbaaf9e3576ea16b99afe720353d8730ec0" @@ -1794,6 +1811,13 @@ eslint-module-utils@^1.0.0: debug "2.2.0" pkg-dir "^1.0.0" +eslint-module-utils@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.0.0.tgz#a6f8c21d901358759cdc35dbac1982ae1ee58bce" + dependencies: + debug "2.2.0" + pkg-dir "^1.0.0" + eslint-plugin-flowtype@2.21.0: version "2.21.0" resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.21.0.tgz#a47e85abcdd181d37a336054bd552149ae387d9c" @@ -1815,6 +1839,21 @@ eslint-plugin-import@2.0.1: minimatch "^3.0.3" pkg-up "^1.0.0" +eslint-plugin-import@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.2.0.tgz#72ba306fad305d67c4816348a4699a4229ac8b4e" + dependencies: + builtin-modules "^1.1.1" + contains-path "^0.1.0" + debug "^2.2.0" + doctrine "1.5.0" + eslint-import-resolver-node "^0.2.0" + eslint-module-utils "^2.0.0" + has "^1.0.1" + lodash.cond "^4.3.0" + minimatch "^3.0.3" + pkg-up "^1.0.0" + eslint-plugin-jsx-a11y@4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-4.0.0.tgz#779bb0fe7b08da564a422624911de10061e048ee" @@ -1833,6 +1872,14 @@ eslint-plugin-react@6.4.1: doctrine "^1.2.2" jsx-ast-utils "^1.3.1" +eslint-plugin-react@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.0.0.tgz#084cfe772d229ec5ae7e525dfc6d299cc21ddd77" + dependencies: + doctrine "^2.0.0" + has "^1.0.1" + jsx-ast-utils "^1.3.4" + eslint@3.16.1: version "3.16.1" resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.16.1.tgz#9bc31fc7341692cf772e80607508f67d711c5609" @@ -1872,6 +1919,46 @@ eslint@3.16.1: text-table "~0.2.0" user-home "^2.0.0" +eslint@^3.19.0: + version "3.19.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.19.0.tgz#c8fc6201c7f40dd08941b87c085767386a679acc" + dependencies: + babel-code-frame "^6.16.0" + chalk "^1.1.3" + concat-stream "^1.5.2" + debug "^2.1.1" + doctrine "^2.0.0" + escope "^3.6.0" + espree "^3.4.0" + esquery "^1.0.0" + estraverse "^4.2.0" + esutils "^2.0.2" + file-entry-cache "^2.0.0" + glob "^7.0.3" + globals "^9.14.0" + ignore "^3.2.0" + imurmurhash "^0.1.4" + inquirer "^0.12.0" + is-my-json-valid "^2.10.0" + is-resolvable "^1.0.0" + js-yaml "^3.5.1" + json-stable-stringify "^1.0.0" + levn "^0.3.0" + lodash "^4.0.0" + mkdirp "^0.5.0" + natural-compare "^1.4.0" + optionator "^0.8.2" + path-is-inside "^1.0.1" + pluralize "^1.2.1" + progress "^1.1.8" + require-uncached "^1.0.2" + shelljs "^0.7.5" + strip-bom "^3.0.0" + strip-json-comments "~2.0.1" + table "^3.7.8" + text-table "~0.2.0" + user-home "^2.0.0" + espree@^3.4.0: version "3.4.2" resolved "https://registry.yarnpkg.com/espree/-/espree-3.4.2.tgz#38dbdedbedc95b8961a1fbf04734a8f6a9c8c592" @@ -1891,6 +1978,12 @@ esprima@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.0.0.tgz#53cf247acda77313e551c3aa2e73342d3fb4f7d9" +esquery@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.0.0.tgz#cfba8b57d7fba93f17298a8a006a04cda13d80fa" + dependencies: + estraverse "^4.0.0" + esrecurse@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.1.0.tgz#4713b6536adf7f2ac4f327d559e7756bff648220" @@ -1902,7 +1995,7 @@ estraverse@^1.9.1: version "1.9.3" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.9.3.tgz#af67f2dc922582415950926091a4005d29c9bb44" -estraverse@^4.1.1, estraverse@^4.2.0: +estraverse@^4.0.0, estraverse@^4.1.1, estraverse@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" @@ -3111,7 +3204,7 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.3.6" -jsx-ast-utils@^1.0.0, jsx-ast-utils@^1.3.1: +jsx-ast-utils@^1.0.0, jsx-ast-utils@^1.3.1, jsx-ast-utils@^1.3.4: version "1.4.1" resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz#3867213e8dd79bf1e8f2300c0cfc1efb182c0df1" From f0fc05db0aa6f1336c82f9a89a8d3dbb58d6c992 Mon Sep 17 00:00:00 2001 From: Yevhen Uzhva Date: Fri, 12 May 2017 20:27:12 +0300 Subject: [PATCH 4/8] Improved file structure of project --- src/components/.keep | 0 src/{App.js => containers/App/index.js} | 2 +- src/{ => containers/App}/logo.svg | 0 src/{App.css => containers/App/styles.css} | 0 src/{App.test.js => containers/App/tests/index.test.js} | 2 +- src/index.js | 2 +- src/routes.js | 2 +- src/{index.css => styles/main.css} | 2 ++ 8 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 src/components/.keep rename src/{App.js => containers/App/index.js} (94%) rename src/{ => containers/App}/logo.svg (100%) rename src/{App.css => containers/App/styles.css} (100%) rename src/{App.test.js => containers/App/tests/index.test.js} (85%) rename src/{index.css => styles/main.css} (56%) diff --git a/src/components/.keep b/src/components/.keep new file mode 100644 index 0000000..e69de29 diff --git a/src/App.js b/src/containers/App/index.js similarity index 94% rename from src/App.js rename to src/containers/App/index.js index 2c49d78..f9c1844 100644 --- a/src/App.js +++ b/src/containers/App/index.js @@ -1,6 +1,6 @@ import React from 'react'; import logo from './logo.svg'; -import './App.css'; +import './styles.css'; const App = () => (
diff --git a/src/logo.svg b/src/containers/App/logo.svg similarity index 100% rename from src/logo.svg rename to src/containers/App/logo.svg diff --git a/src/App.css b/src/containers/App/styles.css similarity index 100% rename from src/App.css rename to src/containers/App/styles.css diff --git a/src/App.test.js b/src/containers/App/tests/index.test.js similarity index 85% rename from src/App.test.js rename to src/containers/App/tests/index.test.js index b84af98..37a838d 100644 --- a/src/App.test.js +++ b/src/containers/App/tests/index.test.js @@ -1,6 +1,6 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import App from './App'; +import App from './../index'; it('renders without crashing', () => { const div = document.createElement('div'); diff --git a/src/index.js b/src/index.js index e4d8484..f3bbf09 100644 --- a/src/index.js +++ b/src/index.js @@ -5,7 +5,7 @@ import { Provider } from 'react-redux'; import store from './store'; import routes from './routes'; -import './index.css'; +import './styles/main.css'; ReactDOM.render( diff --git a/src/routes.js b/src/routes.js index fae5617..b12b18e 100644 --- a/src/routes.js +++ b/src/routes.js @@ -4,7 +4,7 @@ import { ConnectedRouter } from 'react-router-redux'; import { history } from './store'; -import App from './App'; +import App from './containers/App'; const routes = ( diff --git a/src/index.css b/src/styles/main.css similarity index 56% rename from src/index.css rename to src/styles/main.css index b4cc725..d351016 100644 --- a/src/index.css +++ b/src/styles/main.css @@ -1,3 +1,5 @@ +@import url('~/src/containers/App/styles.css'); + body { margin: 0; padding: 0; From 03efb2fa1cc0480d083606afe4aa396807928c17 Mon Sep 17 00:00:00 2001 From: Yevhen Uzhva Date: Fri, 12 May 2017 21:47:50 +0300 Subject: [PATCH 5/8] Create App actions and reducer --- .eslintrc.json | 2 ++ package.json | 2 ++ src/containers/App/actions.js | 19 ++++++++++++ src/containers/App/constants.js | 3 ++ src/containers/App/index.js | 54 ++++++++++++++++++++++++--------- src/containers/App/reducer.js | 38 +++++++++++++++++++++++ src/global-reducer.js | 20 ++++++++++++ src/store.js | 10 +++--- yarn.lock | 11 +++++-- 9 files changed, 137 insertions(+), 22 deletions(-) create mode 100644 src/containers/App/actions.js create mode 100644 src/containers/App/constants.js create mode 100644 src/containers/App/reducer.js create mode 100644 src/global-reducer.js diff --git a/.eslintrc.json b/.eslintrc.json index 3baf1d9..9670706 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -10,6 +10,8 @@ "import" ], "rules": { + "arrow-parens": ["error", "always"], + "react/forbid-prop-types": 0, "react/jsx-filename-extension": 0 } } diff --git a/package.json b/package.json index 5132a8f..9ba07cc 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,8 @@ "private": true, "dependencies": { "history": "^4.6.1", + "immutable": "^3.8.1", + "prop-types": "^15.5.10", "react": "^15.5.4", "react-dom": "^15.5.4", "react-redux": "^5.0.4", diff --git a/src/containers/App/actions.js b/src/containers/App/actions.js new file mode 100644 index 0000000..2347827 --- /dev/null +++ b/src/containers/App/actions.js @@ -0,0 +1,19 @@ +import { + GET_API_DATA, + GET_API_DATA_LOADED, + GET_API_DATA_ERROR, +} from './constants'; + +export const getAPIData = () => ({ + type: GET_API_DATA, +}); + +export const getAPIDataLoaded = (data) => ({ + type: GET_API_DATA_LOADED, + data, +}); + +export const getAPIDataError = (error) => ({ + type: GET_API_DATA_ERROR, + error, +}); diff --git a/src/containers/App/constants.js b/src/containers/App/constants.js new file mode 100644 index 0000000..4024f2f --- /dev/null +++ b/src/containers/App/constants.js @@ -0,0 +1,3 @@ +export const GET_API_DATA = 'containers/App/GET_API_DATA'; +export const GET_API_DATA_LOADED = 'containers/App/GET_API_DATA_LOADED'; +export const GET_API_DATA_ERROR = 'containers/App/GET_API_DATA_ERROR'; diff --git a/src/containers/App/index.js b/src/containers/App/index.js index f9c1844..f2c6361 100644 --- a/src/containers/App/index.js +++ b/src/containers/App/index.js @@ -1,17 +1,43 @@ -import React from 'react'; +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; +import { bindActionCreators } from 'redux'; +import { connect } from 'react-redux'; + +import { getAPIData } from './actions'; + import logo from './logo.svg'; import './styles.css'; -const App = () => ( -
-
- logo -

Welcome to React

-
-

- To get started, edit src/App.js and save to reload. -

-
-); - -export default App; +class App extends Component { + componentWillMount() { + this.props.actions.getAPIData(); + } + + render() { + return ( +
+
+ logo +

Welcome to React

+
+

+ To get started, edit src/App.js and save to reload. +

+
+ ); + } +} + +App.propTypes = { + actions: PropTypes.object.isRequired, +}; + +const mapStateToProps = (state) => ({ + testData: state, +}); + +const mapDispatchToProps = (dispatch) => ({ + actions: bindActionCreators({ getAPIData }, dispatch), +}); + +export default connect(mapStateToProps, mapDispatchToProps)(App); diff --git a/src/containers/App/reducer.js b/src/containers/App/reducer.js new file mode 100644 index 0000000..877cd00 --- /dev/null +++ b/src/containers/App/reducer.js @@ -0,0 +1,38 @@ +import { fromJS } from 'immutable'; + +import { + GET_API_DATA, + GET_API_DATA_LOADED, + GET_API_DATA_ERROR, +} from './constants'; + +const initialState = fromJS({ + apiData: false, + apiDataLoading: false, + apiDataLoaded: false, + apiDataError: false, +}); + +const appReducer = (state = initialState, action) => { + switch (action.type) { + case GET_API_DATA: + return state + .set('apiDataLoading', true) + .set('apiDataError', false); + case GET_API_DATA_LOADED: + return state + .set('apiData', action.data) + .set('apiDataLoading', false) + .set('apiDataLoaded', true) + .set('apiDataError', false); + case GET_API_DATA_ERROR: + return state + .set('apiDataLoading', false) + .set('apiDataLoaded', false) + .set('apiDataError', action.error); + default: + return state; + } +}; + +export default appReducer; diff --git a/src/global-reducer.js b/src/global-reducer.js new file mode 100644 index 0000000..6e4d789 --- /dev/null +++ b/src/global-reducer.js @@ -0,0 +1,20 @@ +import { combineReducers } from 'redux'; +import { routerReducer } from 'react-router-redux'; + +import appReducer from './containers/App/reducer'; + +const containersReducer = { + containers: combineReducers({ + appReducer, + // NOTE: put other app containers here + }), +}; + +const createGlobalReducer = () => ( + combineReducers({ + ...containersReducer, + route: routerReducer, + }) +); + +export default createGlobalReducer; diff --git a/src/store.js b/src/store.js index 0ff9db4..f41d48f 100644 --- a/src/store.js +++ b/src/store.js @@ -1,17 +1,17 @@ -import { createStore, combineReducers, applyMiddleware } from 'redux'; -import { routerMiddleware, routerReducer } from 'react-router-redux'; +import { createStore, applyMiddleware } from 'redux'; +import { routerMiddleware } from 'react-router-redux'; import createHistory from 'history/createBrowserHistory'; +import createGlobalReducer from './global-reducer'; + export const history = createHistory(); // Middleware for intercepting and dispatching navigation actions const middleware = routerMiddleware(history); const store = createStore( - combineReducers({ - router: routerReducer, - }), + createGlobalReducer(), applyMiddleware(middleware), ); diff --git a/yarn.lock b/yarn.lock index d442242..46de969 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2591,6 +2591,10 @@ ignore@^3.2.0: version "3.3.0" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.0.tgz#3812d22cbe9125f2c2b4915755a1b8abd745a001" +immutable@^3.8.1: + version "3.8.1" + resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.8.1.tgz#200807f11ab0f72710ea485542de088075f68cd2" + imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" @@ -4188,11 +4192,12 @@ promise@7.1.1, promise@^7.1.1: dependencies: asap "~2.0.3" -prop-types@^15.0.0, prop-types@^15.5.4, prop-types@^15.5.7, prop-types@~15.5.7: - version "15.5.8" - resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.5.8.tgz#6b7b2e141083be38c8595aa51fc55775c7199394" +prop-types@^15.0.0, prop-types@^15.5.10, prop-types@^15.5.4, prop-types@^15.5.7, prop-types@~15.5.7: + version "15.5.10" + resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.5.10.tgz#2797dfc3126182e3a95e3dfbb2e893ddd7456154" dependencies: fbjs "^0.8.9" + loose-envify "^1.3.1" proxy-addr@~1.1.3: version "1.1.4" From 1299456ffc933f02be3150aaeb5016d39982c12f Mon Sep 17 00:00:00 2001 From: Yevhen Uzhva Date: Sat, 13 May 2017 16:26:13 +0300 Subject: [PATCH 6/8] Create App sagas and selectors for data dowloading --- package.json | 6 ++++-- src/containers/App/index.js | 12 +++++++++-- src/containers/App/reducer.js | 12 +++++------ src/containers/App/sagas.js | 36 +++++++++++++++++++++++++++++++++ src/containers/App/selectors.js | 4 ++++ src/global-reducer.js | 2 +- src/global-sagas.js | 6 ++++++ src/store.js | 16 +++++++++++---- src/styles/main.css | 2 +- yarn.lock | 4 ++++ 10 files changed, 84 insertions(+), 16 deletions(-) create mode 100644 src/containers/App/sagas.js create mode 100644 src/containers/App/selectors.js create mode 100644 src/global-sagas.js diff --git a/package.json b/package.json index 9ba07cc..69403c4 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "react-redux": "^5.0.4", "react-router-dom": "^4.1.1", "react-router-redux": "^5.0.0-alpha.6", - "redux": "^3.6.0" + "redux": "^3.6.0", + "redux-saga": "^0.15.3" }, "devDependencies": { "eslint": "^3.19.0", @@ -26,5 +27,6 @@ "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject" - } + }, + "proxy": "https://httpbin.org" } diff --git a/src/containers/App/index.js b/src/containers/App/index.js index f2c6361..ea396a1 100644 --- a/src/containers/App/index.js +++ b/src/containers/App/index.js @@ -4,9 +4,9 @@ import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { getAPIData } from './actions'; +import { selectApiData } from './selectors'; import logo from './logo.svg'; -import './styles.css'; class App extends Component { componentWillMount() { @@ -23,17 +23,25 @@ class App extends Component {

To get started, edit src/App.js and save to reload.

+

+ Your IP is: {this.props.apiData && this.props.apiData.origin.split(', ')[1]} +

); } } +App.defaultProps = { + apiData: {}, +}; + App.propTypes = { actions: PropTypes.object.isRequired, + apiData: PropTypes.object, }; const mapStateToProps = (state) => ({ - testData: state, + apiData: selectApiData(state), }); const mapDispatchToProps = (dispatch) => ({ diff --git a/src/containers/App/reducer.js b/src/containers/App/reducer.js index 877cd00..a311268 100644 --- a/src/containers/App/reducer.js +++ b/src/containers/App/reducer.js @@ -7,10 +7,10 @@ import { } from './constants'; const initialState = fromJS({ - apiData: false, - apiDataLoading: false, - apiDataLoaded: false, - apiDataError: false, + apiData: null, + apiDataLoading: null, + apiDataLoaded: null, + apiDataError: null, }); const appReducer = (state = initialState, action) => { @@ -18,13 +18,13 @@ const appReducer = (state = initialState, action) => { case GET_API_DATA: return state .set('apiDataLoading', true) - .set('apiDataError', false); + .set('apiDataError', null); case GET_API_DATA_LOADED: return state .set('apiData', action.data) .set('apiDataLoading', false) .set('apiDataLoaded', true) - .set('apiDataError', false); + .set('apiDataError', null); case GET_API_DATA_ERROR: return state .set('apiDataLoading', false) diff --git a/src/containers/App/sagas.js b/src/containers/App/sagas.js new file mode 100644 index 0000000..02118ad --- /dev/null +++ b/src/containers/App/sagas.js @@ -0,0 +1,36 @@ +import { takeLatest, call, put } from 'redux-saga/effects'; + +import { getAPIDataLoaded, getAPIDataError } from './actions'; + +import { + GET_API_DATA, +} from './constants'; + +// Data downloading using pure JS fetch +// @type: object +// { result: resultObj, error: errorObj } +const fetchData = (url, options) => { + const fetchRequest = new Request(url, options); + + return fetch(fetchRequest) + .then((response) => ( + response.json().then((result) => ({ result })) + )) + .catch((error) => ({ error })); +}; + +function* getApiData() { + const { result, error } = yield call(fetchData, '/get', { method: 'get' }); + + if (error) { + yield put(getAPIDataError(error)); + } + + yield put(getAPIDataLoaded(result)); +} + +function* apiData() { + yield takeLatest(GET_API_DATA, getApiData); +} + +export default apiData; diff --git a/src/containers/App/selectors.js b/src/containers/App/selectors.js new file mode 100644 index 0000000..396c36d --- /dev/null +++ b/src/containers/App/selectors.js @@ -0,0 +1,4 @@ +export const selectAppContainer = (state) => state.containers.appReducer; + +// Need to use .get, beucase reducer defaulState was created by using ImmutableJS +export const selectApiData = (state) => selectAppContainer(state).get('apiData'); diff --git a/src/global-reducer.js b/src/global-reducer.js index 6e4d789..344bf6d 100644 --- a/src/global-reducer.js +++ b/src/global-reducer.js @@ -6,7 +6,7 @@ import appReducer from './containers/App/reducer'; const containersReducer = { containers: combineReducers({ appReducer, - // NOTE: put other app containers here + // NOTE: put other app reducers here }), }; diff --git a/src/global-sagas.js b/src/global-sagas.js new file mode 100644 index 0000000..ae88682 --- /dev/null +++ b/src/global-sagas.js @@ -0,0 +1,6 @@ +import appSagas from './containers/App/sagas'; + +export default [ + appSagas, + // NOTE: put other app sagas here +]; diff --git a/src/store.js b/src/store.js index f41d48f..0df5127 100644 --- a/src/store.js +++ b/src/store.js @@ -1,18 +1,26 @@ import { createStore, applyMiddleware } from 'redux'; import { routerMiddleware } from 'react-router-redux'; - import createHistory from 'history/createBrowserHistory'; +import createSagaMiddleware from 'redux-saga'; + import createGlobalReducer from './global-reducer'; +import globalSagas from './global-sagas'; export const history = createHistory(); +const sagaMiddleware = createSagaMiddleware(); -// Middleware for intercepting and dispatching navigation actions -const middleware = routerMiddleware(history); +const middlewares = [ + // Middleware for intercepting and dispatching navigation actions + routerMiddleware(history), + sagaMiddleware, +]; const store = createStore( createGlobalReducer(), - applyMiddleware(middleware), + applyMiddleware(...middlewares), ); +sagaMiddleware.run(...globalSagas); + export default store; diff --git a/src/styles/main.css b/src/styles/main.css index d351016..ae0261a 100644 --- a/src/styles/main.css +++ b/src/styles/main.css @@ -1,4 +1,4 @@ -@import url('~/src/containers/App/styles.css'); +@import url('./../containers/App/styles.css'); body { margin: 0; diff --git a/yarn.lock b/yarn.lock index 46de969..2f8ec88 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4477,6 +4477,10 @@ reduce-function-call@^1.0.1: dependencies: balanced-match "^0.4.2" +redux-saga@^0.15.3: + version "0.15.3" + resolved "https://registry.yarnpkg.com/redux-saga/-/redux-saga-0.15.3.tgz#be2b86b4ad46bf0d84fcfcb0ca96cfc33db91acb" + redux@^3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/redux/-/redux-3.6.0.tgz#887c2b3d0b9bd86eca2be70571c27654c19e188d" From 917cb5c85e795572900a5a1c9c605362620605d9 Mon Sep 17 00:00:00 2001 From: Yevhen Uzhva Date: Mon, 15 May 2017 12:07:29 +0300 Subject: [PATCH 7/8] Update README --- README.md | 105 +++++++++++++++++++---- src/containers/App/{ => images}/logo.svg | 0 src/containers/App/index.js | 12 +-- src/containers/App/sagas.js | 8 +- src/containers/App/styles.css | 12 +-- 5 files changed, 106 insertions(+), 31 deletions(-) rename src/containers/App/{ => images}/logo.svg (100%) diff --git a/README.md b/README.md index b89b23d..35d5485 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,95 @@ # Create react redux app This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app). +The project includes extra redux packages and improved file structure. + +## Table of Contents +- [Dependencies that was added to app created with create-react-app]( + #dependencies-that-was-added-to-app-created-with-create-react-app) +- [Quick start](#quick-start) +- [Improved folder Structure](#improved-folder-structure) +- [Available Scripts](#available-scripts) +- [Table of Contents for react-scripts]( + https://github.com/YUzhva/react-leaflet-markercluster/edit/master/README.md) + +## Dependencies that was added to app created with create-react-app +- redux +- react-redux +- redux-saga +- immutable +- react-router-dom +- react-router-redux + +devDependencies: +- eslint (based on Airbnb rules) +- pre-commit + +## Quick start +**1.** Clone project +```bash +# with SSH +git clone git@github.com:YUzhva/create-react-redux-app.git + +# with HTTPS +git clone https://github.com/YUzhva/create-react-redux-app.git +``` + +**2.** Rename project +```bash +# command for Mac/Linux +mv create-react-redux-app NEW_PROJECT_NAME + +# command for Windows +rename create-react-redux-app NEW_PROJECT_NAME +``` + +**3.** Go inside project folder `cd NEW_PROJECT_NAME` and edit project name inside package.json +```javascript +// change +{ + "name": "create-react-redux-app", +} + +// to the +{ + "name": "NEW_PROJECT_NAME", +} +``` -## Folder Structure +**4.** Delete .git folder +```bash +# command for Mac/Linux +rm -rf .git -After creation, your project should look like this: +# command for Windows +rmdir .git +``` + +**5.** Initialize new git +```bash +git init +git add . +git commit -m "[initial commit] NEW_PROJECT_NAME" +``` + +:beer: Have fun :beer: (= + +## Improved folder Structure ``` -my-app/ - README.md - node_modules/ - package.json - public/ - index.html - favicon.ico - src/ - App.css - App.js - App.test.js - index.css - index.js - logo.svg +- src + - components // reusable react components without redux + * ContainerName + tests + index.js // entry point for component + + - containers // react components with redux and redux-saga data fetching + * ContainerName + tests + index.js // entry point for container + constants/actions/reducer/sagas/selectors.js // place container required files in root + + - global-reducer.js // connect other containers reducers here + - global-sagas.js // connect other containers sagas here ``` For the project to build, **these files must exist with exact filenames**: @@ -55,6 +125,9 @@ You will also see any lint errors in the console. Launches the test runner in the interactive watch mode.
See the section about [running tests](#running-tests) for more information. +### `npm run lint` +Lints your JavaScript. + ### `npm run build` Builds the app for production to the `build` folder.
diff --git a/src/containers/App/logo.svg b/src/containers/App/images/logo.svg similarity index 100% rename from src/containers/App/logo.svg rename to src/containers/App/images/logo.svg diff --git a/src/containers/App/index.js b/src/containers/App/index.js index ea396a1..7700bf2 100644 --- a/src/containers/App/index.js +++ b/src/containers/App/index.js @@ -6,7 +6,7 @@ import { connect } from 'react-redux'; import { getAPIData } from './actions'; import { selectApiData } from './selectors'; -import logo from './logo.svg'; +import logo from './images/logo.svg'; class App extends Component { componentWillMount() { @@ -15,15 +15,15 @@ class App extends Component { render() { return ( -
-
- logo +
+
+ logo

Welcome to React

-

+

To get started, edit src/App.js and save to reload.

-

+

Your IP is: {this.props.apiData && this.props.apiData.origin.split(', ')[1]}

diff --git a/src/containers/App/sagas.js b/src/containers/App/sagas.js index 02118ad..8f3bcc9 100644 --- a/src/containers/App/sagas.js +++ b/src/containers/App/sagas.js @@ -6,9 +6,11 @@ import { GET_API_DATA, } from './constants'; -// Data downloading using pure JS fetch -// @type: object -// { result: resultObj, error: errorObj } +/** + Data downloading using pure JS fetch + @type: JS object + { result: resultObj, error: errorObj } +**/ const fetchData = (url, options) => { const fetchRequest = new Request(url, options); diff --git a/src/containers/App/styles.css b/src/containers/App/styles.css index 15adfdc..29b6a70 100644 --- a/src/containers/App/styles.css +++ b/src/containers/App/styles.css @@ -1,24 +1,24 @@ -.App { +.app { text-align: center; } -.App-logo { - animation: App-logo-spin infinite 20s linear; +.app-logo { + animation: app-logo-spin infinite 20s linear; height: 80px; } -.App-header { +.app-header { background-color: #222; height: 150px; padding: 20px; color: white; } -.App-intro { +.app-intro { font-size: large; } -@keyframes App-logo-spin { +@keyframes app-logo-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } From bc54ce17f7e7520fd67af2d90398fc5367c8b998 Mon Sep 17 00:00:00 2001 From: Yevhen Uzhva Date: Mon, 15 May 2017 12:16:03 +0300 Subject: [PATCH 8/8] pre-commit javascript lint --- README.md | 11 ++- package.json | 13 ++- yarn.lock | 250 +++++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 258 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 35d5485..61cc231 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,16 @@ # Create react redux app -This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app). +This project was bootstrapped with [Create React App](https://github.com/facebookincubator/create-react-app).
The project includes extra redux packages and improved file structure. ## Table of Contents -- [Dependencies that was added to app created with create-react-app]( - #dependencies-that-was-added-to-app-created-with-create-react-app) +- [Dependencies that was added to app created with create-react-app](#dependencies-that-was-added-to-the-app) - [Quick start](#quick-start) - [Improved folder Structure](#improved-folder-structure) - [Available Scripts](#available-scripts) - [Table of Contents for react-scripts]( - https://github.com/YUzhva/react-leaflet-markercluster/edit/master/README.md) + https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md) -## Dependencies that was added to app created with create-react-app +## Dependencies that was added to the app - redux - react-redux - redux-saga @@ -42,7 +41,7 @@ mv create-react-redux-app NEW_PROJECT_NAME rename create-react-redux-app NEW_PROJECT_NAME ``` -**3.** Go inside project folder `cd NEW_PROJECT_NAME` and edit project name inside package.json +**3.** Go inside project folder `cd NEW_PROJECT_NAME` and edit project name inside `package.json` ```javascript // change { diff --git a/package.json b/package.json index 69403c4..17274fd 100644 --- a/package.json +++ b/package.json @@ -20,13 +20,22 @@ "eslint-plugin-import": "^2.2.0", "eslint-plugin-jsx-a11y": "4.0.0", "eslint-plugin-react": "^7.0.0", + "lint-staged": "^3.4.1", + "pre-commit": "^1.2.2", "react-scripts": "0.9.5" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", - "eject": "react-scripts eject" + "eject": "react-scripts eject", + "lint": "npm run lint:js", + "lint:staged": "lint-staged", + "lint:js": "eslint --ext .js src/" }, - "proxy": "https://httpbin.org" + "pre-commit": "lint:staged", + "lint-staged": { + "*.js": "lint:js" + }, + "proxy": "https://httpbin.org" } diff --git a/yarn.lock b/yarn.lock index 2f8ec88..261432c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -68,7 +68,7 @@ amdefine@>=0.0.4: version "1.0.1" resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" -ansi-escapes@^1.1.0, ansi-escapes@^1.4.0: +ansi-escapes@^1.0.0, ansi-escapes@^1.1.0, ansi-escapes@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" @@ -95,6 +95,10 @@ anymatch@^1.3.0: arrify "^1.0.0" micromatch "^2.1.5" +app-root-path@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/app-root-path/-/app-root-path-2.0.1.tgz#cd62dcf8e4fd5a417efc664d2e5b10653c651b46" + append-transform@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/append-transform/-/append-transform-0.4.0.tgz#d76ebf8ca94d276e247a36bad44a4b74ab611991" @@ -1106,18 +1110,29 @@ clean-css@4.0.x: dependencies: source-map "0.5.x" -cli-cursor@^1.0.1: +cli-cursor@^1.0.1, cli-cursor@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/cli-cursor/-/cli-cursor-1.0.2.tgz#64da3f7d56a54412e59794bd62dc35295e8f2987" dependencies: restore-cursor "^1.0.1" +cli-spinners@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-0.1.2.tgz#bb764d88e185fb9e1e6a2a1f19772318f605e31c" + cli-table@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/cli-table/-/cli-table-0.3.1.tgz#f53b05266a8b1a0b934b3d0821e6e2dc5914ae23" dependencies: colors "1.0.3" +cli-truncate@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-0.2.1.tgz#9f15cfbb0705005369216c626ac7d05ab90dd574" + dependencies: + slice-ansi "0.0.4" + string-width "^1.0.1" + cli-usage@^0.1.1: version "0.1.4" resolved "https://registry.yarnpkg.com/cli-usage/-/cli-usage-0.1.4.tgz#7c01e0dc706c234b39c933838c8e20b2175776e2" @@ -1209,7 +1224,7 @@ combined-stream@^1.0.5, combined-stream@~1.0.5: dependencies: delayed-stream "~1.0.0" -commander@2.9.x: +commander@2.9.x, commander@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.9.0.tgz#9c99094176e12240cb22d6c5146098400fe0f7d4" dependencies: @@ -1240,7 +1255,7 @@ concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" -concat-stream@^1.4.6, concat-stream@^1.5.2: +concat-stream@^1.4.6, concat-stream@^1.4.7, concat-stream@^1.5.2: version "1.6.0" resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" dependencies: @@ -1306,6 +1321,19 @@ core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" +cosmiconfig@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-1.1.0.tgz#0dea0f9804efdfb929fbb1b188e25553ea053d37" + dependencies: + graceful-fs "^4.1.2" + js-yaml "^3.4.3" + minimist "^1.2.0" + object-assign "^4.0.1" + os-homedir "^1.0.1" + parse-json "^2.2.0" + pinkie-promise "^2.0.0" + require-from-string "^1.1.0" + cosmiconfig@^2.1.0, cosmiconfig@^2.1.1: version "2.1.3" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-2.1.3.tgz#952771eb0dddc1cb3fa2f6fbe51a522e93b3ee0a" @@ -1332,6 +1360,14 @@ cross-spawn@4.0.2: lru-cache "^4.0.1" which "^1.2.9" +cross-spawn@^5.0.1: + version "5.1.0" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" + dependencies: + lru-cache "^4.0.1" + shebang-command "^1.2.0" + which "^1.2.9" + cryptiles@2.x.x: version "2.0.5" resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-2.0.5.tgz#3bdfecdc608147c1c67202fa291e7dca59eaa3b8" @@ -1471,6 +1507,10 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" +date-fns@^1.27.2: + version "1.28.4" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.28.4.tgz#7938aec34ba31fc8bd134d2344bc2e0bbfd95165" + date-now@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" @@ -1652,6 +1692,10 @@ electron-to-chromium@^1.1.0, electron-to-chromium@^1.2.7: version "1.3.9" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.9.tgz#db1cba2a26aebcca2f7f5b8b034554468609157d" +elegant-spinner@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e" + emoji-regex@^6.1.0: version "6.4.2" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-6.4.2.tgz#a30b6fee353d406d96cfb9fa765bdc82897eff6e" @@ -2038,6 +2082,18 @@ exec-sh@^0.2.0: dependencies: merge "^1.1.3" +execa@^0.6.0: + version "0.6.3" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.6.3.tgz#57b69a594f081759c69e5370f0d17b9cb11658fe" + dependencies: + cross-spawn "^5.0.1" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + exit-hook@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/exit-hook/-/exit-hook-1.1.1.tgz#f05ca233b48c05d54fff07765df8507e95c02ff8" @@ -2153,7 +2209,7 @@ fbjs@^0.8.9: setimmediate "^1.0.5" ua-parser-js "^0.7.9" -figures@^1.3.5: +figures@^1.3.5, figures@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/figures/-/figures-1.7.0.tgz#cbe1e3affcf1cd44b80cadfed28dc793a9701d2e" dependencies: @@ -2337,6 +2393,10 @@ get-caller-file@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.2.tgz#f702e63127e7e231c160a80c1554acb70d5047e5" +get-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + getpass@^0.1.1: version "0.1.7" resolved "https://registry.yarnpkg.com/getpass/-/getpass-0.1.7.tgz#5eff8e3e684d569ae4cb2b1282604e8ba62149fa" @@ -2599,6 +2659,16 @@ imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" +indent-string@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-2.1.0.tgz#8e2d48348742121b4a8218b7a137e9a52049dc80" + dependencies: + repeating "^2.0.0" + +indent-string@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/indent-string/-/indent-string-3.1.0.tgz#08ff4334603388399b329e6b9538dc7a3cf5de7d" + indexes-of@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/indexes-of/-/indexes-of-1.0.1.tgz#f30f716c8e2bd346c7b67d3df3915566a7c05607" @@ -2793,6 +2863,10 @@ is-primitive@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" +is-promise@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa" + is-property@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84" @@ -2803,7 +2877,7 @@ is-resolvable@^1.0.0: dependencies: tryit "^1.0.1" -is-stream@^1.0.1: +is-stream@^1.0.1, is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -3241,6 +3315,65 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" +lint-staged@^3.4.1: + version "3.4.1" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-3.4.1.tgz#96cd1cf7a1ac92d81662643c37d1cca28b91b046" + dependencies: + app-root-path "^2.0.0" + cosmiconfig "^1.1.0" + execa "^0.6.0" + listr "^0.12.0" + minimatch "^3.0.0" + npm-which "^3.0.1" + staged-git-files "0.0.4" + +listr-silent-renderer@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/listr-silent-renderer/-/listr-silent-renderer-1.1.1.tgz#924b5a3757153770bf1a8e3fbf74b8bbf3f9242e" + +listr-update-renderer@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/listr-update-renderer/-/listr-update-renderer-0.2.0.tgz#ca80e1779b4e70266807e8eed1ad6abe398550f9" + dependencies: + chalk "^1.1.3" + cli-truncate "^0.2.1" + elegant-spinner "^1.0.1" + figures "^1.7.0" + indent-string "^3.0.0" + log-symbols "^1.0.2" + log-update "^1.0.2" + strip-ansi "^3.0.1" + +listr-verbose-renderer@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/listr-verbose-renderer/-/listr-verbose-renderer-0.4.0.tgz#44dc01bb0c34a03c572154d4d08cde9b1dc5620f" + dependencies: + chalk "^1.1.3" + cli-cursor "^1.0.2" + date-fns "^1.27.2" + figures "^1.7.0" + +listr@^0.12.0: + version "0.12.0" + resolved "https://registry.yarnpkg.com/listr/-/listr-0.12.0.tgz#6bce2c0f5603fa49580ea17cd6a00cc0e5fa451a" + dependencies: + chalk "^1.1.3" + cli-truncate "^0.2.1" + figures "^1.7.0" + indent-string "^2.1.0" + is-promise "^2.1.0" + is-stream "^1.1.0" + listr-silent-renderer "^1.1.1" + listr-update-renderer "^0.2.0" + listr-verbose-renderer "^0.4.0" + log-symbols "^1.0.2" + log-update "^1.0.2" + ora "^0.2.3" + p-map "^1.1.1" + rxjs "^5.0.0-beta.11" + stream-to-observable "^0.1.0" + strip-ansi "^3.0.1" + load-json-file@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-1.1.0.tgz#956905708d58b4bab4c2261b04f59f31c99374c0" @@ -3357,6 +3490,19 @@ lodash.uniq@^4.5.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" +log-symbols@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-1.0.2.tgz#376ff7b58ea3086a0f09facc74617eca501e1a18" + dependencies: + chalk "^1.0.0" + +log-update@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/log-update/-/log-update-1.0.2.tgz#19929f64c4093d2d2e7075a1dad8af59c296b8d1" + dependencies: + ansi-escapes "^1.0.0" + cli-cursor "^1.0.2" + longest@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" @@ -3642,6 +3788,26 @@ normalize-url@^1.4.0: query-string "^4.1.0" sort-keys "^1.0.0" +npm-path@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/npm-path/-/npm-path-2.0.3.tgz#15cff4e1c89a38da77f56f6055b24f975dfb2bbe" + dependencies: + which "^1.2.10" + +npm-run-path@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-2.0.2.tgz#35a9232dfa35d7067b4cb2ddf2357b1871536c5f" + dependencies: + path-key "^2.0.0" + +npm-which@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/npm-which/-/npm-which-3.0.1.tgz#9225f26ec3a285c209cae67c3b11a6b4ab7140aa" + dependencies: + commander "^2.9.0" + npm-path "^2.0.2" + which "^1.2.10" + npmlog@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.0.2.tgz#d03950e0e78ce1527ba26d2a7592e9348ac3e75f" @@ -3733,6 +3899,15 @@ optionator@^0.8.1, optionator@^0.8.2: type-check "~0.3.2" wordwrap "~1.0.0" +ora@^0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/ora/-/ora-0.2.3.tgz#37527d220adcd53c39b73571d754156d5db657a4" + dependencies: + chalk "^1.1.1" + cli-cursor "^1.0.2" + cli-spinners "^0.1.2" + object-assign "^4.0.1" + original@>=0.0.5: version "1.0.0" resolved "https://registry.yarnpkg.com/original/-/original-1.0.0.tgz#9147f93fa1696d04be61e01bd50baeaca656bd3b" @@ -3753,6 +3928,10 @@ os-locale@^1.4.0: dependencies: lcid "^1.0.0" +os-shim@^0.1.2: + version "0.1.3" + resolved "https://registry.yarnpkg.com/os-shim/-/os-shim-0.1.3.tgz#6b62c3791cf7909ea35ed46e17658bb417cb3917" + os-tmpdir@^1.0.0, os-tmpdir@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" @@ -3764,6 +3943,14 @@ osenv@^0.1.4: os-homedir "^1.0.0" os-tmpdir "^1.0.0" +p-finally@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" + +p-map@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.1.1.tgz#05f5e4ae97a068371bc2a5cc86bfbdbc19c4ae7a" + pako@~0.2.0: version "0.2.9" resolved "https://registry.yarnpkg.com/pako/-/pako-0.2.9.tgz#f3f7522f4ef782348da8161bad9ecfd51bf83a75" @@ -3815,6 +4002,10 @@ path-is-inside@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/path-is-inside/-/path-is-inside-1.0.2.tgz#365417dede44430d1c11af61027facf074bdfc53" +path-key@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" + path-parse@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.5.tgz#3c1adf871ea9cd6c9431b6ea2bd74a0ff055c4c1" @@ -4145,6 +4336,14 @@ postcss@^5.0.10, postcss@^5.0.11, postcss@^5.0.12, postcss@^5.0.13, postcss@^5.0 source-map "^0.5.6" supports-color "^3.2.3" +pre-commit@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/pre-commit/-/pre-commit-1.2.2.tgz#dbcee0ee9de7235e57f79c56d7ce94641a69eec6" + dependencies: + cross-spawn "^5.0.1" + spawn-sync "^1.0.15" + which "1.2.x" + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" @@ -4672,6 +4871,12 @@ rx-lite@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/rx-lite/-/rx-lite-3.1.2.tgz#19ce502ca572665f3b647b10939f97fd1615f102" +rxjs@^5.0.0-beta.11: + version "5.4.0" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-5.4.0.tgz#a7db14ab157f9d7aac6a56e655e7a3860d39bf26" + dependencies: + symbol-observable "^1.0.1" + safe-buffer@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.0.1.tgz#d263ca54696cd8a306b5ca6551e92de57918fbe7" @@ -4758,6 +4963,16 @@ sha.js@2.2.6: version "2.2.6" resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.2.6.tgz#17ddeddc5f722fb66501658895461977867315ba" +shebang-command@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea" + dependencies: + shebang-regex "^1.0.0" + +shebang-regex@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" + shelljs@^0.7.5: version "0.7.7" resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.7.tgz#b2f5c77ef97148f4b4f6e22682e10bba8667cff1" @@ -4849,6 +5064,13 @@ source-map@~0.2.0: dependencies: amdefine ">=0.0.4" +spawn-sync@^1.0.15: + version "1.0.15" + resolved "https://registry.yarnpkg.com/spawn-sync/-/spawn-sync-1.0.15.tgz#b00799557eb7fb0c8376c29d44e8a1ea67e57476" + dependencies: + concat-stream "^1.4.7" + os-shim "^0.1.2" + spdx-correct@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40" @@ -4882,6 +5104,10 @@ sshpk@^1.7.0: jsbn "~0.1.0" tweetnacl "~0.14.0" +staged-git-files@0.0.4: + version "0.0.4" + resolved "https://registry.yarnpkg.com/staged-git-files/-/staged-git-files-0.0.4.tgz#d797e1b551ca7a639dec0237dc6eb4bb9be17d35" + "statuses@>= 1.3.1 < 2", statuses@~1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.3.1.tgz#faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e" @@ -4907,6 +5133,10 @@ stream-http@^2.3.1: to-arraybuffer "^1.0.0" xtend "^4.0.0" +stream-to-observable@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/stream-to-observable/-/stream-to-observable-0.1.0.tgz#45bf1d9f2d7dc09bed81f1c307c430e68b84cffe" + strict-uri-encode@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713" @@ -4960,6 +5190,10 @@ strip-bom@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" +strip-eof@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" + strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" @@ -4992,7 +5226,7 @@ svgo@^0.7.0: sax "~1.2.1" whet.extend "~0.9.9" -symbol-observable@^1.0.2: +symbol-observable@^1.0.1, symbol-observable@^1.0.2: version "1.0.4" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.0.4.tgz#29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d" @@ -5411,7 +5645,7 @@ which-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f" -which@^1.0.5, which@^1.1.1, which@^1.2.9: +which@1.2.x, which@^1.0.5, which@^1.1.1, which@^1.2.10, which@^1.2.9: version "1.2.14" resolved "https://registry.yarnpkg.com/which/-/which-1.2.14.tgz#9a87c4378f03e827cecaf1acdf56c736c01c14e5" dependencies: