Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose parser writer opts #37

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,33 +99,37 @@ You can configure `commit-and-tag-version` either by:

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



Any of the command line parameters accepted by `commit-and-tag-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, `commit-and-tag-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.
This preset adheres closely to the [conventionalcommits.org](https://www.conventionalcommits.org) specification.

As an example, suppose you're using GitLab, rather than GitHub, you might modify the following variables:
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.
- `compareUrlFormat`: the URL format used to compare two tags.
- `issueUrlFormat`: the URL format used to link to issues.

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

### Deeper customization

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