Skip to content

Commit dd67811

Browse files
committed
feat: add support for title option
1 parent a0f6c89 commit dd67811

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ With this example:
6565
| `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 |
6666
| `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 |
6767
| `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). | - |
68+
| `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) | - |
6869

6970
**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`)
7071

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ async function generateNotes(pluginConfig, context) {
7070
linkCompare: currentTag && previousTag,
7171
issue,
7272
commit,
73+
title: pluginConfig.title,
7374
packageData: ((await readPkgUp({normalize: false, cwd})) || {}).packageJson,
7475
},
7576
{host: hostConfig, linkCompare, linkReferences, commit: commitConfig, issue: issueConfig}

test/integration.test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ test('Set conventional-changelog-writer context', async t => {
5555
issue: 'issues',
5656
commit: 'commit',
5757
packageData: undefined,
58+
title: undefined,
5859
linkReferences: undefined,
5960
});
6061
});
@@ -78,6 +79,7 @@ test('Set conventional-changelog-writer context with package.json', async t => {
7879
host,
7980
owner,
8081
repository,
82+
title: undefined,
8183
previousTag: lastRelease.gitTag,
8284
currentTag: nextRelease.gitTag,
8385
linkCompare: lastRelease.gitTag,
@@ -554,6 +556,16 @@ test('Accept an "issue" option', async t => {
554556
);
555557
});
556558

559+
test('Accept an "title" option', async t => {
560+
const commits = [{hash: '111', message: 'fix(scope1): First fix\n\nresolve #10'}];
561+
const changelog = await generateNotes(
562+
{title: 'release-title'},
563+
{cwd, options: {repositoryUrl: 'https://github.com/owner/repo'}, lastRelease, nextRelease, commits}
564+
);
565+
566+
t.regex(changelog, new RegExp(escape('"release-title"')));
567+
});
568+
557569
test('Ignore malformatted commits and include valid ones', async t => {
558570
const commits = [
559571
{hash: '111', message: 'fix(scope1): First fix'},

0 commit comments

Comments
 (0)