Update client dependencies

This commit is contained in:
Ken-Håvard Lieng 2016-03-14 23:22:24 +01:00
parent 42efc20748
commit 81b635a872
18 changed files with 97 additions and 162 deletions

File diff suppressed because one or more lines are too long

View File

@ -6,7 +6,8 @@
"new-cap": [2, { "capIsNewExceptions": ["Map", "List", "Record", "Set"] }], "new-cap": [2, { "capIsNewExceptions": ["Map", "List", "Record", "Set"] }],
"no-console": 0, "no-console": 0,
"no-param-reassign": 0, "no-param-reassign": 0,
"react/prop-types": 0 "react/prop-types": 0,
"react/prefer-stateless-function": 0
}, },
"globals": { "globals": {
"__DEV__": true "__DEV__": true

View File

@ -4,21 +4,21 @@
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"devDependencies": { "devDependencies": {
"babel-core": "^6.5.2", "babel-core": "^6.7.2",
"babel-eslint": "^5.0.0-beta6", "babel-eslint": "^6.0.0-beta.6",
"babel-loader": "^6.2.2", "babel-loader": "^6.2.4",
"babel-plugin-react-transform": "^2.0.0", "babel-plugin-react-transform": "^2.0.2",
"babel-plugin-transform-decorators-legacy": "^1.3.4", "babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-react-constant-elements": "^6.5.0", "babel-plugin-transform-react-constant-elements": "^6.5.0",
"babel-plugin-transform-react-inline-elements": "^6.5.0", "babel-plugin-transform-react-inline-elements": "^6.6.5",
"babel-preset-es2015": "^6.5.0", "babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0", "babel-preset-react": "^6.5.0",
"babel-preset-stage-0": "^6.5.0", "babel-preset-stage-0": "^6.5.0",
"css-loader": "^0.23.1", "css-loader": "^0.23.1",
"eslint": "^1.10.3", "eslint": "^2.4.0",
"eslint-config-airbnb": "^5.0.1", "eslint-config-airbnb": "^6.1.0",
"eslint-loader": "^1.2.1", "eslint-loader": "^1.3.0",
"eslint-plugin-react": "^3.16.1", "eslint-plugin-react": "^4.2.1",
"express": "^4.13.4", "express": "^4.13.4",
"express-http-proxy": "^0.6.0", "express-http-proxy": "^0.6.0",
"gulp": "^3.9.1", "gulp": "^3.9.1",
@ -31,33 +31,30 @@
"gulp-util": "^3.0.7", "gulp-util": "^3.0.7",
"ify-loader": "^1.0.3", "ify-loader": "^1.0.3",
"react-transform-catch-errors": "^1.0.2", "react-transform-catch-errors": "^1.0.2",
"react-transform-hmr": "^1.0.2", "react-transform-hmr": "^1.0.4",
"redbox-react": "^1.2.2", "redbox-react": "^1.2.2",
"redux-devtools": "^3.1.1",
"redux-devtools-dock-monitor": "^1.0.1",
"redux-devtools-log-monitor": "^1.0.4",
"style-loader": "^0.13.0", "style-loader": "^0.13.0",
"webpack": "^1.12.13", "webpack": "^1.12.14",
"webpack-dev-middleware": "^1.5.1", "webpack-dev-middleware": "^1.5.1",
"webpack-hot-middleware": "^2.7.1" "webpack-hot-middleware": "^2.10.0"
}, },
"dependencies": { "dependencies": {
"autolinker": "git+https://github.com/robbie-c/Autolinker.js.git", "autolinker": "git+https://github.com/robbie-c/Autolinker.js.git",
"backo": "^1.1.0", "backo": "^1.1.0",
"base64-arraybuffer": "^0.1.5", "base64-arraybuffer": "^0.1.5",
"eventemitter2": "^0.4.14", "eventemitter2": "^1.0.0",
"history": "^2.0.0", "history": "^2.0.1",
"immutable": "^3.7.6", "immutable": "^3.7.6",
"lodash": "^4.3.0", "lodash": "^4.6.1",
"pure-render-decorator": "^0.2.0", "pure-render-decorator": "^0.2.0",
"react": "^0.14.7", "react": "^0.14.7",
"react-dom": "^0.14.7", "react-dom": "^0.14.7",
"react-redux": "^4.4.0", "react-redux": "^4.4.1",
"react-router": "^2.0.0", "react-router": "^2.0.1",
"react-router-redux": "^3.0.0", "react-router-redux": "^4.0.0",
"react-virtualized": "^4.10.0", "react-virtualized": "^4.10.0",
"redux": "^3.3.1", "redux": "^3.3.1",
"redux-thunk": "^1.0.3", "redux-thunk": "^2.0.1",
"reselect": "^2.0.3" "reselect": "^2.1.0"
} }
} }

View File

