Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: webpack-contrib/webpack-defaults
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.0.0
Choose a base ref
...
head repository: webpack-contrib/webpack-defaults
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v4.0.0
Choose a head ref

Commits on Dec 12, 2018

  1. Copy the full SHA
    bb43bdf View commit details
  2. Copy the full SHA
    80e5c46 View commit details
  3. Copy the full SHA
    937d51a View commit details
  4. Copy the full SHA
    a03a18b View commit details

Commits on Dec 20, 2018

  1. Copy the full SHA
    11cabb6 View commit details
  2. Copy the full SHA
    acca23e View commit details
  3. Copy the full SHA
    b556659 View commit details
  4. chore(release): 3.0.2

    alexander-akait committed Dec 20, 2018
    Copy the full SHA
    b2d8eb9 View commit details

Commits on Dec 21, 2018

  1. Copy the full SHA
    0a93c3c View commit details
  2. chore(release): 3.0.3

    alexander-akait committed Dec 21, 2018
    Copy the full SHA
    19bd6e3 View commit details
  3. Copy the full SHA
    d9d6aca View commit details

Commits on Dec 22, 2018

  1. Copy the full SHA
    96d1d3c View commit details
  2. chore(release): 3.0.5

    alexander-akait committed Dec 22, 2018
    Copy the full SHA
    54d3478 View commit details

Commits on Feb 12, 2019

  1. Copy the full SHA
    690f7cb View commit details
  2. Copy the full SHA
    5c1a5b8 View commit details
  3. Copy the full SHA
    a2a2fc6 View commit details
  4. Copy the full SHA
    d6c9531 View commit details

Commits on Feb 15, 2019

  1. Copy the full SHA
    3764d3d View commit details
  2. Copy the full SHA
    3f65b87 View commit details
  3. Copy the full SHA
    b859e88 View commit details
  4. Copy the full SHA
    a1a6a50 View commit details
  5. Copy the full SHA
    cece338 View commit details

Commits on Mar 12, 2019

  1. Copy the full SHA
    6addc2d View commit details
  2. Copy the full SHA
    d7429e2 View commit details

Commits on Mar 18, 2019

  1. Copy the full SHA
    7ebf0d2 View commit details
  2. chore(release): 3.1.0

    alexander-akait committed Mar 18, 2019
    Copy the full SHA
    eaa1798 View commit details

Commits on Mar 28, 2019

  1. Copy the full SHA
    6cf19ef View commit details
  2. Copy the full SHA
    4ee960b View commit details
  3. Copy the full SHA
    0d99346 View commit details
  4. chore(release): 3.1.1

    alexander-akait committed Mar 28, 2019
    Copy the full SHA
    d8ceaac View commit details

Commits on Apr 8, 2019

  1. Copy the full SHA
    2d17995 View commit details

Commits on Apr 19, 2019

  1. Copy the full SHA
    cc1525e View commit details
  2. Copy the full SHA
    78f3ad7 View commit details

Commits on Apr 23, 2019

  1. chore(release): 3.1.2

    alexander-akait committed Apr 23, 2019
    Copy the full SHA
    3fe0d9a View commit details

