diff --git a/config/config.js b/config/config.js index 1461dec..a1d226e 100644 --- a/config/config.js +++ b/config/config.js @@ -2,7 +2,7 @@ const _root = __dirname + '/../'; module.exports = { - // path helpers + // path helpers _app: 'common', minified: 'common.min.js', dev: 'common.js', @@ -12,4 +12,4 @@ module.exports = { testDir: _root + 'tests', setupDir: _root + 'tests/setup/node.js', karmaConf: _root + 'config/karma.conf.js' -}; \ No newline at end of file +}; diff --git a/config/webpack/webpack.development.config.js b/config/webpack/webpack.development.config.js index bb07434..b3c3b70 100644 --- a/config/webpack/webpack.development.config.js +++ b/config/webpack/webpack.development.config.js @@ -64,7 +64,6 @@ module.exports = { // entry points entry: config.sourceDir, cache: true, - debug: true, watch: true, devtool: 'eval', output: { @@ -74,24 +73,27 @@ module.exports = { library: config._app }, module: { - preLoaders: [{ - test: /\.js$/, - loader: 'eslint-loader', - exclude: /node_modules/ - }], - loaders: [{ - test: /[\/\\]src[\/\\]vendors[\/\\]jquery\.contextmenu_custom\.js$/, - loader: "imports?define=>false" - }, - { - test: /\.js$/, - exclude: /node_modules/, - include: path.join(__dirname, '../../src'), - loader: 'babel-loader' - }] + rules: [ + { + test: /\.js$/, + enforce: 'pre', + loader: 'eslint-loader', + exclude: /node_modules/ + }, + { + test: /[\/\\]src[\/\\]vendors[\/\\]jquery\.contextmenu_custom\.js$/, + use: "imports-loader?define=>false" + }, + { + test: /\.js$/, + exclude: /node_modules/, + include: path.join(__dirname, '../../src'), + use: 'babel-loader' + } + ] }, resolve: { - extensions: ['', '.js'], + extensions: ['*', '.js'], alias: { 'jquery-contextmenu': path.join(__dirname, '../../src/vendors/jquery.contextmenu_custom.js') } @@ -100,13 +102,20 @@ module.exports = { new WebpackNotifierPlugin({ alwaysNotify: true }), - new webpack.optimize.OccurenceOrderPlugin(), // new webpack.BannerPlugin(banner), new webpack.DefinePlugin({ '__DEV__': true, 'process.env.NODE_ENV': JSON.stringify('development'), VERSION: JSON.stringify(pkg.version) - }) + }), + new webpack.LoaderOptionsPlugin({ + debug: true, + options: { + eslint: { + configFile: config.eslintDir + } + } + }), ], externals: { 'jquery': { @@ -115,8 +124,5 @@ module.exports = { commonjs: 'jquery', amd: 'jquery' } - }, - eslint: { - configFile: config.eslintDir } }; \ No newline at end of file diff --git a/config/webpack/webpack.hot.assets.config.js b/config/webpack/webpack.hot.assets.config.js index da6448e..a339b99 100644 --- a/config/webpack/webpack.hot.assets.config.js +++ b/config/webpack/webpack.hot.assets.config.js @@ -6,12 +6,9 @@ const WebpackDevServer = require('webpack-dev-server'); const environment = require('../environment'); const config = require('./webpack.development.config'); -config.entry = [ - // For hot style updates - 'webpack/hot/only-dev-server', - // The script refreshing the browser on none hot updates - 'webpack-dev-server/client?http://localhost:8080' -].concat(config.entry); +config.devServer = { + hot: true +} config.plugins = [ // Used for hot-reload @@ -21,14 +18,12 @@ config.plugins = [ new WebpackDevServer(webpack(config), { publicPath: 'http://localhost:8080/assets/', // Configure hot replacement - hot: true, // The rest is terminal configurations quiet: false, noInfo: true, historyApiFallback: { index: './templates/index.html' }, - progress: true, stats: { colors: true } diff --git a/config/webpack/webpack.karma.config.js b/config/webpack/webpack.karma.config.js index 93d2f88..4e2bd4a 100644 --- a/config/webpack/webpack.karma.config.js +++ b/config/webpack/webpack.karma.config.js @@ -5,28 +5,34 @@ import config from '../config'; module.exports = { cache: true, - debug: true, - hot:false, output: {}, - entry: {}, module: { - postLoaders: [{ - test: /\.js$/, - include: path.resolve('src/'), - loader: 'istanbul-instrumenter' - }], - loaders: [{ - test: /\.js?$/, - exclude: /node_modules/, - loaders: ['babel-loader'] - }] + rules: [{ + test: /\.js$/, + enforce: 'post', + include: path.resolve('src/'), + loader: 'istanbul-instrumenter-loader' + }, + { + test: /\.js?$/, + exclude: /node_modules/, + use: ['babel-loader'] + } + ] }, resolve: { - extensions: ['', '.js'] + extensions: ['*', '.js'] }, externals: { jquery: 'jQuery', humane: 'humane' }, - plugins: [] + plugins: [ + new webpack.LoaderOptionsPlugin({ + debug: true + }), + ], + devServer: { + hot: true + } }; \ No newline at end of file diff --git a/config/webpack/webpack.production.config.js b/config/webpack/webpack.production.config.js index 021b78e..962ba49 100644 --- a/config/webpack/webpack.production.config.js +++ b/config/webpack/webpack.production.config.js @@ -12,10 +12,7 @@ const webpackConfig = require('./webpack.development.config') module.exports = Object.assign({}, webpackConfig, { cache: false, - debug: false, devtool: false, - hot: false, - build: true, watch: false, output: { path: config.distDir, @@ -33,14 +30,18 @@ module.exports = Object.assign({}, webpackConfig, { title: PKG_LOCATION.name, alwaysNotify: true }), + new webpack.LoaderOptionsPlugin({ + debug: true + }), // optimizations - new webpack.optimize.DedupePlugin(), - new webpack.optimize.OccurenceOrderPlugin(), // new webpack.NoErrorsPlugin(), new webpack.DefinePlugin({ '__DEV__': false, 'process.env.NODE_ENV': JSON.stringify('production'), VERSION: JSON.stringify(PKG_LOCATION.version) }) - ] + ], + devServer: { + hot: true + } }); \ No newline at end of file diff --git a/config/webpack/webpack.production.minified.config.js b/config/webpack/webpack.production.minified.config.js index 81d9d3a..0d32e59 100644 --- a/config/webpack/webpack.production.minified.config.js +++ b/config/webpack/webpack.production.minified.config.js @@ -12,10 +12,7 @@ const webpackConfig = require('./webpack.development.config') module.exports = Object.assign({}, webpackConfig, { cache: false, - debug: false, devtool: false, - hot: false, - build: true, watch: false, output: { path: config.distDir, @@ -33,9 +30,6 @@ module.exports = Object.assign({}, webpackConfig, { title: PKG_LOCATION.name, alwaysNotify: true }), - // optimizations - new webpack.optimize.DedupePlugin(), - new webpack.optimize.OccurenceOrderPlugin(), // new webpack.NoErrorsPlugin(), new webpack.optimize.UglifyJsPlugin({ output: { @@ -52,6 +46,12 @@ module.exports = Object.assign({}, webpackConfig, { '__DEV__': false, 'process.env.NODE_ENV': JSON.stringify('production'), VERSION: JSON.stringify(PKG_LOCATION.version) - }) - ] + }), + new webpack.LoaderOptionsPlugin({ + debug: true + }), + ], + devServer: { + hot: true + } }); \ No newline at end of file diff --git a/package.json b/package.json index 0f2fe59..dc13f99 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "phraseanet-common", - "version": "0.3.2", + "version": "0.4.0", "description": "Phraseanet frontend shared libraries", "scripts": { "clean": "rimraf dist", @@ -64,36 +64,35 @@ "eslint-config-airbnb": "^4.0.0", "eslint-loader": "^1.2.1", "eslint-plugin-react": "^3.16.1", - "istanbul-instrumenter-loader": "^0.1.3", - "karma": "^0.13.19", + "istanbul-instrumenter-loader": "^3.0.0", + "karma": "^1.7.0", "karma-chai": "^0.1.0", - "karma-chrome-launcher": "^0.2.2", - "karma-cli": "^0.1.2", - "karma-coverage": "^0.5.3", - "karma-firefox-launcher": "^0.1.7", - "karma-ie-launcher": "^0.2.0", - "karma-mocha": "^0.2.1", - "karma-mocha-reporter": "^1.1.5", - "karma-phantomjs-launcher": "^1.0.0", - "karma-sinon": "^1.0.4", - "karma-sinon-chai": "^1.1.0", + "karma-chrome-launcher": "^2.2.0", + "karma-cli": "^1.0.1", + "karma-coverage": "^1.1.1", + "karma-firefox-launcher": "^1.0.1", + "karma-ie-launcher": "^1.0.0", + "karma-mocha": "^1.3.0", + "karma-mocha-reporter": "^2.2.3", + "karma-phantomjs-launcher": "^1.0.4", + "karma-sinon": "^1.0.5", + "karma-sinon-chai": "^1.3.1", "karma-sourcemap-loader": "^0.3.7", - "karma-spec-reporter": "0.0.23", - "karma-webpack": "^1.7.0", - "lodash": "4.0.1", - "mocha": "^2.4.5", - "npm-check-updates": "^2.5.7", - "npmlog": "^2.0.2", - "phantomjs": "^2.1.3", - "phantomjs-polyfill": "0.0.1", - "phantomjs-prebuilt": "^2.1.3", - "pre-commit": "^1.1.2", - "rimraf": "^2.5.1", - "sinon": "^1.17.3", - "sinon-chai": "^2.8.0", - "webpack": "^1.12.12", - "webpack-dev-server": "^1.14.1", - "webpack-notifier": "1.2.1" + "karma-spec-reporter": "0.0.31", + "karma-webpack": "^2.0.4", + "lodash": "4.17.4", + "mocha": "^3.5.0", + "npm-check-updates": "^2.12.1", + "npmlog": "^4.1.2", + "phantomjs-polyfill": "0.0.2", + "phantomjs-prebuilt": "^2.1.14", + "pre-commit": "^1.2.2", + "rimraf": "^2.6.1", + "sinon": "^2.1.0", + "sinon-chai": "^2.12.0", + "webpack": "^3.4.1", + "webpack-dev-server": "^2.6.1", + "webpack-notifier": "^1.5.0" }, "babel": { "ignore": [ @@ -113,11 +112,11 @@ "homepage": "https://github.com/lostdalek/Phraseanet-common", "license": "MIT", "dependencies": { - "es6-promise": "^3.0.2", + "es6-promise": "^4.1.1", "humane-js": "^3.2.2", - "imports-loader": "^0.6.5", - "jquery": "^1.11.3", + "imports-loader": "^0.7.1", + "jquery": "^3.2.1", "js-cookie": "^2.1.0", - "pym.js": "^0.4.5" + "pym.js": "^1.3.1" } }