diff options
author | Victor Chabbert <chabbertvi@eisti.eu> | 2017-05-20 15:14:13 +0200 |
---|---|---|
committer | Victor Chabbert <chabbertvi@eisti.eu> | 2017-05-20 15:14:13 +0200 |
commit | 240246ea132cc736c6eaa70ed79f2ec78d1d4636 (patch) | |
tree | a45a5c81de9f650fcd18190d90049f67c0f63b97 | |
parent | Upgrade react-scripts to 1.0.1 (diff) | |
download | seven-wonders-240246ea132cc736c6eaa70ed79f2ec78d1d4636.tar.gz seven-wonders-240246ea132cc736c6eaa70ed79f2ec78d1d4636.tar.bz2 seven-wonders-240246ea132cc736c6eaa70ed79f2ec78d1d4636.zip |
Add prettier and format js files
-rw-r--r-- | frontend/package.json | 4 | ||||
-rw-r--r-- | frontend/src/components/gameList.js | 28 | ||||
-rw-r--r-- | frontend/src/components/modals/username.js | 14 | ||||
-rw-r--r-- | frontend/src/components/playerList.js | 24 | ||||
-rw-r--r-- | frontend/src/containers/home.js | 33 | ||||
-rw-r--r-- | frontend/src/layouts/HomeLayout.js | 19 | ||||
-rw-r--r-- | frontend/src/layouts/LobbyLayout.js | 19 | ||||
-rw-r--r-- | frontend/src/layouts/index.js | 4 | ||||
-rw-r--r-- | frontend/src/reducers.js | 12 | ||||
-rw-r--r-- | frontend/src/redux/app.js | 8 | ||||
-rw-r--r-- | frontend/src/redux/errors.js | 33 | ||||
-rw-r--r-- | frontend/src/redux/games.js | 53 | ||||
-rw-r--r-- | frontend/src/redux/players.js | 44 | ||||
-rw-r--r-- | frontend/src/sagas.js | 24 | ||||
-rw-r--r-- | frontend/src/sagas/errors.js | 38 | ||||
-rw-r--r-- | frontend/src/sagas/home.js | 41 | ||||
-rw-r--r-- | frontend/src/sagas/lobby.js | 68 | ||||
-rw-r--r-- | frontend/src/schemas/games.js | 20 | ||||
-rw-r--r-- | frontend/src/store.js | 43 | ||||
-rw-r--r-- | frontend/src/utils/websocket.js | 35 | ||||
-rw-r--r-- | frontend/yarn.lock | 167 |
21 files changed, 388 insertions, 343 deletions
diff --git a/frontend/package.json b/frontend/package.json index 41146d21..4c10e520 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -4,6 +4,7 @@ "private": true, "devDependencies": { "babel-polyfill": "latest", + "prettier": "^1.3.1", "react-scripts": "^1.0.1" }, "dependencies": { @@ -30,7 +31,8 @@ "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "test:oneshot": "set CI=true && react-scripts test --env=jsdom", - "eject": "react-scripts eject" + "eject": "react-scripts eject", + "prettier": "prettier --write '{src,__{tests,mocks}__}/**/*.js'" }, "eslintConfig": { "extends": "react-app" diff --git a/frontend/src/components/gameList.js b/frontend/src/components/gameList.js index b4167927..e1d011e1 100644 --- a/frontend/src/components/gameList.js +++ b/frontend/src/components/gameList.js @@ -1,20 +1,22 @@ -import React from 'react' -import { Flex } from 'reflexbox' -import { Text, Space, Button } from 'rebass' -import Immutable from 'seamless-immutable' +import React from "react"; +import { Flex } from "reflexbox"; +import { Text, Space, Button } from "rebass"; +import Immutable from "seamless-immutable"; -const GameList = (props) => ( +const GameList = props => ( <div> {Immutable.asMutable(props.games).map((game, index) => { - const joinGame = () => props.joinGame(game.id) + const joinGame = () => props.joinGame(game.id); - return (<Flex key={index}> - <Text>{game.name}</Text> - <Space auto /> - <Button onClick={joinGame}>Join</Button> - </Flex>) + return ( + <Flex key={index}> + <Text>{game.name}</Text> + <Space auto /> + <Button onClick={joinGame}>Join</Button> + </Flex> + ); })} </div> -) +); -export default GameList +export default GameList; diff --git a/frontend/src/components/modals/username.js b/frontend/src/components/modals/username.js index 61b52114..826bce85 100644 --- a/frontend/src/components/modals/username.js +++ b/frontend/src/components/modals/username.js @@ -1,4 +1,4 @@ -import React from 'react' +import React from "react"; import { Overlay, Panel, @@ -8,15 +8,15 @@ import { Input, Close, Space -} from 'rebass' +} from "rebass"; const Modal = ({ modalOpen, toggleModal }) => ( - <Overlay open={modalOpen} onDismiss={toggleModal('usernameModal')}> + <Overlay open={modalOpen} onDismiss={toggleModal("usernameModal")}> <Panel theme="info"> <PanelHeader> What's your username ? <Space auto /> - <Close onClick={toggleModal('usernameModal')} /> + <Close onClick={toggleModal("usernameModal")} /> </PanelHeader> <Input label="Username" @@ -29,12 +29,12 @@ const Modal = ({ modalOpen, toggleModal }) => ( <Space auto /> <Button theme="success" - onClick={toggleModal('usernameModal')} + onClick={toggleModal("usernameModal")} children="Ok" /> </PanelFooter> </Panel> </Overlay> -) +); -export default Modal +export default Modal; diff --git a/frontend/src/components/playerList.js b/frontend/src/components/playerList.js index 70e8b1f6..b7f6e7c3 100644 --- a/frontend/src/components/playerList.js +++ b/frontend/src/components/playerList.js @@ -1,17 +1,19 @@ -import React from 'react' -import { Flex } from 'reflexbox' -import { Text } from 'rebass' -import Immutable from 'seamless-immutable' +import React from "react"; +import { Flex } from "reflexbox"; +import { Text } from "rebass"; +import Immutable from "seamless-immutable"; -const PlayerList = (props) => ( +const PlayerList = props => ( <div> {Immutable.asMutable(props.players).map(player => { - return (<Flex key={player.index}> - <Text>{player.displayName}</Text> - <Text>({player.username})</Text> - </Flex>) + return ( + <Flex key={player.index}> + <Text>{player.displayName}</Text> + <Text>({player.username})</Text> + </Flex> + ); })} </div> -) +); -export default PlayerList +export default PlayerList; diff --git a/frontend/src/containers/home.js b/frontend/src/containers/home.js index 78ff5e6e..40c2efb3 100644 --- a/frontend/src/containers/home.js +++ b/frontend/src/containers/home.js @@ -1,16 +1,15 @@ -import React, { Component } from 'react' -import { connect } from 'react-redux' -import { Button, Container, Input } from 'rebass' -import { actions } from '../redux/players' +import React, { Component } from "react"; +import { connect } from "react-redux"; +import { Button, Container, Input } from "rebass"; +import { actions } from "../redux/players"; class HomePage extends Component { - - play = (e) => { - e.preventDefault() + play = e => { + e.preventDefault(); if (this._username !== undefined) { - this.props.chooseUsername(this._username) + this.props.chooseUsername(this._username); } - } + }; render() { return ( @@ -20,24 +19,20 @@ class HomePage extends Component { label="Username" placeholder="Username" hideLabel - onChange={(e) => this._username = e.target.value} + onChange={e => (this._username = e.target.value)} /> - <Button - backgroundColor="primary" - color="white" - big - onClick={this.play}> + <Button backgroundColor="primary" color="white" big onClick={this.play}> PLAY NOW! </Button> </Container> - ) + ); } } -const mapStateToProps = (state) => ({}) +const mapStateToProps = state => ({}); const mapDispatchToProps = { chooseUsername: actions.chooseUsername -} +}; -export default connect(mapStateToProps, mapDispatchToProps)(HomePage) +export default connect(mapStateToProps, mapDispatchToProps)(HomePage); diff --git a/frontend/src/layouts/HomeLayout.js b/frontend/src/layouts/HomeLayout.js index 76236383..77231c77 100644 --- a/frontend/src/layouts/HomeLayout.js +++ b/frontend/src/layouts/HomeLayout.js @@ -1,19 +1,20 @@ -import React from 'react' -import { Banner } from 'rebass' -import logo from './logo-7-wonders.png' -import background from './background-zeus-temple.jpg' -import ReduxToastr from 'react-redux-toastr' +import React from "react"; +import { Banner } from "rebass"; +import logo from "./logo-7-wonders.png"; +import background from "./background-zeus-temple.jpg"; +import ReduxToastr from "react-redux-toastr"; -export default (props) => ( +export default props => ( <div> <Banner align="center" backgroundImage={background}> - <img src={logo} alt="Seven Wonders"/> + <img src={logo} alt="Seven Wonders" /> {props.children} </Banner> <ReduxToastr timeOut={4000} preventDuplicates position="bottom-left" - progressBar/> + progressBar + /> </div> -) +); diff --git a/frontend/src/layouts/LobbyLayout.js b/frontend/src/layouts/LobbyLayout.js index dba3d589..84d3998f 100644 --- a/frontend/src/layouts/LobbyLayout.js +++ b/frontend/src/layouts/LobbyLayout.js @@ -1,22 +1,23 @@ -import React from 'react' -import { Banner } from 'rebass' -import logo from './logo-7-wonders.png' -import ReduxToastr from 'react-redux-toastr' +import React from "react"; +import { Banner } from "rebass"; +import logo from "./logo-7-wonders.png"; +import ReduxToastr from "react-redux-toastr"; -export default (props) => ( +export default props => ( <div> <Banner align="center" - style={{minHeight: '30vh', marginBottom: 0}} + style={{ minHeight: "30vh", marginBottom: 0 }} backgroundImage="https://images.unsplash.com/photo-1431207446535-a9296cf995b1?dpr=1&auto=format&fit=crop&w=1199&h=799&q=80&cs=tinysrgb&crop=" > - <img src={logo} alt="Seven Wonders Logo"/> + <img src={logo} alt="Seven Wonders Logo" /> </Banner> {props.children} <ReduxToastr timeOut={4000} preventDuplicates position="bottom-left" - progressBar/> + progressBar + /> </div> -) +); diff --git a/frontend/src/layouts/index.js b/frontend/src/layouts/index.js index 0413b647..f09b2a20 100644 --- a/frontend/src/layouts/index.js +++ b/frontend/src/layouts/index.js @@ -1,2 +1,2 @@ -export { default as HomeLayout } from './HomeLayout' -export { default as LobbyLayout } from './LobbyLayout' +export { default as HomeLayout } from "./HomeLayout"; +export { default as LobbyLayout } from "./LobbyLayout"; diff --git a/frontend/src/reducers.js b/frontend/src/reducers.js index f5063ac1..a5d4a9fd 100644 --- a/frontend/src/reducers.js +++ b/frontend/src/reducers.js @@ -1,9 +1,9 @@ -import { combineReducers, routerReducer } from 'redux-seamless-immutable' -import { reducer as toastrReducer } from 'react-redux-toastr' +import { combineReducers, routerReducer } from "redux-seamless-immutable"; +import { reducer as toastrReducer } from "react-redux-toastr"; -import errorsReducer from './redux/errors' -import gamesReducer from './redux/games' -import playersReducer from './redux/players' +import errorsReducer from "./redux/errors"; +import gamesReducer from "./redux/games"; +import playersReducer from "./redux/players"; export default function createReducer() { return combineReducers({ @@ -12,5 +12,5 @@ export default function createReducer() { players: playersReducer, routing: routerReducer, toastr: toastrReducer - }) + }); } diff --git a/frontend/src/redux/app.js b/frontend/src/redux/app.js index 251b12a2..d24fbbfd 100644 --- a/frontend/src/redux/app.js +++ b/frontend/src/redux/app.js @@ -1,5 +1,5 @@ export const makeSelectLocationState = () => { - return (state) => { - return state.routing - } -} + return state => { + return state.routing; + }; +}; diff --git a/frontend/src/redux/errors.js b/frontend/src/redux/errors.js index 7d113db1..eb807fdc 100644 --- a/frontend/src/redux/errors.js +++ b/frontend/src/redux/errors.js @@ -1,37 +1,40 @@ -import Immutable from 'seamless-immutable' +import Immutable from "seamless-immutable"; export const types = { - ERROR_RECEIVED_ON_WS: 'ERROR/RECEIVED_ON_WS', -} + ERROR_RECEIVED_ON_WS: "ERROR/RECEIVED_ON_WS" +}; export const actions = { - errorReceived: (error) => ({ + errorReceived: error => ({ type: types.ERROR_RECEIVED_ON_WS, error - }), -} + }) +}; const initialState = Immutable.from({ nextId: 0, history: [] -}) +}); export default (state = initialState, action) => { switch (action.type) { case types.ERROR_RECEIVED_ON_WS: - let error = Object.assign({id: state.nextId, timestamp: new Date()}, action.error); - let newState = state.set('nextId', state.nextId + 1) - newState = addErrorToHistory(newState, error) - return newState + let error = Object.assign( + { id: state.nextId, timestamp: new Date() }, + action.error + ); + let newState = state.set("nextId", state.nextId + 1); + newState = addErrorToHistory(newState, error); + return newState; default: - return state + return state; } -} +}; function addErrorToHistory(state, error) { - return addToArray(state, 'history', error); + return addToArray(state, "history", error); } function addToArray(state, arrayKey, element) { - return state.set(arrayKey, state[arrayKey].concat([ element ])); + return state.set(arrayKey, state[arrayKey].concat([element])); } diff --git a/frontend/src/redux/games.js b/frontend/src/redux/games.js index 2986de07..a7115dcc 100644 --- a/frontend/src/redux/games.js +++ b/frontend/src/redux/games.js @@ -1,43 +1,46 @@ -import Immutable from 'seamless-immutable' +import Immutable from "seamless-immutable"; export const types = { - UPDATE_GAMES: 'GAME/UPDATE_GAMES', - REQUEST_CREATE_GAME: 'GAME/REQUEST_CREATE_GAME', - REQUEST_JOIN_GAME: 'GAME/REQUEST_JOIN_GAME', - REQUEST_START_GAME: 'GAME/REQUEST_JOIN_GAME', - ENTER_LOBBY: 'GAME/ENTER_LOBBY', - ENTER_GAME: 'GAME/ENTER_GAME', -} + UPDATE_GAMES: "GAME/UPDATE_GAMES", + REQUEST_CREATE_GAME: "GAME/REQUEST_CREATE_GAME", + REQUEST_JOIN_GAME: "GAME/REQUEST_JOIN_GAME", + REQUEST_START_GAME: "GAME/REQUEST_JOIN_GAME", + ENTER_LOBBY: "GAME/ENTER_LOBBY", + ENTER_GAME: "GAME/ENTER_GAME" +}; export const actions = { - updateGames: (games) => ({ type: types.UPDATE_GAMES, games: Immutable(games) }), - requestJoinGame: (gameId) => ({ type: types.REQUEST_JOIN_GAME, gameId }), - requestCreateGame: (gameName) => ({ type: types.REQUEST_CREATE_GAME, gameName }), + updateGames: games => ({ type: types.UPDATE_GAMES, games: Immutable(games) }), + requestJoinGame: gameId => ({ type: types.REQUEST_JOIN_GAME, gameId }), + requestCreateGame: gameName => ({ + type: types.REQUEST_CREATE_GAME, + gameName + }), requestStartGame: () => ({ type: types.REQUEST_START_GAME }), - enterLobby: (lobby) => ({ type: types.ENTER_LOBBY, lobby: Immutable(lobby) }), - enterGame: () => ({ type: types.ENTER_GAME }), -} + enterLobby: lobby => ({ type: types.ENTER_LOBBY, lobby: Immutable(lobby) }), + enterGame: () => ({ type: types.ENTER_GAME }) +}; const initialState = Immutable.from({ all: {}, - current: '' -}) + current: "" +}); export default (state = initialState, action) => { switch (action.type) { case types.UPDATE_GAMES: - return Immutable.merge(state, {all: action.games}, {deep: true}) + return Immutable.merge(state, { all: action.games }, { deep: true }); case types.ENTER_LOBBY: - return state.set('current', action.lobby.id) + return state.set("current", action.lobby.id); default: - return state + return state; } -} +}; -export const getAllGamesById = state => state.games.all +export const getAllGamesById = state => state.games.all; export const getAllGames = state => { - let gamesById = getAllGamesById(state) + let gamesById = getAllGamesById(state); return Object.keys(gamesById).map(k => gamesById[k]); -} -export const getGame = (state, id) => getAllGamesById(state)[id] -export const getCurrentGame = state => getGame(state, state.games.current) +}; +export const getGame = (state, id) => getAllGamesById(state)[id]; +export const getCurrentGame = state => getGame(state, state.games.current); diff --git a/frontend/src/redux/players.js b/frontend/src/redux/players.js index 2b530ca1..4016076f 100644 --- a/frontend/src/redux/players.js +++ b/frontend/src/redux/players.js @@ -1,44 +1,46 @@ -import Immutable from 'seamless-immutable' +import Immutable from "seamless-immutable"; export const types = { - REQUEST_CHOOSE_USERNAME: 'USER/REQUEST_CHOOSE_USERNAME', - SET_CURRENT_PLAYER: 'USER/SET_CURRENT_PLAYER', - UPDATE_PLAYERS: 'USER/UPDATE_PLAYERS' -} + REQUEST_CHOOSE_USERNAME: "USER/REQUEST_CHOOSE_USERNAME", + SET_CURRENT_PLAYER: "USER/SET_CURRENT_PLAYER", + UPDATE_PLAYERS: "USER/UPDATE_PLAYERS" +}; export const actions = { - chooseUsername: (username) => ({ + chooseUsername: username => ({ type: types.REQUEST_CHOOSE_USERNAME, username }), - setCurrentPlayer: (player) => ({ + setCurrentPlayer: player => ({ type: types.SET_CURRENT_PLAYER, player }), - updatePlayers: (players) => ({ + updatePlayers: players => ({ type: types.UPDATE_PLAYERS, players - }), -} + }) +}; const initialState = Immutable.from({ all: {}, - current: '' -}) + current: "" +}); export default (state = initialState, action) => { switch (action.type) { case types.SET_CURRENT_PLAYER: - const player = action.player - const withNewPlayer = state.setIn(['all', player.username], player) - return Immutable.set(withNewPlayer, 'current', player.username) + const player = action.player; + const withNewPlayer = state.setIn(["all", player.username], player); + return Immutable.set(withNewPlayer, "current", player.username); case types.UPDATE_PLAYERS: - return Immutable.merge(state, {all: action.players}, {deep: true}) + return Immutable.merge(state, { all: action.players }, { deep: true }); default: - return state + return state; } -} +}; -export const getCurrentPlayer = state => state.players.all && state.players.all[state.players.current] -export const getPlayer = (state, username) => state.players.all[username] -export const getPlayers = (state, usernames) => usernames.map(u => getPlayer(state, u)) +export const getCurrentPlayer = state => + state.players.all && state.players.all[state.players.current]; +export const getPlayer = (state, username) => state.players.all[username]; +export const getPlayers = (state, usernames) => + usernames.map(u => getPlayer(state, u)); diff --git a/frontend/src/sagas.js b/frontend/src/sagas.js index c5166cd5..ff66453e 100644 --- a/frontend/src/sagas.js +++ b/frontend/src/sagas.js @@ -1,18 +1,18 @@ -import { router } from 'redux-saga-router' -import { call, fork } from 'redux-saga/effects' +import { router } from "redux-saga-router"; +import { call, fork } from "redux-saga/effects"; -import { makeSagaRoutes } from './routes' -import { createWsConnection } from './utils/websocket' -import errorHandlingSaga from './sagas/errors' +import { makeSagaRoutes } from "./routes"; +import { createWsConnection } from "./utils/websocket"; +import errorHandlingSaga from "./sagas/errors"; -export default function *rootSaga(history) { - let wsConnection +export default function* rootSaga(history) { + let wsConnection; try { - wsConnection = yield call(createWsConnection) + wsConnection = yield call(createWsConnection); } catch (error) { - console.error('Could not connect to socket') - return + console.error("Could not connect to socket"); + return; } - yield fork(errorHandlingSaga, wsConnection) - yield* router(history, makeSagaRoutes(wsConnection)) + yield fork(errorHandlingSaga, wsConnection); + yield* router(history, makeSagaRoutes(wsConnection)); } diff --git a/frontend/src/sagas/errors.js b/frontend/src/sagas/errors.js index ba1ae40d..42994610 100644 --- a/frontend/src/sagas/errors.js +++ b/frontend/src/sagas/errors.js @@ -1,36 +1,40 @@ -import { apply, call, cancelled, put, take } from 'redux-saga/effects' +import { apply, call, cancelled, put, take } from "redux-saga/effects"; -import { createSubscriptionChannel } from '../utils/websocket' -import { actions } from '../redux/errors' +import { createSubscriptionChannel } from "../utils/websocket"; +import { actions } from "../redux/errors"; -import {toastr} from 'react-redux-toastr' +import { toastr } from "react-redux-toastr"; -export default function *errorHandlingSaga({ socket }) { - const errorChannel = yield call(createSubscriptionChannel, socket, '/user/queue/errors') +export default function* errorHandlingSaga({ socket }) { + const errorChannel = yield call( + createSubscriptionChannel, + socket, + "/user/queue/errors" + ); try { while (true) { - const error = yield take(errorChannel) - yield* handleOneError(error) + const error = yield take(errorChannel); + yield* handleOneError(error); } } finally { if (yield cancelled()) { - console.log('Error management saga cancelled') - yield apply(errorChannel, errorChannel.close) + console.log("Error management saga cancelled"); + yield apply(errorChannel, errorChannel.close); } } } -function *handleOneError(err) { - console.error("Error received on web socket channel", err) - const msg = buildMsg(err) - yield apply(toastr, toastr.error, [msg, {icon: 'error'}]) - yield put(actions.errorReceived(err)) +function* handleOneError(err) { + console.error("Error received on web socket channel", err); + const msg = buildMsg(err); + yield apply(toastr, toastr.error, [msg, { icon: "error" }]); + yield put(actions.errorReceived(err)); } function buildMsg(err) { if (err.details.length > 0) { - return err.details.map(d => d.message).join('\n') + return err.details.map(d => d.message).join("\n"); } else { - return err.message + return err.message; } } diff --git a/frontend/src/sagas/home.js b/frontend/src/sagas/home.js index 151fcb57..15f95162 100644 --- a/frontend/src/sagas/home.js +++ b/frontend/src/sagas/home.js @@ -1,32 +1,39 @@ -import { apply, call, put, take } from 'redux-saga/effects' -import { createSubscriptionChannel } from '../utils/websocket' -import { push } from 'react-router-redux' +import { apply, call, put, take } from "redux-saga/effects"; +import { createSubscriptionChannel } from "../utils/websocket"; +import { push } from "react-router-redux"; -import { actions, types } from '../redux/players' +import { actions, types } from "../redux/players"; -function *sendUsername({ socket }) { +function* sendUsername({ socket }) { while (true) { - const {username} = yield take(types.REQUEST_CHOOSE_USERNAME) - yield apply(socket, socket.send, ['/app/chooseName', JSON.stringify({playerName: username})]) + const { username } = yield take(types.REQUEST_CHOOSE_USERNAME); + yield apply(socket, socket.send, [ + "/app/chooseName", + JSON.stringify({ playerName: username }) + ]); } } -function *validateUsername({ socket }) { - const usernameChannel = yield call(createSubscriptionChannel, socket, '/user/queue/nameChoice') +function* validateUsername({ socket }) { + const usernameChannel = yield call( + createSubscriptionChannel, + socket, + "/user/queue/nameChoice" + ); while (true) { - const user = yield take(usernameChannel) - yield put(actions.setCurrentPlayer(user)) - yield apply(usernameChannel, usernameChannel.close) - yield put(push('/games')) + const user = yield take(usernameChannel); + yield put(actions.setCurrentPlayer(user)); + yield apply(usernameChannel, usernameChannel.close); + yield put(push("/games")); } } -function *usernameChoiceSaga(wsConnection) { +function* usernameChoiceSaga(wsConnection) { // TODO: Run sendUsername in loop when we have the ability to cancel saga on route change yield [ call(sendUsername, wsConnection), - call(validateUsername, wsConnection), - ] + call(validateUsername, wsConnection) + ]; } -export default usernameChoiceSaga +export default usernameChoiceSaga; diff --git a/frontend/src/sagas/lobby.js b/frontend/src/sagas/lobby.js index f002c897..f092fdb7 100644 --- a/frontend/src/sagas/lobby.js +++ b/frontend/src/sagas/lobby.js @@ -1,58 +1,66 @@ -import { call, put, take, apply } from 'redux-saga/effects' -import { createSubscriptionChannel } from '../utils/websocket' -import { push } from 'react-router-redux' +import { call, put, take, apply } from "redux-saga/effects"; +import { createSubscriptionChannel } from "../utils/websocket"; +import { push } from "react-router-redux"; -import { normalize } from 'normalizr' -import { game as gameSchema } from '../schemas/games' +import { normalize } from "normalizr"; +import { game as gameSchema } from "../schemas/games"; -import { actions as gameActions, types } from '../redux/games' -import { actions as playerActions } from '../redux/players' +import { actions as gameActions, types } from "../redux/games"; +import { actions as playerActions } from "../redux/players"; function getCurrentGameId() { - const path = window.location.pathname - return path.split('lobby/')[1] + const path = window.location.pathname; + return path.split("lobby/")[1]; } -function *watchLobbyUpdates({ socket }) { - const currentGameId = getCurrentGameId() - const lobbyUpdatesChannel = yield call(createSubscriptionChannel, socket, `/topic/lobby/${currentGameId}/updated`) +function* watchLobbyUpdates({ socket }) { + const currentGameId = getCurrentGameId(); + const lobbyUpdatesChannel = yield call( + createSubscriptionChannel, + socket, + `/topic/lobby/${currentGameId}/updated` + ); try { while (true) { - const lobby = yield take(lobbyUpdatesChannel) - const normalized = normalize(lobby, gameSchema) - yield put(gameActions.updateGames(normalized.entities.games)) - yield put(playerActions.updatePlayers(normalized.entities.players)) + const lobby = yield take(lobbyUpdatesChannel); + const normalized = normalize(lobby, gameSchema); + yield put(gameActions.updateGames(normalized.entities.games)); + yield put(playerActions.updatePlayers(normalized.entities.players)); } } finally { - yield apply(lobbyUpdatesChannel, lobbyUpdatesChannel.close) + yield apply(lobbyUpdatesChannel, lobbyUpdatesChannel.close); } } -function *watchGameStart({ socket }) { - const currentGameId = getCurrentGameId() - const gameStartedChannel = yield call(createSubscriptionChannel, socket, `/topic/lobby/${currentGameId}/started`) +function* watchGameStart({ socket }) { + const currentGameId = getCurrentGameId(); + const gameStartedChannel = yield call( + createSubscriptionChannel, + socket, + `/topic/lobby/${currentGameId}/started` + ); try { - yield take(gameStartedChannel) - yield put(gameActions.enterGame()) - yield put(push('/game')) + yield take(gameStartedChannel); + yield put(gameActions.enterGame()); + yield put(push("/game")); } finally { - yield apply(gameStartedChannel, gameStartedChannel.close) + yield apply(gameStartedChannel, gameStartedChannel.close); } } -function *startGame({ socket }) { +function* startGame({ socket }) { while (true) { - yield take(types.REQUEST_START_GAME) - yield apply(socket, socket.send, ['/app/lobby/startGame', {}]) + yield take(types.REQUEST_START_GAME); + yield apply(socket, socket.send, ["/app/lobby/startGame", {}]); } } -function *lobbySaga(socketConnection) { +function* lobbySaga(socketConnection) { yield [ call(watchLobbyUpdates, socketConnection), call(watchGameStart, socketConnection), call(startGame, socketConnection) - ] + ]; } -export default lobbySaga +export default lobbySaga; diff --git a/frontend/src/schemas/games.js b/frontend/src/schemas/games.js index f7a9ffb8..9c9681da 100644 --- a/frontend/src/schemas/games.js +++ b/frontend/src/schemas/games.js @@ -1,11 +1,15 @@ -import { schema } from 'normalizr' +import { schema } from "normalizr"; -const player = new schema.Entity('players', {}, { - idAttribute: 'username' -}) +const player = new schema.Entity( + "players", + {}, + { + idAttribute: "username" + } +); -export const game = new schema.Entity('games', { - players: [ player ] -}) +export const game = new schema.Entity("games", { + players: [player] +}); -export const gameList = [ game ] +export const gameList = [game]; diff --git a/frontend/src/store.js b/frontend/src/store.js index bd05e2c5..ef9038eb 100644 --- a/frontend/src/store.js +++ b/frontend/src/store.js @@ -1,43 +1,38 @@ -import { createStore, applyMiddleware, compose } from 'redux' -import { browserHistory } from 'react-router' -import { syncHistoryWithStore, routerMiddleware } from 'react-router-redux' -import Immutable from 'seamless-immutable' +import { createStore, applyMiddleware, compose } from "redux"; +import { browserHistory } from "react-router"; +import { syncHistoryWithStore, routerMiddleware } from "react-router-redux"; +import Immutable from "seamless-immutable"; -import createReducer from './reducers' -import createSagaMiddleware from 'redux-saga' -import rootSaga from './sagas' -import { makeSelectLocationState } from './redux/app' +import createReducer from "./reducers"; +import createSagaMiddleware from "redux-saga"; +import rootSaga from "./sagas"; +import { makeSelectLocationState } from "./redux/app"; export default function configureStore(initialState = {}) { - const sagaMiddleware = createSagaMiddleware() + const sagaMiddleware = createSagaMiddleware(); - const middlewares = [ - sagaMiddleware, - routerMiddleware(browserHistory) - ] + const middlewares = [sagaMiddleware, routerMiddleware(browserHistory)]; - const enhancers = [ - applyMiddleware(...middlewares) - ] + const enhancers = [applyMiddleware(...middlewares)]; - const composeEnhancers = - process.env.NODE_ENV !== 'production' && - typeof window === 'object' && - window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? - window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : compose; + const composeEnhancers = process.env.NODE_ENV !== "production" && + typeof window === "object" && + window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ + ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ + : compose; const store = createStore( createReducer(), Immutable.from(initialState), composeEnhancers(...enhancers) - ) + ); - sagaMiddleware.run(rootSaga, browserHistory) + sagaMiddleware.run(rootSaga, browserHistory); return { store, history: syncHistoryWithStore(browserHistory, store, { selectLocationState: makeSelectLocationState() }) - } + }; } diff --git a/frontend/src/utils/websocket.js b/frontend/src/utils/websocket.js index 1dde5397..6db91899 100644 --- a/frontend/src/utils/websocket.js +++ b/frontend/src/utils/websocket.js @@ -1,23 +1,28 @@ -import SockJS from 'sockjs-client' -import Stomp from 'webstomp-client' -import { eventChannel } from 'redux-saga' +import SockJS from "sockjs-client"; +import Stomp from "webstomp-client"; +import { eventChannel } from "redux-saga"; -const wsURL = '/seven-wonders-websocket' +const wsURL = "/seven-wonders-websocket"; -export const createWsConnection = (headers = {}) => new Promise((resolve, reject) => { +export const createWsConnection = (headers = {}) => + new Promise((resolve, reject) => { let socket = Stomp.over(new SockJS(wsURL), { debug: process.env.NODE_ENV !== "production" - }) - socket.connect(headers, (frame) => { - return resolve({ frame, socket }) - }, reject) -}) + }); + socket.connect( + headers, + frame => { + return resolve({ frame, socket }); + }, + reject + ); + }); export const createSubscriptionChannel = (socket, path) => { return eventChannel(emitter => { const receiveUsernameHandler = socket.subscribe(path, event => { - emitter(JSON.parse(event.body)) - }) - return () => receiveUsernameHandler.unsubscribe() - }) -} + emitter(JSON.parse(event.body)); + }); + return () => receiveUsernameHandler.unsubscribe(); + }); +}; diff --git a/frontend/yarn.lock b/frontend/yarn.lock index f85e7217..940a6292 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -62,20 +62,13 @@ ajv-keywords@^1.0.0, ajv-keywords@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.2.0.tgz#676c4f087bfe1e8b12dca6fda2f3c74f417b099c" -ajv@^4.11.2: +ajv@^4.11.2, ajv@^4.7.0: version "4.11.8" resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.11.8.tgz#82ffb02b29e662ae53bdc20af15947706739c536" dependencies: co "^4.6.0" json-stable-stringify "^1.0.1" -ajv@^4.7.0: - version "4.9.2" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-4.9.2.tgz#3f7dcda95b0c34bceb2d69945117d146219f1a2c" - dependencies: - co "^4.6.0" - json-stable-stringify "^1.0.1" - ajv@^5.0.0: version "5.1.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.1.2.tgz#c2be11aff5de51613592913bc820224906da84a1" @@ -268,6 +261,10 @@ ast-types-flow@0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad" +ast-types@0.9.8: + version "0.9.8" + resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.9.8.tgz#6cb6a40beba31f49f20928e28439fc14a3dab078" + async-each@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.1.tgz#19d386a1d9edc6e7c1c85d388aedbcc56d33602d" @@ -330,7 +327,7 @@ babel-code-frame@6.22.0, babel-code-frame@^6.11.0, babel-code-frame@^6.16.0, bab esutils "^2.0.2" js-tokens "^3.0.0" -babel-core@6.24.1, babel-core@^6.24.1: +babel-core@6.24.1, babel-core@^6.0.0, babel-core@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.24.1.tgz#8c428564dce1e1f41fb337ec34f4c3b022b5ad83" dependencies: @@ -354,30 +351,6 @@ babel-core@6.24.1, babel-core@^6.24.1: slash "^1.0.0" source-map "^0.5.0" -babel-core@^6.0.0: - version "6.22.1" - resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.22.1.tgz#9c5fd658ba1772d28d721f6d25d968fc7ae21648" - dependencies: - babel-code-frame "^6.22.0" - babel-generator "^6.22.0" - babel-helpers "^6.22.0" - babel-messages "^6.22.0" - babel-register "^6.22.0" - babel-runtime "^6.22.0" - babel-template "^6.22.0" - babel-traverse "^6.22.1" - babel-types "^6.22.0" - babylon "^6.11.0" - convert-source-map "^1.1.0" - debug "^2.1.1" - json5 "^0.5.0" - lodash "^4.2.0" - minimatch "^3.0.2" - path-is-absolute "^1.0.0" - private "^0.1.6" - slash "^1.0.0" - source-map "^0.5.0" - babel-eslint@7.2.3: version "7.2.3" resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-7.2.3.tgz#b2fe2d80126470f5c19442dc757253a897710827" @@ -387,7 +360,7 @@ babel-eslint@7.2.3: babel-types "^6.23.0" babylon "^6.17.0" -babel-generator@^6.18.0, babel-generator@^6.22.0, babel-generator@^6.24.1: +babel-generator@^6.18.0, babel-generator@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.24.1.tgz#e715f486c58ded25649d888944d52aa07c5d9497" dependencies: @@ -502,7 +475,7 @@ babel-helper-replace-supers@^6.24.1: babel-traverse "^6.24.1" babel-types "^6.24.1" -babel-helpers@^6.22.0, babel-helpers@^6.24.1: +babel-helpers@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-helpers/-/babel-helpers-6.24.1.tgz#3471de9caec388e5c850e597e58a26ddf37602b2" dependencies: @@ -525,7 +498,7 @@ babel-loader@7.0.0: loader-utils "^1.0.2" mkdirp "^0.5.1" -babel-messages@^6.22.0, babel-messages@^6.23.0: +babel-messages@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" dependencies: @@ -931,7 +904,7 @@ babel-preset-react@6.24.1: babel-plugin-transform-react-jsx-source "^6.22.0" babel-preset-flow "^6.23.0" -babel-register@^6.22.0, babel-register@^6.24.1: +babel-register@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-register/-/babel-register-6.24.1.tgz#7e10e13a2f71065bdfad5a1787ba45bca6ded75f" dependencies: @@ -943,7 +916,7 @@ babel-register@^6.22.0, babel-register@^6.24.1: mkdirp "^0.5.1" source-map-support "^0.4.2" -babel-runtime@6.23.0, babel-runtime@^6.18.0: +babel-runtime@6.23.0, babel-runtime@^6.18.0, babel-runtime@^6.22.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.23.0.tgz#0a9489f144de70efb3ce4300accdb329e2fc543b" dependencies: @@ -957,14 +930,7 @@ babel-runtime@^6.20.0: core-js "^2.4.0" regenerator-runtime "^0.10.0" -babel-runtime@^6.22.0: - version "6.22.0" - resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.22.0.tgz#1cf8b4ac67c77a4ddb0db2ae1f74de52ac4ca611" - dependencies: - core-js "^2.4.0" - regenerator-runtime "^0.10.0" - -babel-template@^6.16.0, babel-template@^6.22.0, babel-template@^6.24.1: +babel-template@^6.16.0, babel-template@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.24.1.tgz#04ae514f1f93b3a2537f2a0f60a5a45fb8308333" dependencies: @@ -974,7 +940,7 @@ babel-template@^6.16.0, babel-template@^6.22.0, babel-template@^6.24.1: babylon "^6.11.0" lodash "^4.2.0" -babel-traverse@^6.18.0, babel-traverse@^6.22.1, babel-traverse@^6.23.1, babel-traverse@^6.24.1: +babel-traverse@^6.18.0, babel-traverse@^6.23.1, babel-traverse@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.24.1.tgz#ab36673fd356f9a0948659e7b338d5feadb31695" dependencies: @@ -988,7 +954,7 @@ babel-traverse@^6.18.0, babel-traverse@^6.22.1, babel-traverse@^6.23.1, babel-tr invariant "^2.2.0" lodash "^4.2.0" -babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.22.0, babel-types@^6.23.0, babel-types@^6.24.1: +babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.23.0, babel-types@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.24.1.tgz#a136879dc15b3606bda0d90c1fc74304c2ff0975" dependencies: @@ -997,6 +963,10 @@ babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.22.0, babel-types@^6.23 lodash "^4.2.0" to-fast-properties "^1.0.1" +babylon@7.0.0-beta.8: + version "7.0.0-beta.8" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.8.tgz#2bdc5ae366041442c27e068cce6f0d7c06ea9949" + babylon@^6.11.0: version "6.14.1" resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.14.1.tgz#956275fab72753ad9b3435d7afe58f8bf0a29815" @@ -2252,7 +2222,7 @@ estraverse@~4.1.0: version "4.1.1" resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.1.1.tgz#f6caca728933a850ef90661d0e17982ba47111a2" -esutils@^2.0.0, esutils@^2.0.2: +esutils@2.0.2, esutils@^2.0.0, esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" @@ -2516,6 +2486,10 @@ flatten@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782" +flow-parser@0.45.0: + version "0.45.0" + resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.45.0.tgz#aa29d4ae27f06aa02817772bba0fcbefef7e62f0" + for-in@^0.1.5: version "0.1.6" resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.6.tgz#c9f96e89bfad18a545af5ec3ed352a1d9e5b4dc8" @@ -2632,6 +2606,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-stdin@5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-5.0.1.tgz#122e161591e21ff4c52530305693f20e6393a398" + get-stdin@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-4.0.1.tgz#b968c6b0a04384324902e8bf1a5df32579a450fe" @@ -2655,7 +2633,7 @@ glob-parent@^2.0.0: dependencies: is-glob "^2.0.0" -glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1: +glob@7.1.1, glob@^7.0.0, glob@^7.0.3, glob@^7.0.5, glob@^7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.1.tgz#805211df04faaf1c63a3600306cdf5ade50b2ec8" dependencies: @@ -3432,6 +3410,13 @@ jest-jasmine2@^20.0.3: once "^1.4.0" p-map "^1.1.1" +jest-matcher-utils@^19.0.0: + version "19.0.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-19.0.0.tgz#5ecd9b63565d2b001f61fbf7ec4c7f537964564d" + dependencies: + chalk "^1.1.3" + pretty-format "^19.0.0" + jest-matcher-utils@^20.0.3: version "20.0.3" resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-20.0.3.tgz#b3a6b8e37ca577803b0832a98b164f44b7815612" @@ -3521,6 +3506,15 @@ jest-util@^20.0.3: leven "^2.1.0" mkdirp "^0.5.1" +jest-validate@19.0.0: + version "19.0.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-19.0.0.tgz#8c6318a20ecfeaba0ba5378bfbb8277abded4173" + dependencies: + chalk "^1.1.1" + jest-matcher-utils "^19.0.0" + leven "^2.0.0" + pretty-format "^19.0.0" + jest-validate@^20.0.3: version "20.0.3" resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-20.0.3.tgz#d0cfd1de4f579f298484925c280f8f1d94ec3cab" @@ -3550,20 +3544,20 @@ js-tokens@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7" -js-yaml@^3.4.3, js-yaml@^3.5.1, js-yaml@~3.6.1: - version "3.6.1" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.6.1.tgz#6e5fe67d8b205ce4d22fad05b7781e8dadcc4b30" - dependencies: - argparse "^1.0.7" - esprima "^2.6.0" - -js-yaml@^3.7.0: +js-yaml@^3.4.3, js-yaml@^3.7.0: version "3.8.4" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.4.tgz#520b4564f86573ba96662af85a8cafa7b4b5a6f6" dependencies: argparse "^1.0.7" esprima "^3.1.1" +js-yaml@^3.5.1, js-yaml@~3.6.1: + version "3.6.1" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.6.1.tgz#6e5fe67d8b205ce4d22fad05b7781e8dadcc4b30" + dependencies: + argparse "^1.0.7" + esprima "^2.6.0" + jsbn@~0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.0.tgz#650987da0dd74f4ebf5a11377a2aa2d273e97dfd" @@ -3690,7 +3684,7 @@ lcid@^1.0.0: dependencies: invert-kv "^1.0.0" -leven@^2.1.0: +leven@^2.0.0, leven@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" @@ -3783,14 +3777,14 @@ lodash.templatesettings@^4.0.0: dependencies: lodash._reinterpolate "~3.0.0" -"lodash@>=3.5 <5", lodash@^4.0.0, lodash@^4.14.0, lodash@^4.15.0, lodash@^4.2.0, lodash@^4.2.1, lodash@^4.3.0: - version "4.17.2" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.2.tgz#34a3055babe04ce42467b607d700072c7ff6bf42" - -lodash@^4.17.2, lodash@^4.17.3: +"lodash@>=3.5 <5", lodash@^4.14.0, lodash@^4.17.2, lodash@^4.17.3, lodash@^4.3.0: version "4.17.4" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.4.tgz#78203a4d1c328ae1d86dca6460e369b57f4055ae" +lodash@^4.0.0, lodash@^4.15.0, lodash@^4.2.0, lodash@^4.2.1: + version "4.17.2" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.2.tgz#34a3055babe04ce42467b607d700072c7ff6bf42" + longest@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" @@ -3942,7 +3936,7 @@ minimist@0.0.8, minimist@~0.0.1: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" -minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: +minimist@1.2.0, minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" @@ -4701,6 +4695,21 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" +prettier@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.3.1.tgz#fa0ea84b45ac0ba6de6a1e4cecdcff900d563151" + dependencies: + ast-types "0.9.8" + babel-code-frame "6.22.0" + babylon "7.0.0-beta.8" + chalk "1.1.3" + esutils "2.0.2" + flow-parser "0.45.0" + get-stdin "5.0.1" + glob "7.1.1" + jest-validate "19.0.0" + minimist "1.2.0" + pretty-bytes@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-4.0.2.tgz#b2bf82e7350d65c6c33aa95aaa5a4f6327f61cd9" @@ -4712,6 +4721,12 @@ pretty-error@^2.0.2: renderkid "~2.0.0" utila "~0.4" +pretty-format@^19.0.0: + version "19.0.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-19.0.0.tgz#56530d32acb98a3fa4851c4e2b9d37b420684c84" + dependencies: + ansi-styles "^3.0.0" + pretty-format@^20.0.3: version "20.0.3" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-20.0.3.tgz#020e350a560a1fe1a98dc3beb6ccffb386de8b14" @@ -5005,7 +5020,7 @@ readable-stream@1.0: isarray "0.0.1" string_decoder "~0.10.x" -readable-stream@^2.0.0, readable-stream@^2.2.2: +readable-stream@^2.0.0, "readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.1.0, readable-stream@^2.2.2: version "2.2.9" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.2.9.tgz#cf78ec6f4a6d1eb43d26488cac97f042e74b7fc8" dependencies: @@ -5017,7 +5032,7 @@ readable-stream@^2.0.0, readable-stream@^2.2.2: string_decoder "~1.0.0" util-deprecate "~1.0.1" -"readable-stream@^2.0.0 || ^1.1.13", readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.5, readable-stream@^2.1.0, readable-stream@~2.1.4: +readable-stream@~2.1.4: version "2.1.5" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.1.5.tgz#66fa8b720e1438b364681f2ad1a63c618448c9d0" dependencies: @@ -5302,15 +5317,15 @@ right-align@^0.1.1: dependencies: align-text "^0.1.1" -rimraf@2, rimraf@^2.2.8, rimraf@~2.5.1, rimraf@~2.5.4: - version "2.5.4" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.5.4.tgz#96800093cbf1a0c86bd95b4625467535c29dfa04" +rimraf@2, rimraf@^2.2.8, rimraf@^2.6.1: + version "2.6.1" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" dependencies: glob "^7.0.5" -rimraf@^2.6.1: - version "2.6.1" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.1.tgz#c2338ec643df7a1b7fe5c54fa86f57428a55f33d" +rimraf@~2.5.1, rimraf@~2.5.4: + version "2.5.4" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.5.4.tgz#96800093cbf1a0c86bd95b4625467535c29dfa04" dependencies: glob "^7.0.5" @@ -6270,14 +6285,10 @@ whatwg-encoding@^1.0.1: dependencies: iconv-lite "0.4.13" -whatwg-fetch@2.0.3: +whatwg-fetch@2.0.3, whatwg-fetch@>=0.10.0: version "2.0.3" resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz#9c84ec2dcf68187ff00bc64e1274b442176e1c84" -whatwg-fetch@>=0.10.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.2.tgz#fe294d1d89e36c5be8b3195057f2e4bc74fc980e" - whatwg-url@^4.3.0: version "4.8.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.8.0.tgz#d2981aa9148c1e00a41c5a6131166ab4683bbcc0" |