Skip to content

Commit 88a6221

Browse files
committed
React 16.2 to 16.7
ReactRouter 4.2 to 4.3 Redux 3.7 to 4.0 Material UI 0.20 to 3.9
1 parent 879f3c0 commit 88a6221

File tree

22 files changed

+2409
-2742
lines changed

22 files changed

+2409
-2742
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015-2018 jkazama
3+
Copyright (c) 2015-2019 jkazama
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public … deploy resources (auto generate)
9191
- style.css … from source/css
9292
fonts … icon font
9393
js
94-
- bundle.js … from source/js (by Webpack)
94+
- main.bundle.js … from source/js (by Webpack)
9595
- vendor.bundle.js … from vendor dist resource
9696
index.html … from source/html
9797
source
@@ -120,16 +120,11 @@ source
120120

121121
| ライブラリ | バージョン | 用途/追加理由 |
122122
| ----------------------- | -------- | ------------- |
123-
| `react`          | 16.2.+ | アプリケーションの UI 機能を提供 |
124-
| `react-dom`        | 16.2.+ | アプリケーションの UI 機能 ( DOM ) を提供 |
125-
| `react-router-dom` | 4.2.+ | React.js の SPA ルーティングサポート |
126-
| `react-tap-event-plugin` | 3.0.+ | タップ操作のサポート |
127-
| `redux` | 3.7.+ | Flux 風な状態/イベント概念をサポート |
128-
| `react-router-redux` | 5.0.+ | Redux の状態モデルに対応した react-router |
129-
| `material-ui` | 0.18.+ | マテリアルデザインな UI ライブラリ |
130-
| `lodash`          | 4.17.+ | 汎用ユーティリティライブラリ |
131-
| `dateformat`       | 3.0.+ | 日時ライブラリ |
132-
| `superagent` | 3.8.+ | HTTP 連携ライブラリ |
123+
| `react`          | 16.7.+ | アプリケーションの UI 機能を提供 |
124+
| `redux` | 4.0.+ | Flux 風な状態/イベント概念をサポート |
125+
| `material-ui` | 3.9.+ | マテリアルデザインな UI ライブラリ |
126+
127+
※ 詳細は package.json を参照してください
133128

134129
### License
135130

gulpfile.babel.js

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,21 @@ const resource = {
3131
static: `${paths.src.static}/**/*`
3232
},
3333
vendor: {
34-
js: ['lodash', 'dateformat', 'react', 'react-dom', 'react-redux', 'redux', 'react-router', 'react-router-redux', 'react-tap-event-plugin', 'material-ui']
34+
js: ['lodash', 'dateformat', 'react', 'react-dom', 'react-redux', 'redux', 'react-router', '@material-ui/core']
3535
}
3636
}
3737

3838
import gulp from 'gulp'
3939
import gulpLoaderPlugins from 'gulp-load-plugins'
4040
import del from 'del'
41-
import path from 'path'
4241
import webpack from 'webpack'
4342
import webpackStream from 'webpack-stream'
4443
import runSequence from 'run-sequence'
4544
import browserSyncTool from 'browser-sync'
4645
import RevAll from 'gulp-rev-all'
4746

4847
const $ = gulpLoaderPlugins()
49-
const browserSync = browserSyncTool.create()
48+
const browserSync = browserSyncTool.create()
5049

5150
let production = false
5251

@@ -55,7 +54,7 @@ gulp.task('default', ['build', 'server'])
5554

5655
//## build for developer
5756
gulp.task('build', (callback) =>
58-
runSequence('clean', ['build:pug', 'build:sass', 'build:webpack', 'build:static'], callback)
57+
runSequence('clean', ['build:pug', 'build:sass', 'build:static', 'build:webpack'], callback)
5958
)
6059

