From 937042769391e329eda453b2981dfb3ce98e7f64 Mon Sep 17 00:00:00 2001 From: Andreas Opferkuch Date: Mon, 21 Mar 2022 19:58:35 +0100 Subject: [PATCH 1/2] feat: expose parser and writer options --- README.md | 33 ++++++++++++++++++--------------- lib/lifecycles/changelog.js | 2 +- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index f924f6073..93f7ce3c6 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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`. diff --git a/lib/lifecycles/changelog.js b/lib/lifecycles/changelog.js index f3977f9a8..2069da9ff 100644 --- a/lib/lifecycles/changelog.js +++ b/lib/lifecycles/changelog.js @@ -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) }) From 24428080b1e2a14dfaa1fda76589a33376b93fd4 Mon Sep 17 00:00:00 2001 From: Andreas Opferkuch Date: Wed, 10 Aug 2022 11:23:04 +0200 Subject: [PATCH 2/2] docs: tweak them a bit --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 93f7ce3c6..ecf4db9c3 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,13 @@ 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. -As an example, suppose you're using GitLab, rather than GitHub, you might modify the following variables: +### 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. + +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. @@ -102,11 +108,7 @@ 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. +### 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: