Skip to content

Commit a33a3b8

Browse files
authored
Merge pull request #4 from PolygonFox/upgrade-dependencies
React upgrade
2 parents 0ea0216 + 876876d commit a33a3b8

File tree

11 files changed

+54
-52
lines changed

11 files changed

+54
-52
lines changed

config/webpack/dev.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ var config = {
4040
},
4141
{
4242
test: /\.tsx?$/,
43-
loader: 'react-hot-loader!awesome-typescript-loader'
43+
loader: 'react-hot-loader/webpack!awesome-typescript-loader'
4444
},
4545
{
4646
test: /\.jsx$/,

config/webpack/prod.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ var config = {
4646
},
4747
{
4848
test: /\.tsx?$/,
49-
loader: 'react-hot-loader!awesome-typescript-loader'
49+
loader: 'react-hot-loader/webpack!awesome-typescript-loader'
5050
},
5151
{
5252
test: /\.jsx$/,

package.json

+21-21
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,12 @@
5959
"@types/isomorphic-fetch": "0.0.34",
6060
"@types/jest": "^19.2.2",
6161
"@types/node": "^7.0.0",
62-
"@types/react": "^15.0.0",
63-
"@types/react-addons-test-utils": "^0.14.16",
64-
"@types/react-dom": "^0.14.20",
65-
"@types/react-helmet": "^5.0.0",
66-
"@types/react-redux": "^4.4.35",
67-
"@types/react-router": "^3.0.2",
68-
"@types/react-router-redux": "^4.0.38",
62+
"@types/react": "^16.0.34",
63+
"@types/react-dom": "^16.0.3",
64+
"@types/react-helmet": "^5.0.3",
65+
"@types/react-redux": "^5.0.14",
66+
"@types/react-router": "^4.0.20",
67+
"@types/react-router-redux": "^5.0.11",
6968
"@types/redux": "^3.6.31",
7069
"@types/redux-devtools": "^3.0.36",
7170
"@types/redux-devtools-dock-monitor": "^1.1.29",
@@ -86,7 +85,7 @@
8685
"classnames": "^2.2.5",
8786
"cross-env": "^5.0.1",
8887
"css-loader": "^0.28.0",
89-
"enzyme": "^2.8.2",
88+
"enzyme": "^3.3.0",
9089
"extract-text-webpack-plugin": "^2.1.2",
9190
"fetch-mock": "^5.8.1",
9291
"file-loader": "^0.11.1",
@@ -98,17 +97,16 @@
9897
"postcss-assets": "^4.1.0",
9998
"postcss-cssnext": "^2.9.0",
10099
"postcss-loader": "^1.2.2",
101-
"react-addons-test-utils": "^15.5.1",
102-
"react-hot-loader": "^1.3.1",
100+
"react-hot-loader": "^3.1.3",
103101
"redux-mock-store": "^1.2.3",
104102
"rimraf": "^2.5.4",
105103
"source-map-loader": "^0.2.1",
106104
"style-loader": "^0.17.0",
107105
"stylelint": "^7.7.1",
108106
"ts-jest": "^20.0.6",
109-
"tslint": "^4.3.1",
107+
"tslint": "^5.9.1",
110108
"tslint-loader": "^3.3.0",
111-
"tslint-react": "^2.3.0",
109+
"tslint-react": "^3.4.0",
112110
"typescript": "^2.1.5",
113111
"url-loader": "^0.5.7",
114112
"webpack": "^2.4.1",
@@ -122,17 +120,19 @@
122120
"compression": "^1.6.2",
123121
"es6-promise": "^4.1.1",
124122
"express": "^4.14.0",
125-
"history": "^4.6.3",
123+
"history": "^4.7.2",
126124
"isomorphic-fetch": "^2.2.1",
127-
"react": "^15.5.4",
128-
"react-css-modules": "^4.1.0",
129-
"react-dom": "^15.5.4",
130-
"react-helmet": "^5.0.3",
131-
"react-redux": "^5.0.4",
132-
"react-router": "^3.0.2",
133-
"react-router-redux": "^4.0.7",
125+
"react": "^16.2.0",
126+
"react-css-modules": "^4.7.1",
127+
"react-dom": "^16.2.0",
128+
"react-helmet": "^5.2.0",
129+
"react-redux": "^5.0.6",
130+
"react-router": "^4.2.0",
131+
"react-router-config": "^1.0.0-beta.4",
132+
"react-router-dom": "^4.2.2",
133+
"react-router-redux": "^5.0.0-alpha.9",
134134
"redux": "^3.6.0",
135-
"redux-connect": "^5.0.0",
135+
"redux-connect": "^7.0.0",
136136
"redux-logger": "^3.0.1",
137137
"redux-thunk": "^2.2.0",
138138
"serve-favicon": "^2.3.2",

src/app/components/Header/index.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import * as React from 'react';
2-
import { Link } from 'react-router';
2+
import { Link } from 'react-router-dom';
33

44
const style = require('./style.css');
55

66
export const Header = () => (
77
<nav className={style.Nav}>
88
<ul>
9-
<li><Link to="/">Cube</Link></li>
10-
<li><Link to="sphere">Sphere</Link></li>
9+
<li><Link to="/cube">Cube</Link></li>
10+
<li><Link to="/sphere">Sphere</Link></li>
1111
</ul>
1212
</nav>
1313
);

src/app/containers/App/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ class App extends React.Component<any, any> {
1919
}
2020
}
2121

22-
export { App }
22+
export { App };

src/app/containers/Cube/index.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import {Box} from 'whs';
33
import * as THREE from 'three';
44

55
import { add, remove } from 'modules/world/';
6-
import { IWorld } from 'models/world';
7-
import { IWorldAction } from 'models/world';
6+
import { IWorld, IWorldAction } from 'models/world';
87
const { connect } = require('react-redux');
98

109
interface IProps {
@@ -25,6 +24,7 @@ class Cube extends React.Component<IProps, any> {
2524

2625
public constructor(props) {
2726
super(props);
27+
2828
this.state = {
2929
world: null,
3030
object: null,
@@ -90,4 +90,4 @@ class Cube extends React.Component<IProps, any> {
9090
}
9191
}
9292

93-
export { Cube }
93+
export { Cube };

src/app/containers/Sphere/index.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import {Sphere as wSphere} from 'whs';
55
import * as THREE from 'three';
66

77
import { add, remove } from 'modules/world/';
8-
import { IWorld } from 'models/world';
9-
import { IWorldAction } from 'models/world';
8+
import { IWorld, IWorldAction } from 'models/world';
109
const { connect } = require('react-redux');
1110

1211
interface IProps {
@@ -24,8 +23,10 @@ interface IProps {
2423
)
2524

2625
class Sphere extends React.Component<IProps, any> {
26+
2727
public constructor(props) {
2828
super(props);
29+
2930
this.state = {
3031
world: null,
3132
object: null,
@@ -72,7 +73,6 @@ class Sphere extends React.Component<IProps, any> {
7273
z: 0
7374
}
7475
});
75-
7676
this.setState({object});
7777
}
7878
}
@@ -92,4 +92,4 @@ class Sphere extends React.Component<IProps, any> {
9292
}
9393
}
9494

95-
export { Sphere }
95+
export { Sphere };

src/app/redux/IStore.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ import { IWorld } from 'models/world';
22

33
export interface IStore {
44
world: IWorld;
5-
};
5+
}

src/app/routes/index.tsx

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import * as React from 'react';
2-
import { IndexRoute, Route } from 'react-router';
2+
import { Route, Switch } from 'react-router';
33
import { App, Sphere, Cube } from 'containers';
44

55
export default (
6-
<Route path="/" component={App}>
7-
<IndexRoute component={Cube} />
8-
<Route path="cube" component={Cube} />
9-
<Route path="sphere" component={Sphere} />
10-
</Route>
6+
<App>
7+
<Switch>
8+
<Route exact={true} path="/" component={Cube} />
9+
<Route path="/cube" component={Cube} />
10+
<Route path="/sphere" component={Sphere} />
11+
</Switch>
12+
</App>
1113
);

src/client.tsx

+8-9
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,26 @@ import * as e6p from 'es6-promise';
44
import * as React from 'react';
55
import * as ReactDOM from 'react-dom';
66
import { Provider } from 'react-redux';
7-
import { Router, browserHistory } from 'react-router';
8-
import { syncHistoryWithStore } from 'react-router-redux';
9-
import { ReduxAsyncConnect } from 'redux-connect';
7+
import { ConnectedRouter } from 'react-router-redux';
8+
import createHistory from 'history/createBrowserHistory';
109
import { configureStore } from './app/redux/store';
1110
import routes from './app/routes';
1211
// require('file-loader?name=[name].[ext]!./public/index.html');
12+
13+
const history = createHistory();
14+
1315
const store = configureStore(
14-
browserHistory,
16+
history,
1517
window.__INITIAL_STATE__
1618
);
17-
const history = syncHistoryWithStore(browserHistory, store);
18-
const connectedCmp = (props) => <ReduxAsyncConnect {...props} />;
1919

2020
ReactDOM.render(
2121
<Provider store={store} key="provider">
22-
<Router
22+
<ConnectedRouter
2323
history={history}
24-
render={connectedCmp}
2524
>
2625
{routes}
27-
</Router>
26+
</ConnectedRouter>
2827
</Provider>,
2928
document.getElementById('app')
3029
);

tslint.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"tslint-react"
55
],
66
"rules": {
7-
"no-new": 0,
87
"trailing-comma": [
98
false,
109
{
@@ -33,6 +32,8 @@
3332
],
3433
"jsx-alignment": [
3534
false
36-
]
35+
],
36+
"no-implicit-dependencies": false,
37+
"no-submodule-imports": false
3738
}
3839
}

0 commit comments

Comments
 (0)