Commits on Apr 26, 2019

  1. feat: migrate on azure pipelines (#172)

    BREAKING CHANGE: now we use `azure-pipelines` for CI
    evilebottnawi authored and alexander-akait committed Apr 26, 2019
    Copy the full SHA
    6f77d5f View commit details
  2. Copy the full SHA
    68ff187 View commit details
  3. Copy the full SHA
    99c6dcf View commit details
  4. chore(release): 4.0.0

    alexander-akait committed Apr 26, 2019
    Copy the full SHA
    310cc2b View commit details
Showing with 3,216 additions and 3,877 deletions.
  1. +1 −4 .eslintrc.js
  2. +1 −0 .gitattributes
  3. +70 −42 .github/CONTRIBUTING.md
  4. +1 −1 .github/ISSUE_TEMPLATE/BUG.md
  5. +0 −5 .prettierrc
  6. +5 −0 .prettierrc.js
  7. +96 −0 CHANGELOG.md
  8. +1 −11 README.md
  9. +201 −0 azure-pipelines.yml
  10. +19 −0 babel.config.js
  11. +3 −0 commitlint.config.js
  12. +0 −16 config.json
  13. +6 −0 husky.config.js
  14. +6 −0 lint-staged.config.js
  15. +2,338 −3,405 package-lock.json
  16. +22 −52 package.json
  17. +10 −4 src/index.js
  18. +0 −8 src/tasks/eslint.js
  19. +2 −1 src/tasks/git.js
  20. +12 −41 src/tasks/package.js
  21. +6 −3 src/tasks/templates.js
  22. +0 −145 templates/.circleci/config.yml
  23. +1 −4 templates/.eslintrc.js
  24. +69 −41 templates/.github/CONTRIBUTING.md
  25. +1 −1 templates/.github/ISSUE_TEMPLATE/BUG.md
  26. +0 −5 templates/.prettierrc
  27. +5 −0 templates/.prettierrc.js
  28. +42 −26 templates/README.md
  29. +0 −41 templates/appveyor.yml
  30. +201 −0 templates/azure-pipelines.yml
  31. +19 −0 templates/babel.config.js
  32. +3 −0 templates/commitlint.config.js
  33. +6 −0 templates/husky.config.js
  34. +6 −0 templates/lint-staged.config.js
  35. +14 −0 templates/test/__snapshots__/loader.test.js.snap
  36. +14 −0 templates/test/__snapshots__/options.test.js.snap
  37. +3 −0 templates/test/__snapshots__/validation.test.js.snap
  38. +8 −0 templates/test/cjs.test.js
  39. +0 −17 templates/test/errors.test.js
  40. +2 −2 templates/test/loader.test.js
  41. +2 −2 templates/test/options.test.js
  42. +15 −0 templates/test/validation.test.js
  43. +5 −0 test/noon.test.js
5 changes: 1 addition & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -3,9 +3,6 @@ module.exports = {
plugins: ['prettier'],
extends: ['@webpack-contrib/eslint-config-webpack'],
rules: {
'prettier/prettier': [
'error',
{ singleQuote: true, trailingComma: 'es5', arrowParens: 'always' },
],
'prettier/prettier': ['error'],
},
};
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
package-lock.json -diff
* text=auto
bin/* eol=lf
yarn.lock -diff
112 changes: 70 additions & 42 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
## Contributing in @webpack-contrib
# Contributing in @webpack-contrib

We'd always love contributions to further improve the webpack / webpack-contrib ecosystem!
We'd always love contributions to further improve the webpack / webpack-contrib ecosystem!
Here are the guidelines we'd like you to follow:

* [Questions and Problems](#question)
* [Issues and Bugs](#issue)
* [Feature Requests](#feature)
* [Pull Request Submission Guidelines](#submit-pr)
* [Commit Message Conventions](#commit)
- [Questions and Problems](#question)
- [Issues and Bugs](#issue)
- [Feature Requests](#feature)
- [Pull Request Submission Guidelines](#submit-pr)
- [Commit Message Conventions](#commit)

### <a name="question"></a> Got a Question or Problem?
## <a name="question"></a> Got a Question or Problem?

Please submit support requests and questions to StackOverflow using the tag [[webpack]](http://stackoverflow.com/tags/webpack).
StackOverflow is better suited for this kind of support though you may also inquire in [Webpack Gitter](https://gitter.im/webpack/webpack).
Please submit support requests and questions to StackOverflow using the tag [[webpack]](http://stackoverflow.com/tags/webpack).
StackOverflow is better suited for this kind of support though you may also inquire in [Webpack Gitter](https://gitter.im/webpack/webpack).
The issue tracker is for bug reports and feature discussions.

### <a name="issue"></a> Found an Issue or Bug?
## <a name="issue"></a> Found an Issue or Bug?

Before you submit an issue, please search the issue tracker, maybe an issue for your problem already exists and the discussion might inform you of workarounds readily available.

@@ -31,13 +31,13 @@ We will be insisting on a minimal reproduce scenario in order to save maintainer

Unfortunately, we are not able to investigate / fix bugs without a minimal reproduction, so if we don't hear back from you we are going to close an issue that doesn't have enough info to be reproduced.

### <a name="feature"></a> Feature Requests?
## <a name="feature"></a> Feature Requests?

You can *request* a new feature by creating an issue on Github.
You can _request_ a new feature by creating an issue on Github.

If you would like to *implement* a new feature, please submit an issue with a proposal for your work `first`, to be sure that particular makes sense for the project.
If you would like to _implement_ a new feature, please submit an issue with a proposal for your work `first`, to be sure that particular makes sense for the project.

### <a name="submit-pr"></a> Pull Request Submission Guidelines
## <a name="submit-pr"></a> Pull Request Submission Guidelines

Before you submit your Pull Request (PR) consider the following guidelines:

@@ -46,9 +46,9 @@ Before you submit your Pull Request (PR) consider the following guidelines:
- Fill out our `Pull Request Template`. Your pull request will not be considered if it is ignored.
- Please sign the `Contributor License Agreement (CLA)` when a pull request is opened. We cannot accept your pull request without this. Make sure you sign with the primary email address associated with your local / github account.

### <a name="commit"></a> Webpack Contrib Commit Conventions
## <a name="commit"></a> Webpack Contrib Commit Conventions

Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
format that includes a **type**, a **scope** and a **subject**:

```
@@ -66,48 +66,56 @@ to read on GitHub as well as in various git tools.

The footer should contain a [closing reference to an issue](https://help.github.com/articles/closing-issues-via-commit-messages/) if any.

Examples:
Examples:

```
docs(readme): update install instructions
```

```
fix: refer to the `entrypoint` instead of the first `module`
```

#### Revert
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit.
### Revert

If the commit reverts a previous commit, it should begin with `revert:`, followed by the header of the reverted commit.
In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.

#### Type
### Type

Must be one of the following:

* **build**: Changes that affect the build system or external dependencies (example scopes: babel, npm)
* **chore**: Changes that fall outside of build / docs that do not effect source code (example scopes: package, defaults)
* **ci**: Changes to our CI configuration files and scripts (example scopes: circleci, travis)
* **docs**: Documentation only changes (example scopes: readme, changelog)
* **feat**: A new feature
* **fix**: A bug fix
* **perf**: A code change that improves performance
* **refactor**: A code change that neither fixes a bug nor adds a feature
* **revert**: Used when reverting a committed change
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons)
* **test**: Addition of or updates to Jest tests

#### Scope
- **build**: Changes that affect the build system or external dependencies (example scopes: babel, npm)
- **chore**: Changes that fall outside of build / docs that do not effect source code (example scopes: package, defaults)
- **ci**: Changes to our CI configuration files and scripts (example scopes: circleci, travis)
- **docs**: Documentation only changes (example scopes: readme, changelog)
- **feat**: A new feature
- **fix**: A bug fix
- **perf**: A code change that improves performance
- **refactor**: A code change that neither fixes a bug nor adds a feature
- **revert**: Used when reverting a committed change
- **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons)
- **test**: Addition of or updates to Jest tests

### Scope

The scope is subjective & depends on the `type` see above. A good example would be a change to a particular class / module.

#### Subject
### Subject

The subject contains a succinct description of the change:

* use the imperative, present tense: "change" not "changed" nor "changes"
* don't capitalize the first letter
* no dot (.) at the end
- use the imperative, present tense: "change" not "changed" nor "changes"
- don't capitalize the first letter
- no dot (.) at the end

### Body

#### Body
Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes".
The body should include the motivation for the change and contrast this with previous behavior.

#### Footer
### Footer

The footer should contain any information about **Breaking Changes** and is also the place to
reference GitHub issues that this commit **Closes**.

@@ -116,9 +124,29 @@ reference GitHub issues that this commit **Closes**.
Example

```
BREAKING CHANGE: Updates to `Chunk.mapModules`.
BREAKING CHANGE: Updates to `Chunk.mapModules`.
This release is not backwards compatible with `Webpack 2.x` due to breaking changes in webpack/webpack#4764
Migration: see webpack/webpack#5225
```
```

## Testing Your Pull Request

You may have the need to test your changes in a real-world project or dependent
module. Thankfully, Github provides a means to do this. Add a dependency to the
`package.json` for such a project as follows:

```json
{
"devDependencies": {
"${package}": "webpack-contrib/${package}#{id}/head"
}
}
```

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

## Thanks

For your interest, time, understanding, and for following this simple guide.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/BUG.md
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ about: Something went awry and you'd like to tell us about it.

```js
// webpack.config.js
// If your bitchin' code blocks are over 20 lines, please paste a link to a gist
// If your code blocks are over 20 lines, please paste a link to a gist
// (https://gist.github.com).
```

5 changes: 0 additions & 5 deletions .prettierrc

This file was deleted.

5 changes: 5 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
singleQuote: true,
trailingComma: 'es5',
arrowParens: 'always',
};
96 changes: 96 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,102 @@

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.

<a name="4.0.0"></a>
# [4.0.0](https://github.com/webpack-contrib/webpack-defaults/compare/v3.1.2...v4.0.0) (2019-04-26)


### Features

* migrate on azure pipelines ([#172](https://github.com/webpack-contrib/webpack-defaults/issues/172)) ([6f77d5f](https://github.com/webpack-contrib/webpack-defaults/commit/6f77d5f))


### BREAKING CHANGES

* now we use `azure-pipelines` for CI



<a name="3.1.2"></a>
## [3.1.2](https://github.com/webpack-contrib/webpack-defaults/compare/v3.1.1...v3.1.2) (2019-04-23)


### Bug Fixes

* replace prepublish npm script with prepare



<a name="3.1.1"></a>
## [3.1.1](https://github.com/webpack-contrib/webpack-defaults/compare/v3.1.0...v3.1.1) (2019-03-28)


### Bug Fixes

* remove `[@babel](https://github.com/babel)/polyfill` due problem with corejs@2 ([4ee960b](https://github.com/webpack-contrib/webpack-defaults/commit/4ee960b))



<a name="3.1.0"></a>
# [3.1.0](https://github.com/webpack-contrib/webpack-defaults/compare/v3.0.5...v3.1.0) (2019-03-18)


### Bug Fixes

* ci test script ([#164](https://github.com/webpack-contrib/webpack-defaults/issues/164)) ([b859e88](https://github.com/webpack-contrib/webpack-defaults/commit/b859e88))
* commit linting ([#166](https://github.com/webpack-contrib/webpack-defaults/issues/166)) ([6addc2d](https://github.com/webpack-contrib/webpack-defaults/commit/6addc2d))


### Features

* `test:only` script ([5c1a5b8](https://github.com/webpack-contrib/webpack-defaults/commit/5c1a5b8))
* add `cjs` test ([#161](https://github.com/webpack-contrib/webpack-defaults/issues/161)) ([d6c9531](https://github.com/webpack-contrib/webpack-defaults/commit/d6c9531))



<a name="3.0.5"></a>
## [3.0.5](https://github.com/webpack-contrib/webpack-defaults/compare/v3.0.3...v3.0.5) (2018-12-22)


### Bug Fixes

* allow failures for canary builds ([#159](https://github.com/webpack-contrib/webpack-defaults/issues/159)) ([96d1d3c](https://github.com/webpack-contrib/webpack-defaults/commit/96d1d3c))
* appveyor job name fro canary tests ([#158](https://github.com/webpack-contrib/webpack-defaults/issues/158)) ([d9d6aca](https://github.com/webpack-contrib/webpack-defaults/commit/d9d6aca))



<a name="3.0.3"></a>
## [3.0.3](https://github.com/webpack-contrib/webpack-defaults/compare/v3.0.2...v3.0.3) (2018-12-21)


### Bug Fixes

* increase nodejs version for canary builds ([#157](https://github.com/webpack-contrib/webpack-defaults/issues/157)) ([0a93c3c](https://github.com/webpack-contrib/webpack-defaults/commit/0a93c3c))



<a name="3.0.2"></a>
## [3.0.2](https://github.com/webpack-contrib/webpack-defaults/compare/v3.0.1...v3.0.2) (2018-12-20)


### Bug Fixes

* relax minimum required nodejs ([#154](https://github.com/webpack-contrib/webpack-defaults/issues/154)) ([11cabb6](https://github.com/webpack-contrib/webpack-defaults/commit/11cabb6))
* relax minimum required webpack version ([#155](https://github.com/webpack-contrib/webpack-defaults/issues/155)) ([acca23e](https://github.com/webpack-contrib/webpack-defaults/commit/acca23e))



<a name="3.0.1"></a>
## [3.0.1](https://github.com/webpack-contrib/webpack-defaults/compare/v3.0.0...v3.0.1) (2018-12-12)


### Bug Fixes

* change job order for appveyor (from low to high `nodejs` version)
* use `node@6` for canary testing on CircleCI
* use `@webpack-contrib/defaults` in package ([bb43bdf](https://github.com/webpack-contrib/webpack-defaults/commit/bb43bdf))



<a name="3.0.0"></a>
# [3.0.0](https://github.com/webpack-contrib/webpack-defaults/compare/v2.6.0...v3.0.0) (2018-12-12)

12 changes: 1 addition & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -15,10 +15,6 @@

Project configuration and boilerplate defaults for webpack projects

## Requirements

This module requires a minimum of Node v6.9.0 and Webpack v4.0.0.

## Getting Started

To begin, you'll need to install `webpack-defaults`:
@@ -46,21 +42,15 @@ Please take a moment to read our contributing guidelines if you haven't yet done

[npm]: https://img.shields.io/npm/v/@webpack-contrib/defaults.svg
[npm-url]: https://npmjs.com/package/@webpack-contrib/defaults

[node]: https://img.shields.io/node/v/@webpack-contrib/defaults.svg
[node-url]: https://nodejs.org

[deps]: https://david-dm.org/webpack-contrib/webpack-defaults.svg
[deps-url]: https://david-dm.org/webpack-contrib/webpack-defaults

[tests]: https://img.shields.io/circleci/project/github/webpack-contrib/webpack-defaults.svg
[tests]: https://img.shields.io/circleci/project/github/webpack-contrib/webpack-defaults.svg
[tests-url]: https://circleci.com/gh/webpack-contrib/webpack-defaults

[cover]: https://codecov.io/gh/webpack-contrib/webpack-defaults/branch/master/graph/badge.svg
[cover-url]: https://codecov.io/gh/webpack-contrib/webpack-defaults

[chat]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg
[chat-url]: https://gitter.im/webpack/webpack

[size]: https://packagephobia.now.sh/badge?p=@webpack-contrib/defaults
[size-url]: https://packagephobia.now.sh/result?p=@webpack-contrib/defaults
201 changes: 201 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
trigger:
- master
- next

jobs:
- job: Lint
pool:
vmImage: ubuntu-16.04
steps:
- task: NodeTool@0
inputs:
versionSpec: ^10.13.0
displayName: 'Install Node.js'
- task: Npm@1
inputs:
command: custom
customCommand: i -g npm@latest
displayName: 'Install latest NPM'
- script: |
node -v
npm -v
displayName: 'Print versions'
- task: Npm@1
inputs:
command: custom
customCommand: ci
displayName: 'Install dependencies'
- script: npm run lint
displayName: 'Run lint'
- script: npm run security
displayName: 'Run NPM audit'
- script: ./node_modules/.bin/commitlint-azure-pipelines
displayName: 'Run lint commit message'

- job: Linux
pool:
vmImage: ubuntu-16.04
strategy:
maxParallel: 5
matrix:
node-12:
node_version: ^12.0.0
webpack_version: latest
node-10:
node_version: ^10.13.0
webpack_version: latest
node-8:
node_version: ^8.9.0
webpack_version: latest
node-6:
node_version: ^6.9.0
webpack_version: latest
node-8-canary:
node_version: ^8.9.0
webpack_version: next
continue_on_error: true
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js $(node_version)'
- task: Npm@1
inputs:
command: custom
customCommand: i -g npm@latest
displayName: 'Install latest NPM'
- script: |
node -v
npm -v
displayName: 'Print versions'
- task: Npm@1
inputs:
command: custom
customCommand: ci
displayName: 'Install dependencies'
- script: npm i webpack@$(webpack_version)
displayName: 'Install "webpack@$(webpack_version)"'
- script: npm run test:coverage -- --ci --reporters="default" --reporters="jest-junit" || $(continue_on_error)
displayName: 'Run tests with coverage'
- task: PublishTestResults@2
inputs:
testRunTitle: 'Linux with Node.js $(node_version)'
testResultsFiles: '**/junit.xml'
condition: succeededOrFailed()
displayName: 'Publish test results'
- script: curl -s https://codecov.io/bash | bash -s -- -t $(CODECOV_TOKEN)
condition: succeededOrFailed()
displayName: 'Submit coverage data to codecov'

- job: macOS
pool:
vmImage: macOS-10.14
strategy:
maxParallel: 5
matrix:
node-12:
node_version: ^12.0.0
webpack_version: latest
node-10:
node_version: ^10.13.0
webpack_version: latest
node-8:
node_version: ^8.9.0
webpack_version: latest
node-6:
node_version: ^6.9.0
webpack_version: latest
node-8-canary:
node_version: ^8.9.0
webpack_version: next
continue_on_error: true
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js $(node_version)'
- task: Npm@1
inputs:
command: custom
customCommand: i -g npm@latest
displayName: 'Install latest NPM'
- script: |
node -v
npm -v
displayName: 'Print versions'
- task: Npm@1
inputs:
command: custom
customCommand: ci
displayName: 'Install dependencies'
- script: npm i webpack@$(webpack_version)
displayName: 'Install "webpack@$(webpack_version)"'
- script: npm run test:coverage -- --ci --reporters="default" --reporters="jest-junit" || $(continue_on_error)
displayName: 'Run tests with coverage'
- task: PublishTestResults@2
inputs:
testRunTitle: 'Linux with Node.js $(node_version)'
testResultsFiles: '**/junit.xml'
condition: succeededOrFailed()
displayName: 'Publish test results'
- script: curl -s https://codecov.io/bash | bash -s -- -t $(CODECOV_TOKEN)
condition: succeededOrFailed()
displayName: 'Submit coverage data to codecov'

- job: Windows
pool:
vmImage: windows-2019
strategy:
maxParallel: 5
matrix:
node-12:
node_version: ^12.0.0
webpack_version: latest
node-10:
node_version: ^10.13.0
webpack_version: latest
node-8:
node_version: ^8.9.0
webpack_version: latest
node-6:
node_version: ^6.9.0
webpack_version: latest
node-8-canary:
node_version: ^8.9.0
webpack_version: next
continue_on_error: true
steps:
- script: 'git config --global core.autocrlf input'
displayName: 'Config git core.autocrlf'
- checkout: self
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js $(node_version)'
- task: Npm@1
inputs:
command: custom
customCommand: i -g npm@latest
displayName: 'Install latest NPM'
- script: |
node -v
npm -v
displayName: 'Print versions'
- task: Npm@1
inputs:
command: custom
customCommand: ci
displayName: 'Install dependencies'
- script: npm i webpack@$(webpack_version)
displayName: 'Install "webpack@$(webpack_version)"'
- script: npm run test:coverage -- --ci --reporters="default" --reporters="jest-junit" || $(continue_on_error)
displayName: 'Run tests with coverage'
- task: PublishTestResults@2
inputs:
testRunTitle: 'Linux with Node.js $(node_version)'
testResultsFiles: '**/junit.xml'
condition: succeededOrFailed()
displayName: 'Publish test results'
- script: curl -s https://codecov.io/bash | bash -s -- -t $(CODECOV_TOKEN)
condition: succeededOrFailed()
displayName: 'Submit coverage data to codecov'
19 changes: 19 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const MIN_BABEL_VERSION = 7;

module.exports = (api) => {
api.assertVersion(MIN_BABEL_VERSION);
api.cache(true);

return {
presets: [
[
'@babel/preset-env',
{
targets: {
node: '6.9.0',
},
},
],
],
};
};
3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
};
16 changes: 0 additions & 16 deletions config.json

