From f990fed86e6b144219a085e3b49534ad9d872725 Mon Sep 17 00:00:00 2001 From: voicetime Date: Thu, 4 Jan 2018 23:56:52 +0300 Subject: [PATCH 1/4] add options minification in webpack.config.js --- webpack.config.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 9ecf880..c4ed0cf 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,9 +1,9 @@ const path = require('path'); - +const webpack = require('webpack') module.exports = function (env) { env = env || {}; - + let plugins = []; /** * If -p flag is set, minify the files @@ -12,6 +12,16 @@ module.exports = function (env) { const src = !env.p; const filenamePostfix = src ? '.src' : ''; + if (!src) { + plugins.push(new webpack.optimize.UglifyJsPlugin({ + compress: { + drop_console: true, + unsafe: true + } + }) + ) + } + /** * If -b flag is set, build bundles, and not exclude highcharts from the build * @type {boolean} @@ -86,6 +96,7 @@ module.exports = function (env) { } ] }, + plugins: plugins, externals: externals, resolve: { modules: [ From 096f0d27d5d072c80c7158c719e401fd1d32bf15 Mon Sep 17 00:00:00 2001 From: voicetime Date: Fri, 5 Jan 2018 03:36:36 +0300 Subject: [PATCH 2/4] update version modules in package.json. Edit config babel-loader in webpack.config.js for compatibility with the latest stable version. Fix code in test/unit/simulateDOM.js --- package.json | 46 ++++++++++++++++++++-------------------- test/unit/simulateDOM.js | 6 +++--- webpack.config.js | 12 +++++------ 3 files changed, 31 insertions(+), 33 deletions(-) diff --git a/package.json b/package.json index ea97819..babd2e0 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,8 @@ "url": "https://github.com/kirjs/react-highcharts" }, "peerDependencies": { - "react": "~0.14 || ^15.0.0 || ^16.0.0", - "react-dom": "~0.14 || ^15.0.0 || ^16.0.0" + "react": "~0.14 || ^15.0.0 || ^16.2.0", + "react-dom": "~0.14 || ^15.0.0 || ^16.2.0" }, "bugs": "https://github.com/kirjs/react-highcharts/issues", "keywords": [ @@ -35,31 +35,31 @@ "graph" ], "devDependencies": { - "babel-cli": "^6.18.0", + "babel-cli": "^6.26.0", "babel-core": "^6.24.0", - "babel-loader": "^6.2.10", - "babel-preset-es2015": "^6.18.0", - "babel-preset-react": "^6.16.0", - "babel-preset-stage-2": "^6.18.0", - "create-react-class": "^15.5.2", - "exports-loader": "^0.6.2", - "file-loader": "^0.10.1", - "highlight.js": "^9.10.0", + "babel-loader": "^7.1.2", + "babel-preset-env": "^1.6.1", + "babel-preset-react": "^6.24.1", + "babel-preset-stage-2": "^6.24.1", + "create-react-class": "^15.6.2", + "exports-loader": "^0.6.4", + "file-loader": "^1.1.6", + "highlight.js": "^9.12.0", "imports-loader": "^0.7.1", - "jsdom": "^9.9.1", - "mocha": "^3.2.0", - "mock-require": "^2.0.1", - "nightwatch": "^0.9.6", - "prop-types": "^15.5.8", + "jsdom": "^11.5.1", + "mocha": "^4.1.0", + "mock-require": "^2.0.2", + "nightwatch": "^0.9.19", + "prop-types": "^15.6.0", "raw-loader": "^0.5.1", - "react": "^15.5.4", - "react-dom": "^15.5.4", - "react-highlight": "^0.9.0", - "sinon": "^2.0.0", - "webpack": "^2.2.1", - "webpack-dev-server": "^2.4.2" + "react": "^16.2.0", + "react-dom": "^16.2.0", + "react-highlight": "^0.10.0", + "sinon": "^4.1.3", + "webpack": "^3.10.0", + "webpack-dev-server": "^2.9.6" }, "dependencies": { - "highcharts": "^6.0.0" + "highcharts": "^6.0.4" } } diff --git a/test/unit/simulateDOM.js b/test/unit/simulateDOM.js index ba50631..57d5fb4 100644 --- a/test/unit/simulateDOM.js +++ b/test/unit/simulateDOM.js @@ -13,9 +13,9 @@ */ var jsdom = require('jsdom'); - -global.document = jsdom.jsdom('
'); -var win = global.document.defaultView; +const {JSDOM} = jsdom; +const {document} = (new JSDOM('
')).window; +var win = document.defaultView; global.window = global; for( var i in win ){ if( i !== 'window' && win.hasOwnProperty(i)){ diff --git a/webpack.config.js b/webpack.config.js index c4ed0cf..27daf64 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -84,15 +84,13 @@ module.exports = function (env) { rules: [ { test: /\.jsx$/, - use: [{ + + use: { loader: 'babel-loader', - query: { - cacheDirectory: true, - presets: ['react', 'es2015', 'stage-2'] + options: { + presets: ['env', 'react', 'stage-2'], } - }], - - + } } ] }, From bc04dd9fad6640f9fea272e22726c1844aeaad7c Mon Sep 17 00:00:00 2001 From: voicetime Date: Fri, 5 Jan 2018 14:02:27 +0300 Subject: [PATCH 3/4] change peerDependencies react 16.2.0 to 16.0.0 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index babd2e0..fbaec2a 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,8 @@ "url": "https://github.com/kirjs/react-highcharts" }, "peerDependencies": { - "react": "~0.14 || ^15.0.0 || ^16.2.0", - "react-dom": "~0.14 || ^15.0.0 || ^16.2.0" + "react": "~0.14 || ^15.0.0 || ^16.0.0", + "react-dom": "~0.14 || ^15.0.0 || ^16.0.0" }, "bugs": "https://github.com/kirjs/react-highcharts/issues", "keywords": [ From d4d728fec2345210aa83051eee306628eee687e1 Mon Sep 17 00:00:00 2001 From: voicetime Date: Mon, 8 Jan 2018 06:51:11 +0300 Subject: [PATCH 4/4] reset webpack.config.js --- webpack.config.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 27daf64..a7f7041 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,9 +1,9 @@ const path = require('path'); -const webpack = require('webpack') + module.exports = function (env) { env = env || {}; - let plugins = []; + /** * If -p flag is set, minify the files @@ -12,16 +12,6 @@ module.exports = function (env) { const src = !env.p; const filenamePostfix = src ? '.src' : ''; - if (!src) { - plugins.push(new webpack.optimize.UglifyJsPlugin({ - compress: { - drop_console: true, - unsafe: true - } - }) - ) - } - /** * If -b flag is set, build bundles, and not exclude highcharts from the build * @type {boolean} @@ -94,7 +84,6 @@ module.exports = function (env) { } ] }, - plugins: plugins, externals: externals, resolve: { modules: [