6160
//## build production
@@ -78,28 +77,30 @@ gulp.task('revision', (callback) =>
7877

7978
// compile Webpack [ ES201x(Babel) / Vue -> SPA(main.js) ]
8079
gulp.task('build:webpack', () => {
81-
process.env.NODE_ENV = (production == true) ? 'production' : 'development'
82-
let plugins = [
83-
new webpack.optimize.CommonsChunkPlugin({name: "vendor", filename: "vendor.bundle.js"}),
84-
new webpack.DefinePlugin({'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)})
80+
process.env.NODE_ENV = production ? 'production' : 'development'
81+
const plugins = [
82+
new webpack.ProvidePlugin({ jQuery: "jquery", $: "jquery" }),
83+
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
84+
new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV) }),
8585
]
86-
if (production) {
87-
plugins.push(new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false  } }))
88-
plugins.push(new webpack.optimize.ModuleConcatenationPlugin())
89-
}
9086
return gulp.src(resource.src.webpack.babel)
9187
.pipe($.plumber())
9288
.pipe(webpackStream({
93-
devtool: '#source-map',
89+
mode: process.env.NODE_ENV,
90+
devtool: production ? false : '#source-map',
9491
entry: {
95-
app: `${paths.src.js}/main.js`,
92+
main: `${paths.src.js}/main.js`,
9693
vendor: resource.vendor.js
9794
},
98-
output: {filename: 'bundle.js'},
95+
output: { filename: '[name].bundle.js' },
96+
optimization: {
97+
splitChunks: { name: 'vendor', chunks: 'initial' },
98+
noEmitOnErrors: true,
99+
},
99100
watch: !production,
100101
module: {
101102
rules: [
102-
{ test: /\.(js|jsx)$/, loader: 'babel-loader', exclude: /node_modules/ }
103+
{ test: /\.(js|jsx)$/, use: 'babel-loader', exclude: /node_modules/ },
103104
]
104105
},
105106
resolve: {
@@ -120,8 +121,6 @@ gulp.task('build:pug', () => {
120121
return gulp.src(resource.src.pug)
121122
.pipe($.plumber())
122123
.pipe($.pug())
123-
.pipe($.htmlhint())
124-
.pipe($.htmlhint.reporter())
125124
.pipe(gulp.dest(paths.dist.root))
126125
.pipe(browserSync.stream())
127126
})
@@ -130,9 +129,8 @@ gulp.task('build:pug', () => {
130129
gulp.task('build:sass', () => {
131130
return gulp.src(resource.src.sass)
132131
.pipe($.plumber())
133-
.pipe($.sass())
134132
.pipe($.concat('style.css'))
135-
.pipe($.pleeease())
133+
.pipe($.sass({ outputStyle: 'compressed' }))
136134
.pipe(gulp.dest(paths.dist.css))
137135
.pipe(browserSync.stream())
138136
})

package.json

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sample-ui-react",
3-
"version": "0.5.0",
3+
"version": "16.7.0",
44
"description": "React.js / Redux Boilerplate",
55
"main": "source/js/main.js",
66
"scripts": {
@@ -14,48 +14,46 @@
1414
"url": "https://github.com/jkazama/sample-ui-react.git"
1515
},
1616
"dependencies": {
17+
"@material-ui/core": "~3.9.0",
18+
"@material-ui/icons": "~3.0.0",
19+
"connected-react-router": "~6.2.0",
1720
"dateformat": "~3.0.0",
1821
"lodash": "~4.17.0",
19-
"material-ui": "~0.20.0",
2022
"prop-types": "~15.6.0",
21-
"react": "~16.2.0",
22-
"react-dom": "~16.2.0",
23-
"react-redux": "~5.0.0",
24-
"react-router-dom": "~4.2.0",
25-
"react-router-redux": "~5.0.0-alpha.9",
26-
"react-tap-event-plugin": "~3.0.0",
27-
"redux": "~3.7.0",
23+
"react": "~16.7.0",
24+
"react-dom": "~16.7.0",
25+
"react-redux": "~6.0.0",
26+
"react-router-dom": "~4.3.0",
27+
"redux": "~4.0.0",
2828
"superagent": "~3.8.0"
2929
},
3030
"devDependencies": {
31-
"babel-core": "~6.24.0",
31+
"babel-core": "~6.26.0",
3232
"babel-loader": "~7.1.0",
3333
"babel-plugin-transform-runtime": "~6.23.0",
34-
"babel-preset-env": "~1.6.0",
34+
"babel-preset-env": "~1.7.0",
3535
"babel-preset-react": "~6.24.0",
3636
"babel-preset-stage-0": "~6.24.0",
3737
"babel-runtime": "~6.26.0",
38-
"browser-sync": "~2.23.0",
39-
"css-loader": "~0.28.0",
38+
"browser-sync": "~2.24.0",
39+
"css-loader": "~1.0.0",
4040
"del": "~3.0.0",
4141
"gulp": "~3.9.0",
4242
"gulp-concat": "~2.6.0",
43-
"gulp-htmlhint": "~0.3.0",
4443
"gulp-load-plugins": "~1.5.0",
45-
"gulp-pleeease": "~2.0.0",
46-
"gulp-plumber": "~1.1.0",
47-
"gulp-pug": "~3.3.0",
48-
"gulp-rev-all": "~0.9.0",
49-
"gulp-sass": "~3.1.0",
44+
"gulp-plumber": "~1.2.0",
45+
"gulp-pug": "~4.0.0",
46+
"gulp-rev-all": "~1.0.0",
47+
"gulp-sass": "~4.0.0",
5048
"html-loader": "~0.5.0",
51-
"node-sass": "~4.7.0",
52-
"pug": "~2.0.0-rc.4",
53-
"pug-loader": "~2.3.0",
54-
"redux-devtools": "~3.4.0",
49+
"node-sass": "~4.9.0",
50+
"pug": "~2.0.0",
51+
"pug-plain-loader": "~1.0.0",
52+
"redux-devtools": "~3.5.0",
5553
"run-sequence": "~2.2.0",
56-
"sass-loader": "~6.0.0",
57-
"template-html-loader": "~1.0.0",
58-
"webpack": "~3.11.0",
59-
"webpack-stream": "~4.0.0"
54+
"sass-loader": "~7.1.0",
55+
"webpack": "~4.19.0",
56+
"webpack-bundle-analyzer": "~3.0.0",
57+
"webpack-stream": "~5.1.0"
6058
}
6159
}

source/css/plain.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
body {
99
padding: 0;
1010
margin: 0;
11-
font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Yu Gothic", YuGothic, "ヒラギノ角ゴ ProN W3", Hiragino Kaku Gothic ProN, Arial, "メイリオ", Meiryo, sans-serif;
11+
font-family: Roboto, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Yu Gothic", YuGothic, "ヒラギノ角ゴ ProN W3", Hiragino Kaku Gothic ProN, Arial, "メイリオ", Meiryo, sans-serif;
1212
}

source/html/index.pug

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ doctype html
22
html(lang="ja")
33
head
44
meta(charset="utf-8")
5-
meta(content="IE=edge,chrome=1" http-equiv="X-UA-Compatible")
5+
meta(content="IE=edge,chrome=1", http-equiv="X-UA-Compatible")
6+
meta(name="viewport", content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no")
67
title アプリケーション
7-
link(rel="stylesheet" href="/css/style.css")
8+
link(rel="stylesheet", href="https://fonts.googleapis.com/css?family=Roboto:300,400,500")
9+
link(rel="stylesheet", href="https://fonts.googleapis.com/icon?family=Material+Icons")
10+
link(rel="stylesheet", href="/css/style.css")
811
script(src="/js/vendor.bundle.js")
912
body
1013
#app
11-
script(src="/js/bundle.js")
14+
script(src="/js/main.bundle.js")

source/js/actions/asset.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Level } from "constants/plain"
22
import { ActionsSupport } from "platform/redux-action-support"
33
import api from "api/asset.js"
4-
import { handleFailure } from "actions/master.js"
54
import types from "constants/asset"
65

76
export default class AssetActions extends ActionsSupport {

source/js/container/app.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
import React from "react"
2-
import { connect } from "react-redux"
32
import { Component } from "platform/react-support"
43
import Header from "container/header"
54

6-
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'
5+
import MuiThemeProvider from '@material-ui/core/styles/MuiThemeProvider'
76
import theme from 'theme'
87

98
import Routes from "routes"
109

1110
class App extends Component {
1211
render() {
1312
return (
14-
<MuiThemeProvider muiTheme={theme}>
13+
<MuiThemeProvider theme={theme}>
1514
<div>
1615
<Header />
1716
{Routes}

source/js/container/asset.js

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import React from "react"
2+
import { withRouter } from "react-router"
23
import { connect } from "react-redux"
34
import { Component } from "platform/redux-support"
45
import AssetActions from "actions/asset"
56
import {
6-
Paper, TextField, RaisedButton,
7-
Table, TableHeader, TableBody, TableRow, TableHeaderColumn, TableRowColumn,
8-
} from "material-ui"
7+
Paper, TextField, Button,
8+
Table, TableHead, TableBody, TableRow, TableCell,
9+
} from "@material-ui/core"
910
import { styleUi, styleUiAsset } from "theme"
1011

1112
class Asset extends Component {
@@ -36,34 +37,38 @@ class Asset extends Component {
3637
}
3738
}
3839
render() {
40+
const errAbsAmount = this.errorText("absAmount")
3941
return (
4042
<div>
41-
<TextField floatingLabelText="出金金額"
42-
value={this.state.absAmount || ""} errorText={this.errorText("absAmount")}
43+
<TextField label="出金金額"
44+
margin='dense'
45+
value={this.state.absAmount || ""} error={errAbsAmount !== ""}
46+
helperText={errAbsAmount}
4347
style={styleUiAsset.absAmountText}
4448
onChange={e => this.handleValue(e, 'absAmount') }
45-
onKeyDown={this.handleEnterKey.bind(this)} />
46-
<RaisedButton label="出金依頼をする"
47-
primary={true} style={styleUiAsset.requestWithdrawButton}
48-
onClick={this.requestWithdraw.bind(this)} />
49-
<Paper style={styleUiAsset.main} zDepth={1}>
50-
<Table selectable={false} height={styleUiAsset.table.height}>
51-
<TableHeader displaySelectAll={false}>
49+
onKeyDown={e => this.handleEnterKey(e)} />
50+
<Button variant="contained" color="primary" style={styleUiAsset.requestWithdrawButton}
51+
onClick={() => this.requestWithdraw()}>
52+
出金依頼をする
53+
</Button>
54+
<Paper style={styleUiAsset.main}>
55+
<Table>
56+
<TableHead>
5257
<TableRow>
53-
<TableHeaderColumn>依頼日</TableHeaderColumn>
54-
<TableHeaderColumn>ステータス</TableHeaderColumn>
55-
<TableHeaderColumn>通貨</TableHeaderColumn>
56-
<TableHeaderColumn>金額</TableHeaderColumn>
58+
<TableCell>依頼日</TableCell>
59+
<TableCell>ステータス</TableCell>
60+
<TableCell>通貨</TableCell>
61+
<TableCell>金額</TableCell>
5762
</TableRow>
58-
</TableHeader>
59-
<TableBody displayRowCheckbox={false}>
63+
</TableHead>
64+
<TableBody>
6065
{this.state.withdrawalList.map((item, i) =>
61-
<TableRow key={i}>
62-
<TableRowColumn style={styleUi.alignCenter}>{item.requestDay}</TableRowColumn>
63-
<TableRowColumn style={styleUi.alignCenter}>{item.statusType}</TableRowColumn>
64-
<TableRowColumn style={styleUi.alignCenter}>{item.currency}</TableRowColumn>
65-
<TableRowColumn style={styleUi.alignRight}>{item.absAmount}</TableRowColumn>
66-
</TableRow>
66+
<TableRow key={i}>
67+
<TableCell style={styleUi.alignCenter}>{item.requestDay}</TableCell>
68+
<TableCell style={styleUi.alignCenter}>{item.statusType}</TableCell>
69+
<TableCell style={styleUi.alignCenter}>{item.currency}</TableCell>
70+
<TableCell style={styleUi.alignRight}>{item.absAmount}</TableCell>
71+
</TableRow>
6772
)}
6873
</TableBody>
6974
</Table>
@@ -72,11 +77,11 @@ class Asset extends Component {
7277
)
7378
}
7479
}
75-
export default connect(
80+
export default withRouter(connect(
7681
Asset.mapStateToProps(state => ({
77-
asset: state.reducer.asset
82+
asset: state.asset
7883
})),
7984
Asset.mapDispatchToProps(dispatch => ({
8085
actionsAsset: new AssetActions(dispatch)
8186
})),
82-
)(Asset)
87+
)(Asset))

0 commit comments

Comments
 (0)