@ -64,7 +64,9 @@ export function addMessages(messages) {
return (dispatch, getState) => { return (dispatch, getState) => {
const state = getState(); const state = getState();
messages.forEach(message => initMessage(message, state).time = now); messages.forEach(message => {
initMessage(message, state).time = now;
});
dispatch({ dispatch({
type: actions.ADD_MESSAGES, type: actions.ADD_MESSAGES,

View File

@ -1,14 +1,14 @@
import { routeActions } from 'react-router-redux'; import { push, replace } from 'react-router-redux';
import * as actions from '../actions'; import * as actions from '../actions';
export function select(server, channel, pm) { export function select(server, channel, pm) {
if (pm) { if (pm) {
return routeActions.push(`/${server}/pm/${channel}`); return push(`/${server}/pm/${channel}`);
} else if (channel) { } else if (channel) {
return routeActions.push(`/${server}/${encodeURIComponent(channel)}`); return push(`/${server}/${encodeURIComponent(channel)}`);
} }
return routeActions.push(`/${server}`); return push(`/${server}`);
} }
export function updateSelection() { export function updateSelection() {
@ -19,14 +19,14 @@ export function updateSelection() {
const { server } = state.tab.selected; const { server } = state.tab.selected;
if (servers.size === 0) { if (servers.size === 0) {
dispatch(routeActions.replace('/connect')); dispatch(replace('/connect'));
} else if (history.size > 0) { } else if (history.size > 0) {
const tab = history.last(); const tab = history.last();
dispatch(select(tab.server, tab.channel || tab.user, tab.user)); dispatch(select(tab.server, tab.channel || tab.user, tab.user));
} else if (servers.has(server)) { } else if (servers.has(server)) {
dispatch(select(server)); dispatch(select(server));
} else { } else {
dispatch(routeActions.replace('/')); dispatch(replace('/'));
} }
}; };
} }

View File

@ -1,6 +1,6 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { routeActions } from 'react-router-redux'; import { push } from 'react-router-redux';
import pure from 'pure-render-decorator'; import pure from 'pure-render-decorator';
import TabList from '../components/TabList'; import TabList from '../components/TabList';
import { select } from '../actions/tab'; import { select } from '../actions/tab';
@ -32,4 +32,4 @@ function mapStateToProps(state) {
}; };
} }
export default connect(mapStateToProps, { pushPath: routeActions.push, select, hideMenu })(App); export default connect(mapStateToProps, { pushPath: push, select, hideMenu })(App);

View File

@ -1,10 +0,0 @@
import React from 'react';
import { createDevTools } from 'redux-devtools';
import DockMonitor from 'redux-devtools-dock-monitor';
import LogMonitor from 'redux-devtools-log-monitor';
export default createDevTools(
<DockMonitor toggleVisibilityKey="ctrl-h" changePositionKey="ctrl-q" defaultIsVisible={false}>
<LogMonitor theme="tomorrow" />
</DockMonitor>
);

View File

@ -1,18 +0,0 @@
import React, { Component } from 'react';
import { Router } from 'react-router';
import { Provider } from 'react-redux';
import DevTools from './DevTools';
export default class Root extends Component {
render() {
const { store, routes, history } = this.props;
return (
<Provider store={store}>
<div>
<Router routes={routes} history={history} />
<DevTools />
</div>
</Provider>
);
}
}

View File

@ -1,5 +1,14 @@
if (__DEV__) { import React, { Component } from 'react';
module.exports = require('./Root.dev'); import { Router } from 'react-router';
} else { import { Provider } from 'react-redux';
module.exports = require('./Root.prod');
export default class Root extends Component {
render() {
const { store, routes, history } = this.props;
return (
<Provider store={store}>
<Router routes={routes} history={history} />
</Provider>
);
}
} }

View File

@ -1,14 +0,0 @@
import React, { Component } from 'react';
import { Router } from 'react-router';
import { Provider } from 'react-redux';
export default class Root extends Component {
render() {
const { store, routes, history } = this.props;
return (
<Provider store={store}>
<Router routes={routes} history={history} />
</Provider>
);
}
}

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import { render } from 'react-dom'; import { render } from 'react-dom';
import { browserHistory } from 'react-router'; import { browserHistory } from 'react-router';
import { routeActions } from 'react-router-redux'; import { syncHistoryWithStore, replace } from 'react-router-redux';
import configureStore from './store'; import configureStore from './store';
import createRoutes from './routes'; import createRoutes from './routes';
import Socket from './util/Socket'; import Socket from './util/Socket';
@ -28,7 +28,7 @@ if (env.servers) {
data: env.servers data: env.servers
}); });
} else { } else {
store.dispatch(routeActions.replace('/connect')); store.dispatch(replace('/connect'));
} }
if (env.channels) { if (env.channels) {
@ -48,8 +48,9 @@ if (env.users) {
handleSocket(socket, store); handleSocket(socket, store);
const routes = createRoutes(); const routes = createRoutes();
const history = syncHistoryWithStore(browserHistory, store);
render( render(
<Root store={store} routes={routes} history={browserHistory} />, <Root store={store} routes={routes} history={history} />,
document.getElementById('root') document.getElementById('root')
); );

View File

@ -1,5 +1,5 @@
import { combineReducers } from 'redux'; import { combineReducers } from 'redux';
import { routeReducer } from 'react-router-redux'; import { routerReducer } from 'react-router-redux';
import channels from './channels'; import channels from './channels';
import environment from './environment'; import environment from './environment';
import input from './input'; import input from './input';
@ -12,7 +12,7 @@ import tab from './tab';
import ui from './ui'; import ui from './ui';
export default combineReducers({ export default combineReducers({
routing: routeReducer, routing: routerReducer,
channels, channels,
environment, environment,
input, input,

View File

@ -1,5 +1,5 @@
import { Record, List } from 'immutable'; import { Record, List } from 'immutable';
import { UPDATE_LOCATION } from 'react-router-redux'; import { LOCATION_CHANGE } from 'react-router-redux';
import createReducer from '../util/createReducer'; import createReducer from '../util/createReducer';
import * as actions from '../actions'; import * as actions from '../actions';
@ -38,7 +38,7 @@ export default createReducer(new State(), {
return state.set('history', state.history.filter(tab => tab.server !== action.server)); return state.set('history', state.history.filter(tab => tab.server !== action.server));
}, },
[UPDATE_LOCATION](state, action) { [LOCATION_CHANGE](state, action) {
if (action.payload.pathname.indexOf('.') === -1 && state.selected.server) { if (action.payload.pathname.indexOf('.') === -1 && state.selected.server) {
return state.set('selected', new Tab()); return state.set('selected', new Tab());
} }

View File

@ -8,8 +8,8 @@ function withReason(message, reason) {
} }
export default function handleSocket(socket, { dispatch, getState }) { export default function handleSocket(socket, { dispatch, getState }) {
socket.onAny(data => { socket.onAny((event, data) => {
const type = `SOCKET_${socket.event.toUpperCase()}`; const type = `SOCKET_${event.toUpperCase()}`;
if (Array.isArray(data)) { if (Array.isArray(data)) {
dispatch({ type, data }); dispatch({ type, data });
} else { } else {

View File

@ -1,5 +1,20 @@
if (__DEV__) { import { createStore, applyMiddleware, compose } from 'redux';
module.exports = require('./store.dev'); import thunk from 'redux-thunk';
} else { import { routerMiddleware } from 'react-router-redux';
module.exports = require('./store.prod'); import reducer from '../reducers';
import createSocketMiddleware from '../middleware/socket';
import commands from '../commands';
export default function configureStore(socket, history, initialState) {
const finalCreateStore = compose(
applyMiddleware(
routerMiddleware(history),
thunk,
createSocketMiddleware(socket),
commands
),
window.devToolsExtension ? window.devToolsExtension() : f => f
)(createStore);
return finalCreateStore(reducer, initialState);
} }

View File

@ -1,33 +0,0 @@
import { createStore, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import { syncHistory } from 'react-router-redux';
import reducer from '../reducers';
import createSocketMiddleware from '../middleware/socket';
import commands from '../commands';
import DevTools from '../containers/DevTools';
export default function configureStore(socket, history, initialState) {
const reduxRouterMiddleware = syncHistory(history);
const finalCreateStore = compose(
applyMiddleware(
reduxRouterMiddleware,
thunk,
createSocketMiddleware(socket),
commands
),
DevTools.instrument()
)(createStore);
const store = finalCreateStore(reducer, initialState);
reduxRouterMiddleware.listenForReplays(store);
if (module.hot) {
module.hot.accept('../reducers', () => {
store.replaceReducer(require('../reducers').default);
});
}
return store;
}

View File

@ -1,17 +0,0 @@
import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import { syncHistory } from 'react-router-redux';
import reducer from '../reducers';
import createSocketMiddleware from '../middleware/socket';
import commands from '../commands';
export default function configureStore(socket, history, initialState) {
const finalCreateStore = applyMiddleware(
syncHistory(history),
thunk,
createSocketMiddleware(socket),
commands
)(createStore);
return finalCreateStore(reducer, initialState);
}

View File

@ -8,6 +8,8 @@ const autolinker = new Autolinker({
if (match.getType() === 'url') { if (match.getType() === 'url') {
return <a target="_blank" href={match.getAnchorHref()}>{match.getAnchorText()}</a>; return <a target="_blank" href={match.getAnchorHref()}>{match.getAnchorText()}</a>;
} }
return null;
}, },
React React
}); });