This file was deleted.

6 changes: 6 additions & 0 deletions husky.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
hooks: {
'pre-commit': 'lint-staged',
'commit-msg': 'commitlint -E HUSKY_GIT_PARAMS',
},
};
6 changes: 6 additions & 0 deletions lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
ignore: ['package-lock.json'],
linters: {
'*.js': ['eslint --fix', 'git add'],
},
};
5,743 changes: 2,338 additions & 3,405 deletions package-lock.json

Large diffs are not rendered by default.

74 changes: 22 additions & 52 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webpack-defaults",
"version": "3.0.0",
"version": "4.0.0",
"description": "Project configuration and boilerplate defaults for webpack projects",
"license": "MIT",
"repository": "webpack-contrib/webpack-defaults",
@@ -10,32 +10,26 @@
},
"homepage": "https://github.com/webpack-contrib/webpack-defaults",
"bugs": "https://github.com/webpack-contrib/webpack-defaults/issues",
"bin": {
"webpack-defaults": "bin/index.js"
},
"main": "dist/cjs.js",
"engines": {
"node": ">= 6.9.0 <7.0.0 || >= 8.9.0"
"node": ">= 6.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",
"commitlint": "commitlint",
"commitmsg": "commitlint -e $GIT_PARAMS",
"lint": "eslint --cache bin lib src",
"prebuild": "npm run clean",
"prepublish": "npm run build",
"commitlint": "commitlint --from=master",
"lint": "eslint --cache src test",
"prepare": "npm run build",
"release": "standard-version",
"security": "npm audit",
"test": "jest",
"test:only": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --collectCoverageFrom='src/**/*.js' --coverage",
"ci:lint": "npm run lint && npm run security",
"ci:test": "npm run test -- --runInBand",
"ci:coverage": "npm run test:coverage -- --runInBand",
"ci:lint:commits": "commitlint --from=origin/master --to=${CIRCLE_SHA1}",
"defaults": "./bin/index.js"
"pretest": "npm run lint",
"test": "npm run test:coverage",
"defaults": "npm run build && node bin/index.js"
},
"files": [
"bin",
@@ -51,8 +45,10 @@
"dependencies": {
"chalk": "^2.3.0",
"git-username": "^1.0.0",
"loader-utils": "^1.2.3",
"mrm-core": "^3.1.1",
"path-exists": "^3.0.0",
"schema-utils": "^1.0.0",
"user-meta": "^1.0.0"
},
"devDependencies": {
@@ -62,53 +58,27 @@
"@babel/preset-env": "^7.2.0",
"@commitlint/cli": "^7.2.1",
"@commitlint/config-conventional": "^7.1.2",
"@webpack-contrib/defaults": "^2.6.0",
"@webpack-contrib/defaults": "^3.0.5",
"@webpack-contrib/eslint-config-webpack": "^3.0.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.0.1",
"babel-jest": "^24.5.0",
"commitlint-azure-pipelines-cli": "^1.0.1",
"cross-env": "^5.1.1",
"del": "^4.0.0",
"del-cli": "^1.1.0",
"eslint": "^5.10.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-prettier": "^3.0.0",
"husky": "^1.2.0",
"jest": "^23.0.1",
"jest": "^24.5.0",
"jest-junit": "^6.3.0",
"lint-staged": "^8.1.0",
"memory-fs": "^0.4.1",
"pre-commit": "^1.2.2",
"prettier": "^1.9.2",
"standard-version": "^4.2.0",
"webpack": "^4.27.1"
"standard-version": "^5.0.2",
"webpack": "^4.29.6"
},
"keywords": [
"webpack"
],
"babel": {
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "6.9.0"
},
"useBuiltIns": "usage"
}
]
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"*.js": [
"eslint --fix",
"git add"
]
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
}
]
}
14 changes: 10 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -2,16 +2,22 @@

