Skip to content

Commit 2fd449f

Browse files
committed
docs: clarify parserOpts handling
1 parent b94ad00 commit 2fd449f

File tree

1 file changed

+24
-21
lines changed

1 file changed

+24
-21
lines changed

README.md

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,31 @@ Additional options can be set within the plugin definition in `package.json` to
3737
|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------|
3838
| `preset` | [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) preset (possible values: `angular`, `atom`, `codemirror`, `ember`, `eslint`, `express`, `jquery`, `jscs`, `jshint`). | `angular` |
3939
| `config` | NPM package name of a custom [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) preset. | - |
40-
| `releaseRules` | An external module, a path to a module or an `Array` of rules. See [Release rules](#release-rules). | See [Release rules](#release-rules) |
4140
| `parserOpts` | Additional [conventional-commits-parser](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-commits-parser#conventionalcommitsparseroptions) options that will extends ones loaded by `preset` or `config`. See [Parser options](#parser-options). | - |
41+
| `releaseRules` | An external module, a path to a module or an `Array` of rules. See [Release rules](#release-rules). | See [Release rules](#release-rules) |
42+
43+
**Note**: `config` will be overwritten by the values of `preset`. You should use either `preset` or `config`, but not both.
44+
45+
**Note**: Individual properties of `parserOpts` will override ones loaded with an explicitly set `preset` or `config`. If `preset` or `config` are not set, only the properties set in `parserOpts` will be used.
46+
47+
### Parser Options
4248

43-
**NOTE:** `config` will be overwritten by the values of `preset`. You should use either `preset` or `config`, but not both. Individual properties of `parserOpts` will overwrite ones loaded with `preset` or `config`.
49+
Allow to overwrite specific [conventional-commits-parser](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-commits-parser#conventionalcommitsparseroptions) options. This is convenient to use a [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) preset with some customizations without having to create a new module.
50+
51+
The following example uses [Angular convention](https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-angular) but will consider a commit to be a breaking change if [conventional-commits-parser](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-commits-parser) detects a valid `BREAKING CHANGE`, `BREAKING CHANGES` or `BREAKING` section in the commit body. By default the [preset](https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-angular/index.js#L14) checks only for `BREAKING CHANGE` and `BREAKING CHANGES`.
52+
53+
```json
54+
{
55+
"release": {
56+
"analyzeCommits": {
57+
"preset": "angular",
58+
"parserOpts": {
59+
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"],
60+
}
61+
}
62+
}
63+
}
64+
```
4465

4566
### Release Rules
4667

@@ -64,6 +85,7 @@ This is an `Array` of rule objects. A rule object has a `release` property and 1
6485
}
6586
}
6687
```
88+
6789
#### Rules matching
6890

6991
Each commit will be compared with each rule and when it matches, the commit will be associated with the release type in the rule's `release` property. If a commit match multiple rules, the highest release type (`major` > `minor` > `patch`) is associated with the commit.
@@ -153,25 +175,6 @@ module.exports = [
153175
];
154176
```
155177

156-
### Parser Options
157-
158-
Allow to overwrite specific [conventional-commits-parser](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-commits-parser#conventionalcommitsparseroptions) options. This is convenient to use a [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) preset with some customizations without having to create a new module.
159-
160-
The following example uses [Angular convention](https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-angular) but will consider a commit to be a breaking change if [conventional-commits-parser](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-commits-parser) detects a valid `BREAKING CHANGE`, `BREAKING CHANGES` or `BREAKING` section in the commit body. By default the [preset](https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-angular/index.js#L14) checks only for `BREAKING CHANGE` and `BREAKING CHANGES`.
161-
162-
```json
163-
{
164-
"release": {
165-
"analyzeCommits": {
166-
"preset": "angular",
167-
"parserOpts": {
168-
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"],
169-
}
170-
}
171-
}
172-
}
173-
```
174-
175178
## Usage
176179

177180
The plugin is used by default by [semantic-release](https://github.com/semantic-release/semantic-release) so installing it is not necessary and all configuration are optionals.

0 commit comments

Comments
 (0)