commit 49399cd560fbc9bad0c3838b68551524b27d8b58
parent 048e67f957f4b0eed7e67094544eee1b47083fe4
Author: Vladimir Kutepov <frenzzy.man@gmail.com>
Date: Tue, 25 Oct 2016 00:52:51 +0400
Update dependencies; migrate configs to node.js v6.5+ (#930)
babel-polyfill 6.13.0 => 6.16.0: https://github.com/babel/babel/blob/master/CHANGELOG.md
express-jwt 5.0.0 => 5.1.0: https://github.com/auth0/express-jwt/blob/master/CHANGELOG.md
fbjs 0.8.4 => 0.8.5: https://github.com/facebook/fbjs/blob/master/packages/fbjs/CHANGELOG.md
graphql 0.7.0 => 0.7.2: https://github.com/graphql/graphql-js/releases
history 4.2.0 => 4.3.0: https://github.com/mjackson/history/blob/master/CHANGES.md
markdown-it 8.0.0 => 8.0.1: https://github.com/markdown-it/markdown-it/blob/master/CHANGELOG.md
normalize.css 4.2.0 => 5.0.0: https://github.com/necolas/normalize.css/blob/master/CHANGELOG.md
pretty-error 2.0.1 => 2.0.2: https://github.com/AriaMinaei/pretty-error/commits/master
sequelize 3.24.3 => 3.24.5: https://github.com/sequelize/sequelize/blob/v3/changelog.md
source-map-support 0.4.2 => 0.4.5: https://github.com/evanw/node-source-map-support/commits/master
sqlite3 3.1.4 => 3.1.6: https://github.com/mapbox/node-sqlite3/blob/master/CHANGELOG.md
universal-router 1.2.2 => 2.0.0: https://github.com/kriasoft/universal-router/blob/master/CHANGELOG.md
assets-webpack-plugin ^3.4.0 => ^3.5.0: https://github.com/kossnocorp/assets-webpack-plugin/blob/master/CHANGELOG.md
autoprefixer ^6.4.1 => ^6.5.1: https://github.com/postcss/autoprefixer/blob/master/CHANGELOG.md
babel-cli ^6.14.0 => 6.16.0: https://github.com/babel/babel/blob/master/CHANGELOG.md
babel-core ^6.14.0 => ^6.17.0: https://github.com/babel/babel/blob/master/CHANGELOG.md
babel-eslint ^6.1.2 => ^7.0.0: https://github.com/babel/babel-eslint/commits/master
...
Diffstat:
4 files changed, 118 insertions(+), 98 deletions(-)
diff --git a/.travis.yml b/.travis.yml
@@ -1,7 +1,6 @@
language: node_js
node_js:
- '6'
- - '5'
env:
- CXX=g++-4.8
addons:
diff --git a/package.json b/package.json
@@ -1,11 +1,11 @@
{
"private": true,
"engines": {
- "node": ">=5.0 <7",
- "npm": ">=3.3 <4"
+ "node": ">=6.5",
+ "npm": ">=3.10"
},
"dependencies": {
- "babel-polyfill": "6.13.0",
+ "babel-polyfill": "6.16.0",
"babel-runtime": "6.11.6",
"bluebird": "3.4.6",
"body-parser": "1.15.2",
@@ -14,81 +14,80 @@
"core-js": "2.4.1",
"express": "4.14.0",
"express-graphql": "0.5.4",
- "express-jwt": "5.0.0",
+ "express-jwt": "5.1.0",
"fastclick": "1.0.6",
- "fbjs": "0.8.4",
+ "fbjs": "0.8.5",
"front-matter": "2.1.0",
"graphiql": "0.7.8",
- "graphql": "0.7.0",
- "history": "4.2.0",
+ "graphql": "0.7.2",
+ "history": "4.3.0",
"isomorphic-style-loader": "1.0.0",
"jsonwebtoken": "7.1.9",
- "markdown-it": "8.0.0",
+ "markdown-it": "8.0.1",
"node-fetch": "1.6.3",
- "normalize.css": "4.2.0",
+ "normalize.css": "5.0.0",
"passport": "0.3.2",
"passport-facebook": "2.1.1",
- "pretty-error": "2.0.1",
+ "pretty-error": "2.0.2",
"query-string": "4.2.3",
"react": "15.3.2",
"react-dom": "15.3.2",
- "sequelize": "3.24.3",
- "source-map-support": "0.4.2",
- "sqlite3": "3.1.4",
- "universal-router": "1.2.2",
+ "sequelize": "3.24.5",
+ "source-map-support": "0.4.5",
+ "sqlite3": "3.1.6",
+ "universal-router": "2.0.0",
"whatwg-fetch": "1.0.0"
},
"devDependencies": {
- "assets-webpack-plugin": "^3.4.0",
- "autoprefixer": "^6.4.1",
- "babel-cli": "^6.14.0",
- "babel-core": "^6.14.0",
- "babel-eslint": "^6.1.2",
+ "assets-webpack-plugin": "^3.5.0",
+ "autoprefixer": "^6.5.1",
+ "babel-cli": "^6.16.0",
+ "babel-core": "^6.17.0",
+ "babel-eslint": "^7.0.0",
"babel-loader": "^6.2.5",
"babel-plugin-rewire": "^1.0.0",
"babel-plugin-transform-react-constant-elements": "^6.9.1",
"babel-plugin-transform-react-inline-elements": "^6.8.0",
- "babel-plugin-transform-react-remove-prop-types": "^0.2.9",
+ "babel-plugin-transform-react-remove-prop-types": "^0.2.10",
"babel-plugin-transform-runtime": "^6.15.0",
- "babel-preset-es2015": "^6.14.0",
- "babel-preset-node5": "^11.1.0",
- "babel-preset-react": "^6.11.1",
- "babel-preset-stage-0": "^6.5.0",
- "babel-register": "^6.14.0",
- "babel-template": "^6.15.0",
- "babel-types": "^6.15.0",
- "browser-sync": "^2.16.0",
+ "babel-preset-latest": "^6.16.0",
+ "babel-preset-react": "^6.16.0",
+ "babel-preset-stage-0": "^6.16.0",
+ "babel-register": "^6.16.3",
+ "babel-template": "^6.16.0",
+ "babel-types": "^6.16.0",
+ "browser-sync": "^2.17.5",
"chai": "^3.5.0",
"css-loader": "^0.25.0",
- "enzyme": "^2.4.1",
- "eslint": "^3.6.0",
+ "enzyme": "^2.5.1",
+ "eslint": "^3.8.1",
"eslint-config-airbnb": "^12.0.0",
- "eslint-loader": "^1.5.0",
+ "eslint-loader": "^1.6.0",
"eslint-plugin-import": "^1.16.0",
- "eslint-plugin-jsx-a11y": "^2.2.2",
- "eslint-plugin-react": "^6.3.0",
+ "eslint-plugin-jsx-a11y": "^2.2.3",
+ "eslint-plugin-react": "^6.4.1",
"extend": "^3.0.0",
"file-loader": "^0.9.0",
- "gaze": "^1.1.1",
+ "gaze": "^1.1.2",
"git-repository": "^0.1.4",
- "glob": "^7.1.0",
+ "glob": "^7.1.1",
"json-loader": "^0.5.4",
"mkdirp": "^0.5.1",
- "mocha": "^3.0.2",
+ "mocha": "^3.1.2",
"pixrem": "^3.0.2",
"pleeease-filters": "^3.0.0",
- "postcss": "^5.2.2",
+ "postcss": "^5.2.5",
"postcss-calc": "^5.3.1",
"postcss-color-function": "^2.0.1",
"postcss-custom-media": "^5.0.1",
"postcss-custom-properties": "^5.0.1",
"postcss-custom-selectors": "^3.0.0",
"postcss-flexbugs-fixes": "^2.0.0",
- "postcss-loader": "^0.13.0",
+ "postcss-loader": "^1.0.0",
"postcss-media-minmax": "^2.1.2",
"postcss-nested": "^1.0.0",
"postcss-nesting": "^2.3.1",
- "postcss-partial-import": "^2.0.0",
+ "postcss-partial-import": "^2.1.0",
"postcss-pseudoelements": "^3.0.0",
"postcss-selector-matches": "^2.0.5",
"postcss-selector-not": "^2.0.0",
@@ -96,22 +95,31 @@
"raw-loader": "^0.5.1",
"react-addons-test-utils": "15.3.2",
"react-hot-loader": "^3.0.0-beta.6",
- "redbox-react": "^1.3.1",
+ "redbox-react": "^1.3.2",
"rimraf": "^2.5.4",
- "sinon": "^2.0.0-pre.2",
- "stylelint": "^7.3.1",
+ "sinon": "^2.0.0-pre.3",
+ "stylelint": "^7.5.0",
"stylelint-config-standard": "^13.0.2",
"url-loader": "^0.5.7",
"webpack": "^1.13.2",
- "webpack-hot-middleware": "^2.12.2",
+ "webpack-hot-middleware": "^2.13.0",
"webpack-middleware": "^1.5.1"
},
"babel": {
"presets": [
"react",
- "node5",
"stage-0"
],
+ "plugins": [
+ "syntax-trailing-function-commas",
+ "transform-async-to-generator",
+ "transform-es2015-destructuring",
+ "transform-es2015-parameters",
+ "transform-es2015-duplicate-keys",
+ "transform-es2015-modules-commonjs",
+ "transform-exponentiation-operator",
+ "transform-runtime"
+ ],
"env": {
"test": {
"plugins": [
@@ -166,7 +174,7 @@
"lint:js": "eslint src tools",
"lint:css": "stylelint \"src/**/*.{css,less,scss,sss}\"",
"lint": "npm run lint:js && npm run lint:css",
- "test": "mocha \"src/**/*.test.js\" --require test/setup.js --compilers js:babel-register",
+ "test": "mocha \"src/**/*.test.js\" --require babel-register --require test/setup.js",
"test:watch": "npm run test -- --reporter min --watch",
"clean": "babel-node tools/run clean",
"copy": "babel-node tools/run copy",
diff --git a/src/routes/index.js b/src/routes/index.js
@@ -28,13 +28,8 @@ export default {
],
async action({ next }) {
- let route;
-
// Execute each child route until one of them return the result
- // TODO: move this logic to the `next` function
- do {
- route = await next();
- } while (!route);
+ const route = await next();
// Provide default values for title, description etc.
route.title = `${route.title || 'Untitled Page'} - www.reactstarterkit.com`;
diff --git a/tools/webpack.config.js b/tools/webpack.config.js
@@ -12,22 +12,8 @@ import webpack from 'webpack';
import extend from 'extend';
import AssetsPlugin from 'assets-webpack-plugin';
-const DEBUG = !process.argv.includes('--release');
-const VERBOSE = process.argv.includes('--verbose');
-const AUTOPREFIXER_BROWSERS = [
- 'Android 2.3',
- 'Android >= 4',
- 'Chrome >= 35',
- 'Firefox >= 31',
- 'Explorer >= 9',
- 'iOS >= 7',
- 'Opera >= 12',
- 'Safari >= 7.1',
-];
-const GLOBALS = {
- 'process.env.NODE_ENV': DEBUG ? '"development"' : '"production"',
- __DEV__: DEBUG,
-};
+const isDebug = !process.argv.includes('--release');
+const isVerbose = process.argv.includes('--verbose');
//
// Common configuration chunk to be used for both
@@ -53,20 +39,42 @@ const config = {
],
query: {
// https://github.com/babel/babel-loader#options
- cacheDirectory: DEBUG,
+ cacheDirectory: isDebug,
// https://babeljs.io/docs/usage/options/
babelrc: false,
presets: [
+ // JSX, Flow
+ // https://github.com/babel/babel/tree/master/packages/babel-preset-react
'react',
- 'es2015',
+ // Latest stable ECMAScript features
+ // https://github.com/babel/babel/tree/master/packages/babel-preset-latest
+ 'latest',
+ // Experimental ECMAScript proposals
+ // https://github.com/babel/babel/tree/master/packages/babel-preset-stage-0
'stage-0',
],
plugins: [
+ // Externalise references to helpers and builtins,
+ // automatically polyfilling your code without polluting globals.
+ // https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-runtime
'transform-runtime',
- ...DEBUG ? [] : [
+ ...isDebug ? [
+ // Adds component stack to warning messages
+ // https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx-source
+ 'transform-react-jsx-source',
+ // Adds __self attribute to JSX which React will use for some warnings
+ // https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-jsx-self
+ 'transform-react-jsx-self',
+ ] : [
+ // Remove unnecessary React propTypes from the production build
+ // https://github.com/oliviertassinari/babel-plugin-transform-react-remove-prop-types
'transform-react-remove-prop-types',
+ // Treat React JSX elements as value types and hoist them to the highest scope
+ // https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-constant-elements
'transform-react-constant-elements',
+ // Turn JSX elements into exploded React objects
+ // https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-react-inline-elements
'transform-react-inline-elements',
],
],
@@ -77,12 +85,14 @@ const config = {
loaders: [
'isomorphic-style-loader',
`css-loader?${JSON.stringify({
- sourceMap: DEBUG,
+ // CSS Loader https://github.com/webpack/css-loader
+ importLoaders: 1,
+ sourceMap: isDebug,
// CSS Modules https://github.com/css-modules/css-modules
modules: true,
- localIdentName: DEBUG ? '[name]_[local]_[hash:base64:3]' : '[hash:base64:4]',
+ localIdentName: isDebug ? '[name]-[local]-[hash:base64:5]' : '[hash:base64:5]',
// CSS Nano http://cssnano.co/options/
- minimize: !DEBUG,
+ minimize: !isDebug,
})}`,
'postcss-loader?pack=default',
],
@@ -91,7 +101,7 @@ const config = {
test: /\.scss$/,
loaders: [
'isomorphic-style-loader',
- `css-loader?${JSON.stringify({ sourceMap: DEBUG, minimize: !DEBUG })}`,
+ `css-loader?${JSON.stringify({ sourceMap: isDebug, minimize: !isDebug })}`,
'postcss-loader?pack=sass',
'sass-loader',
],
@@ -108,7 +118,7 @@ const config = {
test: /\.(png|jpg|jpeg|gif|svg|woff|woff2)$/,
loader: 'url-loader',
query: {
- name: DEBUG ? '[path][name].[ext]?[hash]' : '[hash].[ext]',
+ name: isDebug ? '[path][name].[ext]?[hash]' : '[hash].[ext]',
limit: 10000,
},
},
@@ -116,7 +126,7 @@ const config = {
test: /\.(eot|ttf|wav|mp3)$/,
loader: 'file-loader',
query: {
- name: DEBUG ? '[path][name].[ext]?[hash]' : '[hash].[ext]',
+ name: isDebug ? '[path][name].[ext]?[hash]' : '[hash].[ext]',
},
},
],
@@ -128,21 +138,23 @@ const config = {
extensions: ['', '.webpack.js', '.web.js', '.js', '.jsx', '.json'],
},
- cache: DEBUG,
- debug: DEBUG,
+ cache: isDebug,
+ debug: isDebug,
stats: {
colors: true,
- reasons: DEBUG,
- hash: VERBOSE,
- version: VERBOSE,
+ reasons: isDebug,
+ hash: isVerbose,
+ version: isVerbose,
timings: true,
- chunks: VERBOSE,
- chunkModules: VERBOSE,
- cached: VERBOSE,
- cachedAssets: VERBOSE,
+ chunks: isVerbose,
+ chunkModules: isVerbose,
+ cached: isVerbose,
+ cachedAssets: isVerbose,
},
+ // The list of plugins for PostCSS
+ // https://github.com/postcss/postcss
postcss(bundler) {
return {
default: [
@@ -193,10 +205,10 @@ const config = {
require('postcss-flexbugs-fixes')(),
// Add vendor prefixes to CSS rules using values from caniuse.com
// https://github.com/postcss/autoprefixer
- require('autoprefixer')({ browsers: AUTOPREFIXER_BROWSERS }),
+ require('autoprefixer')(),
],
sass: [
- require('autoprefixer')({ browsers: AUTOPREFIXER_BROWSERS }),
+ require('autoprefixer')(),
],
};
},
@@ -210,8 +222,8 @@ const clientConfig = extend(true, {}, config, {
entry: './client.js',
output: {
- filename: DEBUG ? '[name].js?[chunkhash]' : '[name].[chunkhash].js',
- chunkFilename: DEBUG ? '[name].[id].js?[chunkhash]' : '[name].[id].[chunkhash].js',
+ filename: isDebug ? '[name].js?[chunkhash]' : '[name].[chunkhash].js',
+ chunkFilename: isDebug ? '[name].[id].js?[chunkhash]' : '[name].[id].[chunkhash].js',
},
target: 'web',
@@ -220,7 +232,11 @@ const clientConfig = extend(true, {}, config, {
// Define free variables
// https://webpack.github.io/docs/list-of-plugins.html#defineplugin
- new webpack.DefinePlugin({ ...GLOBALS, 'process.env.BROWSER': true }),
+ new webpack.DefinePlugin({
+ 'process.env.NODE_ENV': isDebug ? '"development"' : '"production"',
+ 'process.env.BROWSER': true,
+ __DEV__: isDebug,
+ }),
// Emit a file with assets paths
// https://github.com/sporto/assets-webpack-plugin#options
@@ -235,8 +251,7 @@ const clientConfig = extend(true, {}, config, {
// https://webpack.github.io/docs/list-of-plugins.html#occurrenceorderplugin
new webpack.optimize.OccurrenceOrderPlugin(true),
- ...DEBUG ? [] : [
-
+ ...isDebug ? [] : [
// Search for equal or similar files and deduplicate them in the output
// https://webpack.github.io/docs/list-of-plugins.html#dedupeplugin
new webpack.optimize.DedupePlugin(),
@@ -245,8 +260,8 @@ const clientConfig = extend(true, {}, config, {
// https://github.com/mishoo/UglifyJS2#compressor-options
new webpack.optimize.UglifyJsPlugin({
compress: {
- screw_ie8: true, // jscs:ignore requireCamelCaseOrUpperCaseIdentifiers
- warnings: VERBOSE,
+ screw_ie8: true,
+ warnings: isVerbose,
},
}),
],
@@ -254,7 +269,7 @@ const clientConfig = extend(true, {}, config, {
// Choose a developer tool to enhance debugging
// http://webpack.github.io/docs/configuration.html#devtool
- devtool: DEBUG ? 'source-map' : false,
+ devtool: isDebug ? 'source-map' : false,
});
//
@@ -282,10 +297,13 @@ const serverConfig = extend(true, {}, config, {
],
plugins: [
-
// Define free variables
// https://webpack.github.io/docs/list-of-plugins.html#defineplugin
- new webpack.DefinePlugin({ ...GLOBALS, 'process.env.BROWSER': false }),
+ new webpack.DefinePlugin({
+ 'process.env.NODE_ENV': isDebug ? '"development"' : '"production"',
+ 'process.env.BROWSER': false,
+ __DEV__: isDebug,
+ }),
// Adds a banner to the top of each generated chunk
// https://webpack.github.io/docs/list-of-plugins.html#bannerplugin