Skip to content

Commit

Permalink
feat: add support for title option
Browse files Browse the repository at this point in the history
  • Loading branch information
BrunnerLivio committed Oct 5, 2020
1 parent a0f6c89 commit dd67811
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ With this example:
| `commit` | Keyword used to generate commit links (formatted as `<host>/<owner>/<repository>/<commit>/<commit_sha>`). See [conventional-changelog-writer#commit](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-writer#commit). | `commits` for Bitbucket repositories, `commit` otherwise |
| `issue` | Keyword used to generate issue links (formatted as `<host>/<owner>/<repository>/<issue>/<issue_number>`). See [conventional-changelog-writer#issue](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-writer#issue). | `issue` for Bitbucket repositories, `issues` otherwise |
| `presetConfig` | Additional configuration passed to the [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) preset. Used for example with [conventional-changelog-conventionalcommits](https://github.com/conventional-changelog/conventional-changelog-config-spec/blob/master/versions/2.0.0/README.md). | - |
| `title` | The title of the release. Used for example in the [header template of conventinal-changelog-angular](https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-angular/templates/header.hbs) | - |

**Notes**: in order to use a `preset` it must be installed (for example to use the [eslint preset](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-eslint) you must install it with `npm install conventional-changelog-eslint -D`)

Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ async function generateNotes(pluginConfig, context) {
linkCompare: currentTag && previousTag,
issue,
commit,
title: pluginConfig.title,
packageData: ((await readPkgUp({normalize: false, cwd})) || {}).packageJson,
},
{host: hostConfig, linkCompare, linkReferences, commit: commitConfig, issue: issueConfig}
Expand Down
12 changes: 12 additions & 0 deletions test/integration.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ test('Set conventional-changelog-writer context', async t => {
issue: 'issues',
commit: 'commit',
packageData: undefined,
title: undefined,
linkReferences: undefined,
});
});
Expand All @@ -78,6 +79,7 @@ test('Set conventional-changelog-writer context with package.json', async t => {
host,
owner,
repository,
title: undefined,
previousTag: lastRelease.gitTag,
currentTag: nextRelease.gitTag,
linkCompare: lastRelease.gitTag,
Expand Down Expand Up @@ -554,6 +556,16 @@ test('Accept an "issue" option', async t => {
);
});

test('Accept an "title" option', async t => {
const commits = [{hash: '111', message: 'fix(scope1): First fix\n\nresolve #10'}];
const changelog = await generateNotes(
{title: 'release-title'},
{cwd, options: {repositoryUrl: 'https://github.com/owner/repo'}, lastRelease, nextRelease, commits}
);

t.regex(changelog, new RegExp(escape('"release-title"')));
});

test('Ignore malformatted commits and include valid ones', async t => {
const commits = [
{hash: '111', message: 'fix(scope1): First fix'},
Expand Down

0 comments on commit dd67811

Please sign in to comment.