/* eslint-disable no-console, global-require, import/no-dynamic-require */

const chalk = require('chalk');
const fs = require('fs');
const path = require('path');

const config = require('../config.json');
const chalk = require('chalk');

module.exports = function webpackDefaults() {
console.log(chalk.cyan.bold('Synchronizing config files...'));

config.tasks.forEach((task) => {
const tasks = fs
.readdirSync(path.resolve(__dirname, 'tasks'))
.filter((item) => path.extname(item) === '.js');

tasks.forEach((task) => {
const module = require(`./tasks/${task}`);
module(config);

module();
});

console.log();
8 changes: 0 additions & 8 deletions src/tasks/eslint.js

This file was deleted.

3 changes: 2 additions & 1 deletion src/tasks/git.js
Original file line number Diff line number Diff line change
@@ -25,9 +25,10 @@ const gitignore = [
];

const gitattributes = [
'package-lock.json -diff',
'* text=auto',
'bin/* eol=lf',
'yarn.lock -diff',
'package-lock.json -diff',
];

module.exports = () => {
53 changes: 12 additions & 41 deletions src/tasks/package.js
Original file line number Diff line number Diff line change
@@ -16,15 +16,16 @@ const devPackages = [
'standard-version',
'@commitlint/cli',
'@commitlint/config-conventional',
'commitlint-azure-pipelines-cli',
'husky',

// Jest
'jest',
'jest-junit',
'babel-jest',

// Babel
'@babel/cli',
'@babel/polyfill',
'@babel/core',
'@babel/preset-env',

@@ -43,7 +44,7 @@ const devPackages = [
'@webpack-contrib/eslint-config-webpack',
];

module.exports = (config) => {
module.exports = () => {
const { name } = meta;
const github = gitUsername();
const packageName = path.basename(process.cwd());
@@ -64,64 +65,34 @@ module.exports = (config) => {
bugs: `https://github.com/${repository}/issues`,
main: existing.main || 'dist/cjs.js',
engines: {
node: `>= ${config.maintLTS} <7.0.0 || >= ${config.activeLTS}`,
node: `>= 6.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',
commitlint: 'commitlint',
commitmsg: 'commitlint -e $GIT_PARAMS',
commitlint: 'commitlint --from=master',
lint: 'eslint --cache src test',
prebuild: 'npm run clean',
prepublish: 'npm run build',
prepare: 'npm run build',
release: 'standard-version',
security: 'npm audit',
test: 'jest',
'test:only': 'jest',
'test:watch': 'jest --watch',
'test:coverage': "jest --collectCoverageFrom='src/**/*.js' --coverage",
'ci:lint': 'npm run lint && npm run security',
'ci:test': 'npm run test -- --runInBand',
'ci:coverage': 'npm run test:coverage -- --runInBand',
'ci:lint:commits':
'commitlint --from=origin/master --to=${CIRCLE_SHA1}',
defaults: 'webpack-defaults',
pretest: 'npm run lint',
test: 'npm run test:coverage',
defaults: existing.scripts.defaults || 'webpack-defaults',
},
files: existing.files || ['dist/', 'lib/', 'index.js'],
peerDependencies: existing.peerDependencies || { webpack: '^4.3.0' },
peerDependencies: existing.peerDependencies || { webpack: '^4.0.0' },
dependencies: existing.dependencies || {},
devDependencies: existing.devDependencies || {},
keywords: existing.keywords || ['webpack'],
babel: {
presets: [
[
'@babel/preset-env',
{
targets: {
node: config.maintLTS,
},
useBuiltIns: 'usage',
},
],
],
},
husky: {
hooks: {
'pre-commit': 'lint-staged',
},
},
'lint-staged': {
'*.js': ['eslint --fix', 'git add'],
},
commitlint: {
extends: ['@commitlint/config-conventional'],
},
})
.save();

install(packages, { dev: false });
install(devPackages);
// Require for `jest`
install({ 'babel-core': '^7.0.0-bridge.0' });
};
9 changes: 6 additions & 3 deletions src/tasks/templates.js
Original file line number Diff line number Diff line change
@@ -5,14 +5,17 @@ const { copyFiles } = require('mrm-core');

// These files will be overwritten without any confirmation
const files = [
'.circleci/config.yml',
'.github/CODEOWNERS',
'.github/PULL_REQUEST_TEMPLATE.md',
'.github/CONTRIBUTING.md',
'.editorconfig',
'.eslintrc.js',
'.prettierrc',
'appveyor.yml',
'.prettierrc.js',
'azure-pipelines.yml',
'babel.config.js',
'commitlint.config.js',
'husky.config.js',
'lint-staged.config.js',
'LICENSE',
];

145 changes: 0 additions & 145 deletions templates/.circleci/config.yml

This file was deleted.

5 changes: 1 addition & 4 deletions templates/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -3,9 +3,6 @@ module.exports = {
plugins: ['prettier'],
extends: ['@webpack-contrib/eslint-config-webpack'],
rules: {
'prettier/prettier': [
'error',
{ singleQuote: true, trailingComma: 'es5', arrowParens: 'always' },
],
'prettier/prettier': ['error'],
},
};
110 changes: 69 additions & 41 deletions templates/.github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
## Contributing in @webpack-contrib
# Contributing in @webpack-contrib

We'd always love contributions to further improve the webpack / webpack-contrib ecosystem!
We'd always love contributions to further improve the webpack / webpack-contrib ecosystem!
Here are the guidelines we'd like you to follow:

* [Questions and Problems](#question)
* [Issues and Bugs](#issue)
* [Feature Requests](#feature)
* [Pull Request Submission Guidelines](#submit-pr)
* [Commit Message Conventions](#commit)
- [Questions and Problems](#question)
- [Issues and Bugs](#issue)
- [Feature Requests](#feature)
- [Pull Request Submission Guidelines](#submit-pr)
- [Commit Message Conventions](#commit)

### <a name="question"></a> Got a Question or Problem?
## <a name="question"></a> Got a Question or Problem?

Please submit support requests and questions to StackOverflow using the tag [[webpack]](http://stackoverflow.com/tags/webpack).
StackOverflow is better suited for this kind of support though you may also inquire in [Webpack Gitter](https://gitter.im/webpack/webpack).
Please submit support requests and questions to StackOverflow using the tag [[webpack]](http://stackoverflow.com/tags/webpack).
StackOverflow is better suited for this kind of support though you may also inquire in [Webpack Gitter](https://gitter.im/webpack/webpack).
The issue tracker is for bug reports and feature discussions.

### <a name="issue"></a> Found an Issue or Bug?
## <a name="issue"></a> Found an Issue or Bug?

Before you submit an issue, please search the issue tracker, maybe an issue for your problem already exists and the discussion might inform you of workarounds readily available.

@@ -31,13 +31,13 @@ We will be insisting on a minimal reproduce scenario in order to save maintainer

Unfortunately, we are not able to investigate / fix bugs without a minimal reproduction, so if we don't hear back from you we are going to close an issue that doesn't have enough info to be reproduced.

### <a name="feature"></a> Feature Requests?
## <a name="feature"></a> Feature Requests?

You can *request* a new feature by creating an issue on Github.
You can _request_ a new feature by creating an issue on Github.

If you would like to *implement* a new feature, please submit an issue with a proposal for your work `first`, to be sure that particular makes sense for the project.
If you would like to _implement_ a new feature, please submit an issue with a proposal for your work `first`, to be sure that particular makes sense for the project.

### <a name="submit-pr"></a> Pull Request Submission Guidelines
## <a name="submit-pr"></a> Pull Request Submission Guidelines

Before you submit your Pull Request (PR) consider the following guidelines:

@@ -46,9 +46,9 @@ Before you submit your Pull Request (PR) consider the following guidelines:
- Fill out our `Pull Request Template`. Your pull request will not be considered if it is ignored.
- Please sign the `Contributor License Agreement (CLA)` when a pull request is opened. We cannot accept your pull request without this. Make sure you sign with the primary email address associated with your local / github account.

### <a name="commit"></a> Webpack Contrib Commit Conventions
## <a name="commit"></a> Webpack Contrib Commit Conventions

Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
format that includes a **type**, a **scope** and a **subject**:

```
@@ -66,48 +66,56 @@ to read on GitHub as well as in various git tools.

The footer should contain a [closing reference to an issue](https://help.github.com/articles/closing-issues-via-commit-messages/) if any.

Examples:
Examples:

```
docs(readme): update install instructions
```

```
fix: refer to the `entrypoint` instead of the first `module`
```

#### Revert
If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit.
### Revert

If the commit reverts a previous commit, it should begin with `revert:`, followed by the header of the reverted commit.
In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.

#### Type
### Type

Must be one of the following:

* **build**: Changes that affect the build system or external dependencies (example scopes: babel, npm)
* **chore**: Changes that fall outside of build / docs that do not effect source code (example scopes: package, defaults)
* **ci**: Changes to our CI configuration files and scripts (example scopes: circleci, travis)
* **docs**: Documentation only changes (example scopes: readme, changelog)
* **feat**: A new feature
* **fix**: A bug fix
* **perf**: A code change that improves performance
* **refactor**: A code change that neither fixes a bug nor adds a feature
* **revert**: Used when reverting a committed change
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons)
* **test**: Addition of or updates to Jest tests

#### Scope
- **build**: Changes that affect the build system or external dependencies (example scopes: babel, npm)
- **chore**: Changes that fall outside of build / docs that do not effect source code (example scopes: package, defaults)
- **ci**: Changes to our CI configuration files and scripts (example scopes: circleci, travis)
- **docs**: Documentation only changes (example scopes: readme, changelog)
- **feat**: A new feature
- **fix**: A bug fix
- **perf**: A code change that improves performance
- **refactor**: A code change that neither fixes a bug nor adds a feature
- **revert**: Used when reverting a committed change
- **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons)
- **test**: Addition of or updates to Jest tests

### Scope

The scope is subjective & depends on the `type` see above. A good example would be a change to a particular class / module.

#### Subject
### Subject

The subject contains a succinct description of the change:

* use the imperative, present tense: "change" not "changed" nor "changes"
* don't capitalize the first letter
* no dot (.) at the end
- use the imperative, present tense: "change" not "changed" nor "changes"
- don't capitalize the first letter
- no dot (.) at the end

### Body

#### Body
Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes".
The body should include the motivation for the change and contrast this with previous behavior.

#### Footer
### Footer

The footer should contain any information about **Breaking Changes** and is also the place to
reference GitHub issues that this commit **Closes**.

@@ -116,9 +124,29 @@ reference GitHub issues that this commit **Closes**.
Example

```
BREAKING CHANGE: Updates to `Chunk.mapModules`.
BREAKING CHANGE: Updates to `Chunk.mapModules`.
This release is not backwards compatible with `Webpack 2.x` due to breaking changes in webpack/webpack#4764
Migration: see webpack/webpack#5225
```

## Testing Your Pull Request

You may have the need to test your changes in a real-world project or dependent
module. Thankfully, Github provides a means to do this. Add a dependency to the
`package.json` for such a project as follows:

```json
{
"devDependencies": {
"${package}": "webpack-contrib/${package}#{id}/head"
}
}
```

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

## Thanks

For your interest, time, understanding, and for following this simple guide.
2 changes: 1 addition & 1 deletion templates/.github/ISSUE_TEMPLATE/BUG.md
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ about: Something went awry and you'd like to tell us about it.

```js
// webpack.config.js
// If your bitchin' code blocks are over 20 lines, please paste a link to a gist
// If your code blocks are over 20 lines, please paste a link to a gist
// (https://gist.github.com).
```

5 changes: 0 additions & 5 deletions templates/.prettierrc

This file was deleted.

5 changes: 5 additions & 0 deletions templates/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
singleQuote: true,
trailingComma: 'es5',
arrowParens: 'always',
};
68 changes: 42 additions & 26 deletions templates/README.md
Original file line number Diff line number Diff line change
@@ -25,17 +25,21 @@ $ npm install ${package} --save-dev
```

<!-- isLoader ? use(this) : delete(isPlugin) -->

Then add the loader to your `webpack` config. For example:

<!-- isPlugin ? use(this) : delete(isLoader) -->

Then add the plugin to your `webpack` config. For example:

**file.ext**

```js
import file from 'file.ext';
```

<!-- isLoader ? use(this) : delete(isPlugin) -->

**webpack.config.js**

```js
@@ -47,16 +51,17 @@ module.exports = {
use: [
{
loader: `${name.toLowerCase()}-loader`,
options: {...options}
}
]
}
]
}
}
options: { ...options },
},
],
},
],
},
};
```

<!-- isPlugin ? use(this) : delete(isLoader) -->

**webpack.config.js**

```js
@@ -79,39 +84,56 @@ Default: `[type|null]`
[ option description ]

