Skip to content

Commit

Permalink
fix: support webpack@5 (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi committed Jan 3, 2020
1 parent b896c5a commit 17c29a5
Show file tree
Hide file tree
Showing 68 changed files with 3,366 additions and 2,027 deletions.
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
insert_final_newline = true
trim_trailing_whitespace = false
8 changes: 8 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,14 @@ module. Thankfully, Github provides a means to do this. Add a dependency to the

Where `{id}` is the # ID of your Pull Request.

## Contributor License Agreement

When submitting your contribution, a CLA (Contributor License Agreement) bot will come by to verify that you signed the [CLA](https://cla.js.foundation/webpack-contrib/compression-webpack-plugin).
If it is your first time, it will link you to the right place to sign it.
However, if you have committed your contributions using an email that is not the same as your email used on GitHub, the CLA bot can't accept your contribution.

Run `git config user.email` to see your Git email, and verify it with [your GitHub email](https://github.com/settings/emails).

## Thanks

For your interest, time, understanding, and for following this simple guide.
73 changes: 45 additions & 28 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ trigger:
- master
- next

variables:
npm_config_cache: $(Pipeline.Workspace)/.npm

jobs:
- job: Lint
pool:
vmImage: ubuntu-16.04
vmImage: ubuntu-latest
steps:
- task: NodeTool@0
inputs:
Expand All @@ -20,10 +23,12 @@ jobs:
node -v
npm -v
displayName: 'Print versions'
- task: Npm@1
- task: CacheBeta@1
inputs:
command: custom
customCommand: ci
key: npm | $(Agent.OS) | package-lock.json
path: $(npm_config_cache)
displayName: 'Cache npm'
- script: npm ci
displayName: 'Install dependencies'
- script: npm run lint
displayName: 'Run lint'
Expand All @@ -34,10 +39,13 @@ jobs:

- job: Linux
pool:
vmImage: ubuntu-16.04
vmImage: ubuntu-latest
strategy:
maxParallel: 4
maxParallel: 5
matrix:
node-13:
node_version: ^13.0.0
webpack_version: latest
node-12:
node_version: ^12.0.0
webpack_version: latest
Expand All @@ -47,10 +55,9 @@ jobs:
node-8:
node_version: ^8.9.0
webpack_version: latest
node-8-canary:
node_version: ^8.9.0
node-10-canary:
node_version: ^10.13.0
webpack_version: next
continue_on_error: true
steps:
- task: NodeTool@0
inputs:
Expand All @@ -65,10 +72,12 @@ jobs:
node -v
npm -v
displayName: 'Print versions'
- task: Npm@1
- task: CacheBeta@1
inputs:
command: custom
customCommand: ci
key: npm | $(Agent.OS) | package-lock.json
path: $(npm_config_cache)
displayName: 'Cache npm'
- script: npm ci
displayName: 'Install dependencies'
- script: npm i webpack@$(webpack_version)
displayName: 'Install "webpack@$(webpack_version)"'
Expand All @@ -86,10 +95,13 @@ jobs:

- job: macOS
pool:
vmImage: macOS-10.14
vmImage: macOS-latest
strategy:
maxParallel: 4
maxParallel: 5
matrix:
node-13:
node_version: ^13.0.0
webpack_version: latest
node-12:
node_version: ^12.0.0
webpack_version: latest
Expand All @@ -99,10 +111,9 @@ jobs:
node-8:
node_version: ^8.9.0
webpack_version: latest
node-8-canary:
node_version: ^8.9.0
node-10-canary:
node_version: ^10.13.0
webpack_version: next
continue_on_error: true
steps:
- task: NodeTool@0
inputs:
Expand All @@ -117,10 +128,12 @@ jobs:
node -v
npm -v
displayName: 'Print versions'
- task: Npm@1
- task: CacheBeta@1
inputs:
command: custom
customCommand: ci
key: npm | $(Agent.OS) | package-lock.json
path: $(npm_config_cache)
displayName: 'Cache npm'
- script: npm ci
displayName: 'Install dependencies'
- script: npm i webpack@$(webpack_version)
displayName: 'Install "webpack@$(webpack_version)"'
Expand All @@ -138,10 +151,13 @@ jobs:

- job: Windows
pool:
vmImage: windows-2019
vmImage: windows-latest
strategy:
maxParallel: 4
maxParallel: 5
matrix:
node-13:
node_version: ^13.0.0
webpack_version: latest
node-12:
node_version: ^12.0.0
webpack_version: latest
Expand All @@ -151,10 +167,9 @@ jobs:
node-8:
node_version: ^8.9.0
webpack_version: latest
node-8-canary:
node_version: ^8.9.0
node-10-canary:
node_version: ^10.13.0
webpack_version: next
continue_on_error: true
steps:
- script: 'git config --global core.autocrlf input'
displayName: 'Config git core.autocrlf'
Expand All @@ -172,10 +187,12 @@ jobs:
node -v
npm -v
displayName: 'Print versions'
- task: Npm@1
- task: CacheBeta@1
inputs:
command: custom
customCommand: ci
key: npm | $(Agent.OS) | package-lock.json
path: $(npm_config_cache)
displayName: 'Cache npm'
- script: npm ci
displayName: 'Install dependencies'
- script: npm i webpack@$(webpack_version)
displayName: 'Install "webpack@$(webpack_version)"'
Expand Down
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
testEnvironment: 'node',
snapshotResolver: './test/helpers/snapshotResolver.js',
};
56 changes: 40 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 17 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,38 @@
"author": "Tobias Koppers @sokra",
"homepage": "https://github.com/webpack-contrib/compression-webpack-plugin",
"bugs": "https://github.com/webpack-contrib/compression-webpack-plugin/issues",
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/webpack"
},
"main": "dist/cjs.js",
"engines": {
"node": ">= 8.9.0"
},
"scripts": {
"start": "npm run build -- -w",
"prebuild": "npm run clean",
"build": "cross-env NODE_ENV=production babel src -d dist --ignore \"src/**/*.test.js\" --copy-files",
"clean": "del-cli dist",
"prebuild": "npm run clean",
"build": "cross-env NODE_ENV=production babel src -d dist --copy-files",
"commitlint": "commitlint --from=master",
"lint:prettier": "prettier \"{**/*,*}.{js,json,md,yml,css}\" --list-different",
"lint:js": "eslint --cache src test",
"lint": "npm-run-all -l -p \"lint:**\"",
"prepare": "npm run build",
"release": "standard-version",
"security": "npm audit",
"lint:prettier": "prettier \"{**/*,*}.{js,json,md,yml,css,ts}\" --list-different",
"lint:js": "eslint --cache .",
"lint": "npm-run-all -l -p \"lint:**\"",
"test:only": "cross-env NODE_ENV=test jest",
"test:watch": "cross-env NODE_ENV=test jest --watch",
"test:coverage": "cross-env NODE_ENV=test jest --collectCoverageFrom=\"src/**/*.js\" --coverage",
"test:watch": "npm run test:only -- --watch",
"test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage",
"pretest": "npm run lint",
"test": "cross-env NODE_ENV=test npm run test:coverage",
"test": "npm run test:coverage",
"prepare": "npm run build",
"release": "standard-version",
"defaults": "webpack-defaults"
},
"files": [
"dist"
],
"peerDependencies": {
"webpack": "^4.3.0"
"webpack": "^4.3.0 || ^5.0.0"
},
"dependencies": {
"cacache": "^13.0.1",
Expand All @@ -51,7 +55,7 @@
"@commitlint/cli": "^8.2.0",
"@commitlint/config-conventional": "^8.2.0",
"@gfx/zopfli": "^1.0.8",
"@webpack-contrib/defaults": "^5.0.0",
"@webpack-contrib/defaults": "^6.3.0",
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
"babel-jest": "^24.9.0",
"commitlint-azure-pipelines-cli": "^1.0.2",
Expand All @@ -66,7 +70,7 @@
"jest": "^24.9.0",
"jest-junit": "^10.0.0",
"lint-staged": "^9.5.0",
"memory-fs": "^0.5.0",
"memfs": "^3.0.3",
"npm-run-all": "^4.1.5",
"prettier": "^1.19.1",
"standard-version": "^7.0.1",
Expand Down
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ import schema from './options.json';

class CompressionPlugin {
constructor(options = {}) {
validateOptions(schema, options, 'Compression Plugin');
validateOptions(schema, options, {
name: 'Compression Plugin',
baseDataPath: 'options',
});

const {
test,
Expand Down
Loading

0 comments on commit 17c29a5

Please sign in to comment.