Skip to content
This repository was archived by the owner on Sep 28, 2023. It is now read-only.

Commit e1417ee

Browse files
committed
Upgraded all the dependencies. Removed some uneccesary imports and libs. Rewrote the webpack config to webpack 2. Adjusted some pages and components to make them work with React v16
1 parent c91680d commit e1417ee

15 files changed

+5426
-130
lines changed

Diff for: .babelrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"presets": ["env", "react"],
3+
"plugins": ["transform-react-require", "transform-object-assign"]
4+
}

Diff for: app/components/block.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import className from 'classname';
1+
import classNames from 'classnames';
22

33
export const Block = (props) => {
4-
const c = className('block', props.className);
4+
const c = classNames('block', props.className);
55

66
return (
77
<div className={c}>

Diff for: app/components/centeredblock.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import className from 'classname';
1+
import classNames from 'classnames';
22

33
export const CBlock = (props) => {
44
const fullWidth = typeof props.fullWidth !== 'undefined' ? props.fullWidth : false;
5-
const c = className('block block--center', props.className, {
5+
const c = classNames('block block--center', props.className, {
66
'block--center' : !fullWidth,
77
'block--center-full-width': fullWidth
88
});

Diff for: app/components/page.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import className from 'classname';
1+
import classNames from 'classnames';
22
import logo from '../assets/neon-logo2.svg';
33
import { Link } from './link';
44
import Footer from './footer';
@@ -119,7 +119,7 @@ export const PageBody = (props) => (
119119
);
120120

121121
export const Container = (props) => {
122-
const c = className('page__container', props.className);
122+
const c = classNames('page__container', props.className);
123123
return (
124124
<div className={c}>
125125
{props.children}

Diff for: app/pages/printprogram.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ const HasProgram = (sessions) => (
101101
</div>
102102
);
103103

104-
const PrintProgram = React.createClass({
104+
class PrintProgram extends React.Component {
105105

106106
componentWillMount() {
107107
if (this.props.sessions.length === 0) {
108108
this.props.getSessions();
109109
}
110-
},
110+
}
111111

112112
render() {
113113
const content = this.props.isFetching
@@ -122,6 +122,6 @@ const PrintProgram = React.createClass({
122122
</Page>
123123
);
124124
}
125-
});
125+
};
126126

127127
export default connect(mapStateToProps, { getSessions })(PrintProgram);

Diff for: app/pages/program.js

+22-15
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,10 @@ const Loading = () => (
206206
);
207207

208208
const Failure = () => (
209-
<div className='program__loading'>
210-
<h2 className='program__loading-header'>Woooops!</h2>
211-
It seems something is seriously wrong here. We are most likely informed and working on it, so just try again in a while.
212-
</div>
209+
<div className='program__loading'>
210+
<h2 className='program__loading-header'>Woooops!</h2>
211+
It seems something is seriously wrong here. We are most likely informed and working on it, so just try again in a while.
212+
</div>
213213
);
214214

215215
function showEmptyMyProgram(state) {
@@ -253,33 +253,40 @@ const HasProgram = (sessions, state, toggleFavorite, setAll, setNorwegian, setEn
253253
</div>
254254
);
255255

256-
const Program = React.createClass({
256+
class Program extends React.Component {
257257

258-
getInitialState() {
259-
return getDefaultSettings();
260-
},
258+
constructor(props) {
259+
super(props);
260+
this.state = getDefaultSettings();
261+
this.setAll = this.setAll.bind(this);
262+
this.setNorwegian = this.setNorwegian.bind(this);
263+
this.setEnglish = this.setEnglish.bind(this);
264+
this.setMyProgram = this.setMyProgram.bind(this);
265+
this.toggleFavorite = this.toggleFavorite.bind(this);
266+
}
261267

262268
componentWillMount() {
263269
if (this.props.sessions.length === 0) {
264270
this.props.getSessions();
265271
}
266-
},
272+
}
267273

268274
setAll() {
269275
this.setState({show: 'all'});
270-
},
276+
}
271277

272278
setNorwegian() {
279+
console.log(this.state);
273280
this.setState({show: 'no'});
274-
},
281+
}
275282

276283
setEnglish() {
277284
this.setState({show: 'en'});
278-
},
285+
}
279286

280287
setMyProgram() {
281288
this.setState({show: 'my'});
282-
},
289+
}
283290

284291
toggleFavorite(id) {
285292
if (includes(id, this.state.myprogram)) {
@@ -288,7 +295,7 @@ const Program = React.createClass({
288295
const prev = this.state.myprogram || [];
289296
this.setState({myprogram: prev.concat(id)});
290297
}
291-
},
298+
}
292299

293300
render() {
294301
const content = this.props.failure
@@ -307,6 +314,6 @@ const Program = React.createClass({
307314
</Page>
308315
);
309316
}
310-
});
317+
};
311318

312319
export default connect(mapStateToProps, { getSessions })(Program);

Diff for: app/pages/speakers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ const Speakers = () => (
245245
</CBlock>
246246

247247
<CBlock>
248-
<CHeader>We hope to see you at JavaZone 2017 – please feel free to spread the word to your local community!</CHeader>
248+
<CHeader>We hope to see you at JavaZone 2017 – please feel free to spread the word to your local community!</CHeader>
249249
<CContent>
250250
<P className='speakers__regards'>
251251
<br />

Diff for: app/pages/workshops.js

+8-9
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ const groupByFormat = reduce((acc, session) => {
4444
return acc;
4545
}, []);
4646

47-
const isJzWorkshop = workshopTitles => workshop =>
48-
includes(workshop.title, workshopTitles);
47+
const isJzWorkshop = workshopTitles => workshop => includes(workshop.title, workshopTitles);
4948

5049
function workshopUrl(workshop) {
5150
if (!workshop) {
@@ -110,10 +109,10 @@ function mapStateToProps(state) {
110109
}
111110

112111
const Failure = () => (
113-
<div className='program__loading'>
114-
<h2 className='program__loading-header'>Woooops!</h2>
115-
It seems something is seriously wrong here. We are most likely informed and working on it, so just try again in a while.
116-
</div>
112+
<div className='program__loading'>
113+
<h2 className='program__loading-header'>Woooops!</h2>
114+
It seems something is seriously wrong here. We are most likely informed and working on it, so just try again in a while.
115+
</div>
117116
);
118117

119118
function merge(workshops, sessions) {
@@ -137,11 +136,11 @@ const WorkshopList = ({ workshops }) =>
137136
</ul>
138137
</div>;
139138

140-
const Workshops = React.createClass({
139+
class Workshops extends React.Component {
141140
componentWillMount() {
142141
this.props.getWorkshops();
143142
this.props.getSessions();
144-
},
143+
}
145144

146145
render() {
147146
const workshops = filter(s => s.format === 'workshop')(this.props.sessions);
@@ -168,6 +167,6 @@ const Workshops = React.createClass({
168167
</Page>
169168
);
170169
}
171-
});
170+
};
172171

173172
export default connect(mapStateToProps, { getWorkshops, getSessions })(Workshops);

Diff for: package.json

+33-34
Original file line numberDiff line numberDiff line change
@@ -6,50 +6,49 @@
66
"scripts": {
77
"lint": "eslint app",
88
"clean": "rm -rf ./dist && mkdir dist",
9-
"build": "npm run lint && npm run clean && NODE_ENV=production webpack -p --progress --colors",
10-
"watch": "NODE_ENV=development webpack-dev-server --inline --host 0.0.0.0",
9+
"build": "npm run lint && npm run clean && NODE_ENV=production webpack --env=prod -p --progress --colors",
10+
"watch": "NODE_ENV=development webpack-dev-server --env=dev --inline --host 0.0.0.0",
1111
"start": "npm run watch"
1212
},
1313
"devDependencies": {
14-
"autoprefixer": "^6.5.0",
15-
"babel-core": "^6.16.0",
16-
"babel-loader": "^6.2.5",
17-
"babel-plugin-transform-object-assign": "^6.8.0",
14+
"autoprefixer": "^7.1.6",
15+
"babel-core": "^6.26.0",
16+
"babel-loader": "^7.1.2",
17+
"babel-plugin-transform-object-assign": "^6.22.0",
1818
"babel-plugin-transform-react-require": "^1.0.1",
19-
"babel-preset-es2015": "^6.16.0",
20-
"babel-preset-react": "^6.16.0",
21-
"classname": "0.0.0",
22-
"css-loader": "^0.25.0",
23-
"es6-promise": "^4.0.5",
24-
"eslint": "^3.3.0",
25-
"eslint-plugin-lodash-fp": "^2.0.0",
26-
"extract-text-webpack-plugin": "^1.0.1",
19+
"babel-preset-env": "^1.6.1",
20+
"babel-preset-react": "^6.24.1",
21+
"css-loader": "^0.28.7",
22+
"es6-promise": "^4.1.1",
23+
"eslint": "^4.10.0",
24+
"eslint-plugin-lodash-fp": "^2.1.3",
25+
"extract-text-webpack-plugin": "^3.0.2",
2726
"fetch": "^1.1.0",
28-
"file-loader": "^0.9.0",
29-
"html-webpack-plugin": "^2.22.0",
30-
"indexhtml-webpack-plugin": "^0.1.9",
31-
"less": "^2.7.1",
32-
"less-loader": "^2.2.3",
33-
"normalize.css": "^5.0.0",
34-
"postcss-loader": "^0.13.0",
35-
"q": "^1.4.1",
36-
"react": "15.3.2",
37-
"react-dom": "15.3.2",
38-
"react-redux": "^4.4.5",
39-
"redux": "^3.6.0",
40-
"redux-thunk": "^2.1.0",
41-
"reset-css": "^2.2.0",
42-
"shelljs": "^0.7.4",
43-
"style-loader": "^0.13.1",
44-
"webpack": "^1.13.2",
45-
"webpack-dev-server": "^1.16.2"
27+
"file-loader": "^1.1.5",
28+
"html-webpack-plugin": "^2.30.1",
29+
"less": "^2.7.3",
30+
"less-loader": "^4.0.5",
31+
"normalize.css": "^7.0.0",
32+
"postcss-loader": "^2.0.8",
33+
"q": "^1.5.1",
34+
"react": "16.0.0",
35+
"react-dom": "16.0.0",
36+
"react-redux": "^5.0.6",
37+
"redux": "^3.7.2",
38+
"redux-thunk": "^2.2.0",
39+
"reset-css": "^2.2.1",
40+
"shelljs": "^0.7.8",
41+
"style-loader": "^0.19.0",
42+
"webpack": "^3.8.1",
43+
"webpack-dev-server": "^2.9.3",
44+
"webpack-merge": "^4.1.0"
4645
},
4746
"author": "",
4847
"license": "ISC",
4948
"private": true,
5049
"dependencies": {
5150
"classnames": "^2.2.5",
52-
"lodash": "^4.16.4",
53-
"moment": "^2.15.1"
51+
"lodash": "^4.17.4",
52+
"moment": "^2.19.1"
5453
}
5554
}

Diff for: postcss.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = () => ({
2+
plugins: [
3+
require('autoprefixer')
4+
]
5+
})

Diff for: webpack.common.js

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
const webpack = require('webpack');
2+
const HtmlWebpackPlugin = require('html-webpack-plugin');
3+
const ExtractTextPlugin = require('extract-text-webpack-plugin');
4+
const path = require('path');
5+
const exclude = '/node_modules';
6+
7+
module.exports = {
8+
entry: './app/app.js',
9+
output: {
10+
filename: '[hash].js',
11+
path: path.join(__dirname, 'dist'),
12+
publicPath: '/'
13+
},
14+
module: {
15+
rules: [
16+
{
17+
test: /\.js$/,
18+
exclude: exclude,
19+
use: 'babel-loader'
20+
},
21+
{
22+
test: /\.less$/,
23+
exclude: exclude,
24+
use: ExtractTextPlugin.extract({
25+
fallback: 'style-loader',
26+
use: [
27+
'css-loader?sourceMap',
28+
'postcss-loader?sourceMap',
29+
'less-loader?sourceMap'
30+
]
31+
})
32+
},
33+
{
34+
test: /\.(svg|jpg|jpeg|png|pdf|xml|ico|json|txt)$/,
35+
exclude: exclude,
36+
use: 'file-loader'
37+
},
38+
{
39+
test: /\.(eot|ttf|woff|woff2)$/,
40+
exclude: exclude,
41+
use: 'file-loader'
42+
}
43+
]
44+
},
45+
plugins: [
46+
new webpack.DefinePlugin({
47+
'process.env.NODE_ENV': `"${process.env.NODE_ENV}"`
48+
}),
49+
new ExtractTextPlugin({
50+
filename: 'app.css',
51+
disable: false,
52+
allChunks: true
53+
}),
54+
new HtmlWebpackPlugin({
55+
template: './app/index.html'
56+
})
57+
]
58+
};

0 commit comments

Comments
 (0)