<!-- isLoader ? use(this) : delete(isPlugin) -->

**webpack.config.js**

```js
// in your webpack.config.js
{
loader: `${name.toLowerCase()}-loader`,
options: {
[option]: ''
}
}
module.exports = {
module: {
rules: [
{
loader: `${name.toLowerCase()}-loader`,
options: {
[option]: '',
},
},
],
},
};
```

<!-- isPlugin ? use(this) : delete(isLoader) -->

**webpack.config.js**

```js
// in your webpack.config.js
new `${name}`Plugin({
[option]: ''
})
module.exports = {
plugins: [
new `${name}`Plugin({
[option]: ''
})
]
};
```

## Examples

[ example outline text ]

**webpack.config.js**

```js
// Example setup here..
```

**file.ext**

```js
// Source code here...
```

**bundle.js**

```js
// Bundle code here...
```
@@ -128,21 +150,15 @@ Please take a moment to read our contributing guidelines if you haven't yet done

[npm]: https://img.shields.io/npm/v/${package}.svg
[npm-url]: https://npmjs.com/package/${package}

[node]: https://img.shields.io/node/v/${package}.svg
[node-url]: https://nodejs.org

[deps]: https://david-dm.org/webpack-contrib/${package}.svg
[deps-url]: https://david-dm.org/webpack-contrib/${package}

