diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cb9706f..7d0a4c08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ## 0.30.0 + * Upgraded `clean-webpack-plugin` from `^0.1.19` to `^3.0.0`. You + should not notice significant changes unless you use + `Encore.cleanupOutputBeforeBuild()` and pass custom options. + For more info, see [v1 to v2 upgrade notes](https://github.com/johnagan/clean-webpack-plugin/issues/106) + and [v2 to v3 upgrade notes](https://github.com/johnagan/clean-webpack-plugin/releases/tag/v3.0.0). + There were no changes from `0.1.19` to `1.0.0`. + * The `fork-ts-checker-webpack-plugin` package was upgraded for the tests from `^0.4.1` to `^4.0.0`. If you're using `enableForkedTypeScriptTypesChecking()`, you control the `fork-ts-checker-webpack-plugin` version in your diff --git a/lib/plugins/clean.js b/lib/plugins/clean.js index f07f7cd6..154b19ae 100644 --- a/lib/plugins/clean.js +++ b/lib/plugins/clean.js @@ -10,7 +10,7 @@ 'use strict'; const WebpackConfig = require('../WebpackConfig'); //eslint-disable-line no-unused-vars -const CleanWebpackPlugin = require('clean-webpack-plugin'); +const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const PluginPriorities = require('./plugin-priorities'); const applyOptionsCallback = require('../utils/apply-options-callback'); @@ -28,13 +28,12 @@ module.exports = function(plugins, webpackConfig) { } const cleanWebpackPluginOptions = { - root: webpackConfig.outputPath, verbose: false, + cleanOnceBeforeBuildPatterns: webpackConfig.cleanWebpackPluginPaths }; plugins.push({ plugin: new CleanWebpackPlugin( - webpackConfig.cleanWebpackPluginPaths, applyOptionsCallback(webpackConfig.cleanWebpackPluginOptionsCallback, cleanWebpackPluginOptions) ), priority: PluginPriorities.CleanWebpackPlugin diff --git a/package.json b/package.json index 6e645a05..b20159fb 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "assets-webpack-plugin": "^3.9.7", "babel-loader": "^8.0.0", "chalk": "^4.0.0", - "clean-webpack-plugin": "^0.1.19", + "clean-webpack-plugin": "^3.0.0", "css-loader": "^3.5.2", "fast-levenshtein": "^2.0.6", "file-loader": "^6.0.0", diff --git a/test/config-generator.js b/test/config-generator.js index 89f01bb5..3a0d8e7d 100644 --- a/test/config-generator.js +++ b/test/config-generator.js @@ -15,7 +15,7 @@ const RuntimeConfig = require('../lib/config/RuntimeConfig'); const configGenerator = require('../lib/config-generator'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const ManifestPlugin = require('webpack-manifest-plugin'); -const CleanWebpackPlugin = require('clean-webpack-plugin'); +const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const webpack = require('webpack'); const path = require('path'); const logger = require('../lib/logger'); diff --git a/test/plugins/clean.js b/test/plugins/clean.js index c65ec613..09325912 100644 --- a/test/plugins/clean.js +++ b/test/plugins/clean.js @@ -10,7 +10,7 @@ 'use strict'; const expect = require('chai').expect; -const CleanWebpackPlugin = require('clean-webpack-plugin'); +const { CleanWebpackPlugin } = require('clean-webpack-plugin'); const WebpackConfig = require('../../lib/WebpackConfig'); const RuntimeConfig = require('../../lib/config/RuntimeConfig'); const cleanPluginUtil = require('../../lib/plugins/clean'); @@ -41,8 +41,8 @@ describe('plugins/clean', () => { cleanPluginUtil(plugins, config); expect(plugins.length).to.equal(1); expect(plugins[0].plugin).to.be.instanceof(CleanWebpackPlugin); - expect(plugins[0].plugin.paths).to.deep.equal(['**/*']); - expect(plugins[0].plugin.options.dry).to.equal(false); + expect(plugins[0].plugin.cleanOnceBeforeBuildPatterns).to.deep.equal(['**/*']); + expect(plugins[0].plugin.dry).to.equal(false); }); it('enabled with custom paths and options callback', () => { @@ -56,8 +56,8 @@ describe('plugins/clean', () => { cleanPluginUtil(plugins, config); expect(plugins.length).to.equal(1); expect(plugins[0].plugin).to.be.instanceof(CleanWebpackPlugin); - expect(plugins[0].plugin.paths).to.deep.equal(['**/*.js', '**/*.css']); - expect(plugins[0].plugin.options.dry).to.equal(true); + expect(plugins[0].plugin.cleanOnceBeforeBuildPatterns).to.deep.equal(['**/*.js', '**/*.css']); + expect(plugins[0].plugin.dry).to.equal(true); }); it('enabled with an options callback that returns an object', () => { @@ -68,13 +68,13 @@ describe('plugins/clean', () => { options.dry = true; // This should override the original config - return { foo: true }; + return { verbose: true }; }); cleanPluginUtil(plugins, config); expect(plugins.length).to.equal(1); expect(plugins[0].plugin).to.be.instanceof(CleanWebpackPlugin); - expect(plugins[0].plugin.options.dry).to.equal(false); - expect(plugins[0].plugin.options.foo).to.equal(true); + expect(plugins[0].plugin.dry).to.equal(false); + expect(plugins[0].plugin.verbose).to.equal(true); }); }); diff --git a/yarn.lock b/yarn.lock index 5ab01db8..455094a8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -865,6 +865,11 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" +"@types/anymatch@*": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@types/anymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a" + integrity sha512-/+CRPXpBDpo2RK9C68N3b2cOvO0Cf5B9aPijHsoDQTHivnGSObdOF2BRQOYjojWTDy6nQvMjmqRXIxH55VjxxA== + "@types/color-name@^1.1.1": version "1.1.1" resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" @@ -899,6 +904,44 @@ resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.2.tgz#690a1475b84f2a884fd07cd797c00f5f31356ea8" integrity sha512-ce5d3q03Ex0sy4R14722Rmt6MT07Ua+k4FwDfdcToYJcMKNtRVQvJ6JCAPdAmAnbRb6CsX6aYb9m96NGod9uTw== +"@types/source-list-map@*": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@types/source-list-map/-/source-list-map-0.1.2.tgz#0078836063ffaf17412349bba364087e0ac02ec9" + integrity sha512-K5K+yml8LTo9bWJI/rECfIPrGgxdpeNbj+d53lwN4QjW1MCwlkhUms+gtdzigTeUyBr09+u8BwOIY3MXvHdcsA== + +"@types/tapable@*": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.5.tgz#9adbc12950582aa65ead76bffdf39fe0c27a3c02" + integrity sha512-/gG2M/Imw7cQFp8PGvz/SwocNrmKFjFsm5Pb8HdbHkZ1K8pmuPzOX4VeVoiEecFCVf4CsN1r3/BRvx+6sNqwtQ== + +"@types/uglify-js@*": + version "3.9.0" + resolved "https://registry.yarnpkg.com/@types/uglify-js/-/uglify-js-3.9.0.tgz#4490a140ca82aa855ad68093829e7fd6ae94ea87" + integrity sha512-3ZcoyPYHVOCcLpnfZwD47KFLr8W/mpUcgjpf1M4Q78TMJIw7KMAHSjiCLJp1z3ZrBR9pTLbe191O0TldFK5zcw== + dependencies: + source-map "^0.6.1" + +"@types/webpack-sources@*": + version "0.1.7" + resolved "https://registry.yarnpkg.com/@types/webpack-sources/-/webpack-sources-0.1.7.tgz#0a330a9456113410c74a5d64180af0cbca007141" + integrity sha512-XyaHrJILjK1VHVC4aVlKsdNN5KBTwufMb43cQs+flGxtPAf/1Qwl8+Q0tp5BwEGaI8D6XT1L+9bSWXckgkjTLw== + dependencies: + "@types/node" "*" + "@types/source-list-map" "*" + source-map "^0.6.1" + +"@types/webpack@^4.4.31": + version "4.41.12" + resolved "https://registry.yarnpkg.com/@types/webpack/-/webpack-4.41.12.tgz#0386ee2a2814368e2f2397abb036c0bf173ff6c3" + integrity sha512-BpCtM4NnBen6W+KEhrL9jKuZCXVtiH6+0b6cxdvNt2EwU949Al334PjQSl2BeAyvAX9mgoNNG21wvjP3xZJJ5w== + dependencies: + "@types/anymatch" "*" + "@types/node" "*" + "@types/tapable" "*" + "@types/uglify-js" "*" + "@types/webpack-sources" "*" + source-map "^0.6.0" + "@vue/babel-helper-vue-jsx-merge-props@^1.0.0", "@vue/babel-helper-vue-jsx-merge-props@^1.0.0-beta.3": version "1.0.0" resolved "https://registry.yarnpkg.com/@vue/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-1.0.0.tgz#048fe579958da408fb7a8b2a3ec050b50a661040" @@ -2160,12 +2203,13 @@ class-utils@^0.3.5: isobject "^3.0.0" static-extend "^0.1.1" -clean-webpack-plugin@^0.1.19: - version "0.1.19" - resolved "https://registry.yarnpkg.com/clean-webpack-plugin/-/clean-webpack-plugin-0.1.19.tgz#ceda8bb96b00fe168e9b080272960d20fdcadd6d" - integrity sha512-M1Li5yLHECcN2MahoreuODul5LkjohJGFxLPTjl3j1ttKrF5rgjZET1SJduuqxLAuT1gAPOdkhg03qcaaU1KeA== +clean-webpack-plugin@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/clean-webpack-plugin/-/clean-webpack-plugin-3.0.0.tgz#a99d8ec34c1c628a4541567aa7b457446460c62b" + integrity sha512-MciirUH5r+cYLGCOL5JX/ZLzOZbVr1ot3Fw+KcvbhUb6PM+yycqd9ZhIlcigQ5gl+XhppNmw3bEFuaaMNyLj3A== dependencies: - rimraf "^2.6.1" + "@types/webpack" "^4.4.31" + del "^4.1.1" cli-cursor@^3.1.0: version "3.1.0" @@ -7433,7 +7477,7 @@ rgba-regex@^1.0.0: resolved "https://registry.yarnpkg.com/rgba-regex/-/rgba-regex-1.0.0.tgz#43374e2e2ca0968b0ef1523460b7d730ff22eeb3" integrity sha1-QzdOLiyglosO8VI0YLfXMP8i7rM= -rimraf@2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.3: +rimraf@2, rimraf@^2.5.4, rimraf@^2.6.3: version "2.7.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==