Skip to content

Commit

Permalink
feat: expose parser and writer options
Browse files Browse the repository at this point in the history
  • Loading branch information
s-h-a-d-o-w committed Mar 21, 2022
1 parent 6c75ed0 commit 9370427
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
33 changes: 18 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,6 @@ You can configure `standard-version` either by:
Any of the command line parameters accepted by `standard-version` can instead
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.


### Customizing CHANGELOG Generation

By default (as of `6.0.0`), `standard-version` uses the [conventionalcommits preset](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits).

This preset:

* Adheres closely to the [conventionalcommits.org](https://www.conventionalcommits.org)
specification.
* Is highly configurable, following the configuration specification
[maintained here](https://github.com/conventional-changelog/conventional-changelog-config-spec).
* _We've documented these config settings as a recommendation to other tooling makers._

There are a variety of dials and knobs you can turn related to CHANGELOG generation.

As an example, suppose you're using GitLab, rather than GitHub, you might modify the following variables:

* `commitUrlFormat`: the URL format of commit SHAs detected in commit messages.
Expand All @@ -117,6 +102,24 @@ As an example, suppose you're using GitLab, rather than GitHub, you might modify

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

### Customizing CHANGELOG Generation further

By default (as of `6.0.0`), `standard-version` uses the [conventionalcommits preset](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-conventionalcommits).

This preset adheres closely to the [conventionalcommits.org](https://www.conventionalcommits.org) specification.

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:

```json
{
"standard-version": {
"writerOpts": {
"commitsSort": false
}
}
}
```

## CLI Usage

> **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`.
Expand Down
2 changes: 1 addition & 1 deletion lib/lifecycles/changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function outputChangelog (args, newVersion) {
debug: args.verbose && console.info.bind(console, 'conventional-changelog'),
preset: presetLoader(args),
tagPrefix: args.tagPrefix
}, context, { merges: null, path: args.path })
}, context, { merges: null, path: args.path }, args.parserOpts, args.writerOpts)
.on('error', function (err) {
return reject(err)
})
Expand Down

0 comments on commit 9370427

Please sign in to comment.