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: add support for title option #189

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
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