[tests]: https://img.shields.io/circleci/project/github/webpack-contrib/${package}.svg
[tests-url]: https://circleci.com/gh/webpack-contrib/${package}

[tests]: https://dev.azure.com/webpack-contrib/${package}/_apis/build/status/webpack-contrib.${package}?branchName=master
[tests-url]: https://dev.azure.com/webpack-contrib/${package}/_build/latest?definitionId=2&branchName=master
[cover]: https://codecov.io/gh/webpack-contrib/${package}/branch/master/graph/badge.svg
[cover-url]: https://codecov.io/gh/webpack-contrib/${package}

[chat]: https://img.shields.io/badge/gitter-webpack%2Fwebpack-brightgreen.svg
[chat-url]: https://gitter.im/webpack/webpack

[size]: https://packagephobia.now.sh/badge?p=${package}
[size-url]: https://packagephobia.now.sh/result?p=${package}
41 changes: 0 additions & 41 deletions templates/appveyor.yml

This file was deleted.

201 changes: 201 additions & 0 deletions templates/azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
trigger:
- master
- next

jobs:
- job: Lint
pool:
vmImage: ubuntu-16.04
steps:
- task: NodeTool@0
inputs:
versionSpec: ^10.13.0
displayName: 'Install Node.js'
- task: Npm@1
inputs:
command: custom
customCommand: i -g npm@latest
displayName: 'Install latest NPM'
- script: |
node -v
npm -v
displayName: 'Print versions'
- task: Npm@1
inputs:
command: custom
customCommand: ci
displayName: 'Install dependencies'
- script: npm run lint
displayName: 'Run lint'
- script: npm run security
displayName: 'Run NPM audit'
- script: ./node_modules/.bin/commitlint-azure-pipelines
displayName: 'Run lint commit message'

