Skip to content

Commit

Permalink
Update dependencies & webpack compatibility (BREAKING CHANGES)
Browse files Browse the repository at this point in the history
  • Loading branch information
QWp6t committed Nov 3, 2016
1 parent e6f2f49 commit eae52fd
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 6,053 deletions.
22 changes: 11 additions & 11 deletions assets/build/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const path = require('path');
const argv = require('minimist')(process.argv.slice(2));
const glob = require('glob-all');
const merge = require('lodash/merge');

const mergeWithConcat = require('./util/mergeWithConcat');
const userConfig = require('../config');
Expand Down Expand Up @@ -30,19 +29,20 @@ const config = mergeWithConcat({
watch: [],
}, userConfig);

const files = glob.sync(config.copy, {
cwd: config.paths.assets,
mark: true,
}).filter(file => !((file.slice(-1) === '/') || (!file.indexOf('*') === -1)))
.map(file => path.join(config.paths.assets, file));

Object.keys(config.entry).forEach(id =>
config.entry[id].unshift(path.join(__dirname, 'public-path.js')));

module.exports = mergeWithConcat(config, {
env: merge({ production: isProduction, development: !isProduction }, argv.env),
entry: {
get files() {
return glob.sync(config.copy, {
cwd: config.paths.assets,
mark: true,
}).filter(file => !((file.slice(-1) === '/') || (!file.indexOf('*') === -1)))
.map(file => path.join(config.paths.assets, file));
},
},
env: Object.assign({ production: isProduction, development: !isProduction }, argv.env),
publicPath: `${config.publicPath}/${path.basename(config.paths.dist)}/`,
});

if (files.length) {
module.exports = mergeWithConcat(module.exports, { entry: { files } });
}
53 changes: 28 additions & 25 deletions assets/build/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@ const webpackConfig = {
filename: `scripts/${assetsFilenames}.js`,
},
module: {
preLoaders: [
rules: [
jsLoader,
{
enforce: 'pre',
test: /\.js?$/,
include: config.paths.assets,
loader: 'eslint',
},
],
loaders: [
jsLoader,
{
test: /\.css$/,
include: config.paths.assets,
Expand Down Expand Up @@ -110,12 +109,14 @@ const webpackConfig = {
},
],
},
modules: [
config.paths.assets,
'node_modules',
'bower_components',
],
enforceExtensions: false,
resolve: {
modules: [
config.paths.assets,
'node_modules',
'bower_components',
],
enforceExtension: false,
},
externals: {
jquery: 'jQuery',
},
Expand Down Expand Up @@ -163,18 +164,21 @@ const webpackConfig = {
minimize: config.enabled.minify,
debug: config.enabled.watcher,
stats: { colors: true },
postcss: [
autoprefixer({
browsers: [
'last 2 versions',
'android 4',
'opera 12',
],
}),
],
eslint: {
failOnWarning: false,
failOnError: true,
}),
new webpack.LoaderOptionsPlugin({
test: /\.s?css$/,
options: {
output: { path: config.paths.dist },
context: config.paths.assets,
postcss: [
autoprefixer({ browsers: ['last 2 versions', 'android 4', 'opera 12'] }),
],
},
}),
new webpack.LoaderOptionsPlugin({
test: /\.js$/,
options: {
eslint: { failOnWarning: false, failOnError: true },
},
}),
],
Expand All @@ -187,9 +191,8 @@ if (config.env.production) {
}

if (config.enabled.watcher) {
module.exports = mergeWithConcat(webpackConfig, webpackConfigWatch, {
entry: addHotMiddleware(webpackConfig.entry),
});
module.exports.entry = addHotMiddleware(webpackConfig.entry);
module.exports = mergeWithConcat(webpackConfig, webpackConfigWatch);
}

if (config.enabled.uglifyJs) {
Expand Down
1 change: 0 additions & 1 deletion assets/build/webpack.config.watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const config = require('./config');

module.exports = {
output: { pathinfo: true },
debug: true,
devtool: '#cheap-module-source-map',
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(),
Expand Down
60 changes: 30 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,53 +29,53 @@
"node": ">= 4.5"
},
"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",
"babel-loader": "^6.2.5",
"babel-preset-es2015": "^6.14.0",
"babel-register": "^6.14.0",
"babel-runtime": "^6.11.6",
"assets-webpack-plugin": "^3.5.0",
"autoprefixer": "^6.5.1",
"babel-cli": "^6.18.0",
"babel-core": "^6.18.2",
"babel-eslint": "^7.1.0",
"babel-loader": "^6.2.7",
"babel-preset-es2015": "^6.18.0",
"babel-register": "^6.18.0",
"babel-runtime": "^6.18.0",
"body-parser": "^1.15.2",
"browser-sync": "^2.15.0",
"clean-webpack-plugin": "^0.1.10",
"browser-sync": "^2.17.5",
"clean-webpack-plugin": "^0.1.13",
"css-loader": "^0.25.0",
"cssnano": "^3.7.4",
"eslint": "^3.5.0",
"eslint-config-airbnb": "^11.0.0",
"eslint-config-airbnb-es5": "^1.0.9",
"eslint-loader": "^1.5.0",
"eslint-plugin-import": "^1.14.0",
"eslint-plugin-jsx-a11y": "^2.2.1",
"eslint-plugin-react": "^6.2.0",
"cssnano": "^3.8.0",
"eslint": "^3.9.1",
"eslint-config-airbnb": "^12.0.0",
"eslint-config-airbnb-es5": "^1.1.0",
"eslint-loader": "^1.6.1",
"eslint-plugin-import": "^2.0.1",
"eslint-plugin-jsx-a11y": "^2.2.3",
"eslint-plugin-react": "^6.5.0",
"extract-text-webpack-plugin": "^2.0.0-beta.4",
"file-loader": "^0.9.0",
"glob-all": "^3.1.0",
"imagemin-mozjpeg": "^6.0.0",
"imagemin-webpack-plugin": "^1.1.0",
"imagemin-webpack-plugin": "^1.2.1",
"imports-loader": "^0.6.5",
"lodash": "^4.15.0",
"lodash": "^4.16.6",
"minimist": "^1.2.0",
"monkey-hot-loader": "github:rmarscher/monkey-hot-loader#webpack2-import",
"node-sass": "^3.9.3",
"node-sass": "^3.11.0",
"optimize-css-assets-webpack-plugin": "^1.3.0",
"postcss": "^5.2.0",
"postcss-loader": "^0.13.0",
"qs": "^6.2.1",
"postcss": "^5.2.5",
"postcss-loader": "^1.1.0",
"qs": "^6.3.0",
"resolve-url-loader": "^1.6.0",
"rimraf": "^2.5.4",
"sass-loader": "^4.0.2",
"style-loader": "^0.13.1",
"url-loader": "^0.5.7",
"webpack": "2.1.0-beta.22",
"webpack-dev-middleware": "^1.7.0",
"webpack-hot-middleware": "^2.12.2"
"webpack": "^2.1.0-beta.25",
"webpack-dev-middleware": "^1.8.4",
"webpack-hot-middleware": "^2.13.1"
},
"dependencies": {
"bootstrap": "github:twbs/bootstrap#v4-dev",
"font-awesome": "^4.6.3",
"bootstrap": "^4.0.0-alpha.5",
"font-awesome": "^4.7.0",
"jquery": "1.12.4 - 3"
}
}
Loading

0 comments on commit eae52fd

Please sign in to comment.