Skip to content

Commit 185a461

Browse files
authored
Merge pull request #37 from s-h-a-d-o-w/feat/expose-parser-writer-opts
feat: expose parser writer opts
2 parents 7b7ed56 + 4bed054 commit 185a461

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

README.md

+16-12
Original file line numberDiff line numberDiff line change
@@ -99,33 +99,37 @@ You can configure `commit-and-tag-version` either by:
9999

100100
- If you are using a `.versionrc.js` your default export must be a configuration object, or a function returning a configuration object.
101101

102-
103-
104102
Any of the command line parameters accepted by `commit-and-tag-version` can instead
105103
be provided via configuration. Please refer to the [conventional-changelog-config-spec](https://github.com/conventional-changelog/conventional-changelog-config-spec/) for details on available configuration options.
106104

107105
### Customizing CHANGELOG Generation
108106

109107
By default, `commit-and-tag-version` uses the [conventionalcommits preset](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits).
110108

111-
This preset:
112-
113-
- Adheres closely to the [conventionalcommits.org](https://www.conventionalcommits.org)
114-
specification.
115-
- Is highly configurable, following the configuration specification
116-
[maintained here](https://github.com/conventional-changelog/conventional-changelog-config-spec).
117-
- _We've documented these config settings as a recommendation to other tooling makers._
118-
119-
There are a variety of dials and knobs you can turn related to CHANGELOG generation.
109+
This preset adheres closely to the [conventionalcommits.org](https://www.conventionalcommits.org) specification.
120110

121-
As an example, suppose you're using GitLab, rather than GitHub, you might modify the following variables:
111+
Suppose you're using GitLab, rather than GitHub, you might modify the following variables:
122112

123113
- `commitUrlFormat`: the URL format of commit SHAs detected in commit messages.
124114
- `compareUrlFormat`: the URL format used to compare two tags.
125115
- `issueUrlFormat`: the URL format used to link to issues.
126116

127117
Making these URLs match GitLab's format, rather than GitHub's.
128118

119+
### Deeper customization
120+
121+
You can override both [parser](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-commits-parser) and [writer](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-writer) options (they will be merged into the preset we just mentioned). As an example, to list commits in the order that they were committed:
122+
123+
```json
124+
{
125+
"standard-version": {
126+
"writerOpts": {
127+
"commitsSort": false
128+
}
129+
}
130+
}
131+
```
132+
129133
## CLI Usage
130134

131135
> **NOTE:** To pass nested configurations to the CLI without defining them in the `package.json` use dot notation as the parameters `e.g. --skip.changelog`.

lib/lifecycles/changelog.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function outputChangelog (args, newVersion) {
3535
debug: args.verbose && console.info.bind(console, 'conventional-changelog'),
3636
preset: presetLoader(args),
3737
tagPrefix: args.tagPrefix
38-
}, context, { merges: null, path: args.path })
38+
}, context, { merges: null, path: args.path }, args.parserOpts, args.writerOpts)
3939
.on('error', function (err) {
4040
return reject(err)
4141
})

0 commit comments

Comments
 (0)