- job: Linux
pool:
vmImage: ubuntu-16.04
strategy:
maxParallel: 5
matrix:
node-12:
node_version: ^12.0.0
webpack_version: latest
node-10:
node_version: ^10.13.0
webpack_version: latest
node-8:
node_version: ^8.9.0
webpack_version: latest
node-6:
node_version: ^6.9.0
webpack_version: latest
node-8-canary:
node_version: ^8.9.0
webpack_version: next
continue_on_error: true
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js $(node_version)'
- task: Npm@1
inputs:
command: custom
customCommand: i -g npm@latest
displayName: 'Install latest NPM'
- script: |
node -v
npm -v
displayName: 'Print versions'
- task: Npm@1
inputs:
command: custom
customCommand: ci
displayName: 'Install dependencies'
- script: npm i webpack@$(webpack_version)
displayName: 'Install "webpack@$(webpack_version)"'
- script: npm run test:coverage -- --ci --reporters="default" --reporters="jest-junit" || $(continue_on_error)
displayName: 'Run tests with coverage'
- task: PublishTestResults@2
inputs:
testRunTitle: 'Linux with Node.js $(node_version)'
testResultsFiles: '**/junit.xml'
condition: succeededOrFailed()
displayName: 'Publish test results'
- script: curl -s https://codecov.io/bash | bash -s -- -t $(CODECOV_TOKEN)
condition: succeededOrFailed()
displayName: 'Submit coverage data to codecov'

