Skip to content

Commit

Permalink
chore(release): 6.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Nov 14, 2019
1 parent b93e15b commit 79861c1
Show file tree
Hide file tree
Showing 17 changed files with 242 additions and 151 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [6.0.0](https://github.com/webpack-contrib/webpack-defaults/compare/v5.1.1...v6.0.0) (2019-11-14)


### Features

* more test utils
* refactor test
* cache dependencies on CI
* support webpack@5
* migrate on `memfs`


### BREAKING CHANGES

* minimum supported node version is 10.13.0



### [5.1.1](https://github.com/webpack-contrib/webpack-defaults/compare/v5.1.0...v5.1.1) (2019-10-22)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@webpack-contrib/defaults",
"version": "5.1.1",
"version": "6.0.0",
"description": "Project configuration and boilerplate defaults for webpack projects",
"license": "MIT",
"repository": "webpack-contrib/webpack-defaults",
Expand Down
16 changes: 9 additions & 7 deletions src/tasks/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const devPackages = [
'del',
'del-cli',
'cross-env',
'memory-fs',
'memfs',
'standard-version',
'@commitlint/cli',
'@commitlint/config-conventional',
Expand Down Expand Up @@ -66,31 +66,33 @@ module.exports = () => {
bugs: `https://github.com/${repository}/issues`,
main: existing.main || 'dist/cjs.js',
engines: {
node: `>= 8.9.0`,
node: `>= 10.13.0`,
},
scripts: {
start: 'npm run build -- -w',
clean: 'del-cli dist',
prebuild: 'npm run clean',
build: 'cross-env NODE_ENV=production babel src -d dist --copy-files',
clean: 'del-cli dist',
commitlint: 'commitlint --from=master',
security: 'npm audit',
'lint:prettier':
'prettier "{**/*,*}.{js,json,md,yml,css,ts}" --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',
'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',
pretest: 'npm run lint',
test: 'cross-env NODE_ENV=test npm run test:coverage',
prepare: 'npm run build',
release: 'standard-version',
defaults: existing.scripts.defaults || 'webpack-defaults',
},
files: existing.files || ['dist/', 'lib/', 'index.js'],
peerDependencies: existing.peerDependencies || { webpack: '^4.0.0' },
peerDependencies: existing.peerDependencies || {
webpack: '^4.0.0 || ^5.0.0',
},
dependencies: existing.dependencies || {},
devDependencies: existing.devDependencies || {},
keywords: existing.keywords || ['webpack'],
Expand Down
53 changes: 25 additions & 28 deletions templates/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 Down Expand Up @@ -34,9 +37,9 @@ jobs:

- job: Linux
pool:
vmImage: ubuntu-16.04
vmImage: ubuntu-latest
strategy:
maxParallel: 5
maxParallel: 4
matrix:
node-13:
node_version: ^13.0.0
Expand All @@ -47,13 +50,9 @@ jobs:
node-10:
node_version: ^10.13.0
webpack_version: latest
node-8:
node_version: ^8.9.0
webpack_version: latest
node-10-canary:
node_version: ^10.13.0
webpack_version: next
continue_on_error: true
steps:
- task: NodeTool@0
inputs:
Expand All @@ -68,10 +67,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 @@ -89,9 +90,9 @@ jobs:

- job: macOS
pool:
vmImage: macOS-10.14
vmImage: macOS-latest
strategy:
maxParallel: 5
maxParallel: 4
matrix:
node-13:
node_version: ^13.0.0
Expand All @@ -102,13 +103,9 @@ jobs:
node-10:
node_version: ^10.13.0
webpack_version: latest
node-8:
node_version: ^8.9.0
webpack_version: latest
node-10-canary:
node_version: ^10.13.0
webpack_version: next
continue_on_error: true
steps:
- task: NodeTool@0
inputs:
Expand All @@ -123,10 +120,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 @@ -144,9 +143,9 @@ jobs:

- job: Windows
pool:
vmImage: windows-2019
vmImage: windows-latest
strategy:
maxParallel: 5
maxParallel: 4
matrix:
node-13:
node_version: ^13.0.0
Expand All @@ -157,13 +156,9 @@ jobs:
node-10:
node_version: ^10.13.0
webpack_version: latest
node-8:
node_version: ^8.9.0
webpack_version: latest
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 @@ -181,10 +176,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
2 changes: 1 addition & 1 deletion templates/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = (api) => {
'@babel/preset-env',
{
targets: {
node: '8.9.0',
node: '10.13.0',
},
},
],
Expand Down
File renamed without changes.
11 changes: 11 additions & 0 deletions templates/test/helpers/compile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default (compiler) => {
return new Promise((resolve, reject) => {
compiler.run((error, stats) => {
if (error) {
return reject(error);
}

return resolve(stats);
});
});
};
69 changes: 0 additions & 69 deletions templates/test/helpers/compiler.js

This file was deleted.

47 changes: 47 additions & 0 deletions templates/test/helpers/getCompiler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import path from 'path';

import webpack from 'webpack';
import memfs from 'memfs';

export default (fixture, loaderOptions = {}, config = {}) => {
const fullConfig = {
mode: 'development',
devtool: config.devtool || false,
context: path.resolve(__dirname, '../fixtures'),
entry: path.resolve(__dirname, '../fixtures', fixture),
output: {
path: path.resolve(__dirname, '../outputs'),
filename: '[name].bundle.js',
chunkFilename: '[name].chunk.js',
},
module: {
rules: [
{
test: /\.js$/i,
rules: [
{
loader: path.resolve(__dirname, '../../src'),
options: loaderOptions || {},
},
],
},
],
},
plugins: [],
...config,
};

const compiler = webpack(fullConfig);

if (!config.outputFileSystem) {
const outputFileSystem = memfs;

outputFileSystem.vol.reset();
// Todo remove when we drop webpack@4 support
outputFileSystem.join = path.join.bind(path);

compiler.outputFileSystem = outputFileSystem;
}

return compiler;
};
6 changes: 6 additions & 0 deletions templates/test/helpers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import compile from './compile';
import getCompiler from './getCompiler';
import normalizeErrors from './normalizeErrors';
import readAsset from './readAsset';

export { compile, getCompiler, normalizeErrors, readAsset };
25 changes: 25 additions & 0 deletions templates/test/helpers/normalizeErrors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
function removeCWD(str) {
const isWin = process.platform === 'win32';
let cwd = process.cwd();

if (isWin) {
// eslint-disable-next-line no-param-reassign
str = str.replace(/\\/g, '/');
// eslint-disable-next-line no-param-reassign
cwd = cwd.replace(/\\/g, '/');
}

return str.replace(new RegExp(cwd, 'g'), '');
}

export default (errors) => {
return errors.map((error) =>
removeCWD(
error
.toString()
.split('\n')
.slice(0, 2)
.join('\n')
)
);
};
Loading

0 comments on commit 79861c1

Please sign in to comment.