- job: macOS
pool:
vmImage: macOS-10.14
strategy:
maxParallel: 5
matrix:
node-12:
node_version: ^12.0.0
webpack_version: latest
node-10:
node_version: ^10.13.0
webpack_version: latest
node-8:
node_version: ^8.9.0
webpack_version: latest
node-6:
node_version: ^6.9.0
webpack_version: latest
node-8-canary:
node_version: ^8.9.0
webpack_version: next
continue_on_error: true
steps:
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js $(node_version)'
- task: Npm@1
inputs:
command: custom
customCommand: i -g npm@latest
displayName: 'Install latest NPM'
- script: |
node -v
npm -v
displayName: 'Print versions'
- task: Npm@1
inputs:
command: custom
customCommand: ci
displayName: 'Install dependencies'
- script: npm i webpack@$(webpack_version)
displayName: 'Install "webpack@$(webpack_version)"'
- script: npm run test:coverage -- --ci --reporters="default" --reporters="jest-junit" || $(continue_on_error)
displayName: 'Run tests with coverage'
- task: PublishTestResults@2
inputs:
testRunTitle: 'Linux with Node.js $(node_version)'
testResultsFiles: '**/junit.xml'
condition: succeededOrFailed()
displayName: 'Publish test results'
- script: curl -s https://codecov.io/bash | bash -s -- -t $(CODECOV_TOKEN)
condition: succeededOrFailed()
displayName: 'Submit coverage data to codecov'

- job: Windows
pool:
vmImage: windows-2019
strategy:
maxParallel: 5
matrix:
node-12:
node_version: ^12.0.0
webpack_version: latest
node-10:
node_version: ^10.13.0
webpack_version: latest
node-8:
node_version: ^8.9.0
webpack_version: latest
node-6:
node_version: ^6.9.0
webpack_version: latest
node-8-canary:
node_version: ^8.9.0
webpack_version: next
continue_on_error: true
steps:
- script: 'git config --global core.autocrlf input'
displayName: 'Config git core.autocrlf'
- checkout: self
- task: NodeTool@0
inputs:
versionSpec: $(node_version)
displayName: 'Install Node.js $(node_version)'
- task: Npm@1
inputs:
command: custom
customCommand: i -g npm@latest
displayName: 'Install latest NPM'
- script: |
node -v
npm -v
displayName: 'Print versions'
- task: Npm@1
inputs:
command: custom
customCommand: ci
displayName: 'Install dependencies'
- script: npm i webpack@$(webpack_version)
displayName: 'Install "webpack@$(webpack_version)"'
- script: npm run test:coverage -- --ci --reporters="default" --reporters="jest-junit" || $(continue_on_error)
displayName: 'Run tests with coverage'
- task: PublishTestResults@2
inputs:
testRunTitle: 'Linux with Node.js $(node_version)'
testResultsFiles: '**/junit.xml'
condition: succeededOrFailed()
displayName: 'Publish test results'
- script: curl -s https://codecov.io/bash | bash -s -- -t $(CODECOV_TOKEN)
condition: succeededOrFailed()
displayName: 'Submit coverage data to codecov'
19 changes: 19 additions & 0 deletions templates/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const MIN_BABEL_VERSION = 7;

module.exports = (api) => {
api.assertVersion(MIN_BABEL_VERSION);
api.cache(true);

return {
presets: [
[
'@babel/preset-env',
{
targets: {
node: '6.9.0',
},
},
],
],
};
};
3 changes: 3 additions & 0 deletions templates/commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
};
6 changes: 6 additions & 0 deletions templates/husky.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
hooks: {
'pre-commit': 'lint-staged',
'commit-msg': 'commitlint -E HUSKY_GIT_PARAMS',
},
};
6 changes: 6 additions & 0 deletions templates/lint-staged.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
ignore: ['package-lock.json'],
linters: {
'*.js': ['eslint --fix', 'git add'],
},
};
14 changes: 14 additions & 0 deletions templates/test/__snapshots__/loader.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`loader should works 1`] = `
"
/**
* Loader API Version: 2
* Is this in \\"webpack mode\\": true
*/
/**
* Original Source From Loader
*/
console.log('foo');
"
`;
14 changes: 14 additions & 0 deletions templates/test/__snapshots__/options.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`options name true 1`] = `
"
/**
* Loader API Version: 2
* Is this in \\"webpack mode\\": true
*/
/**
* Original Source From Loader
*/
console.log('foo');
"
`;
3 changes: 3 additions & 0 deletions templates/test/__snapshots__/validation.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`validation 1`] = `Array []`;
8 changes: 8 additions & 0 deletions templates/test/cjs.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import src from '../src';
import cjs from '../src/cjs';

describe('cjs', () => {
it('should exported', () => {
expect(cjs).toEqual(src);
});
});
17 changes: 0 additions & 17 deletions templates/test/errors.test.js

This file was deleted.

4 changes: 2 additions & 2 deletions templates/test/loader.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import webpack from './helpers/compiler';

describe('Loader', () => {
test('Defaults', async () => {
describe('loader', () => {
it('should works', async () => {
const config = {
loader: {
test: /\.js$/,
4 changes: 2 additions & 2 deletions templates/test/options.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import webpack from './helpers/compiler';

describe('Options', () => {
describe('options', () => {
describe('name', () => {
test('{Boolean}', async () => {
it('true', async () => {
const config = {
loader: {
test: /\.js$/,
15 changes: 15 additions & 0 deletions templates/test/validation.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import webpack from './helpers/compiler';

it('validation', async () => {
const config = {
loader: {
test: /\.js$/,
options: { name: false },
},
};

const stats = await webpack('fixture.js', config);
const { errors } = stats.toJson();

expect(errors).toMatchSnapshot();
});
5 changes: 5 additions & 0 deletions test/noon.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Noop for eslint

it('noop', () => {
expect(true).toBe(true);
});