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

fix: support BREAKING-CHANGE alongside BREAKING CHANGE #882

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -10,7 +10,7 @@ module.exports = function (config) {
'scope',
'subject'
],
noteKeywords: ['BREAKING CHANGE'],
noteKeywords: ['BREAKING CHANGE', 'BREAKING-CHANGE'],
revertPattern: /^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w*)\./i,
revertCorrespondence: ['header', 'hash'],
issuePrefixes: config.issuePrefixes
Expand Down
3 changes: 2 additions & 1 deletion packages/conventional-commits-parser/README.md
Expand Up @@ -201,7 +201,8 @@ Used to define if `issuePrefixes` should be considered case sensitive.

##### noteKeywords

Type: `array` of `string` or `string` Default: `['BREAKING CHANGE']`
Type: `array` of `string` or `string` Default: `['BREAKING CHANGE',
'BREAKING-CHANGE']`

Keywords for important notes. This value is case **insensitive**. If it's a `string` it will be converted to an `array` separated by a comma.

Expand Down
2 changes: 1 addition & 1 deletion packages/conventional-commits-parser/index.js
Expand Up @@ -21,7 +21,7 @@ function assignOpts (options) {
'resolved'
],
issuePrefixes: ['#'],
noteKeywords: ['BREAKING CHANGE'],
noteKeywords: ['BREAKING CHANGE', 'BREAKING-CHANGE'],
fieldPattern: /^-(.*?)-$/,
revertPattern: /^Revert\s"([\s\S]*)"\s*This reverts commit (\w*)\./,
revertCorrespondence: ['header', 'hash'],
Expand Down
4 changes: 2 additions & 2 deletions packages/conventional-commits-parser/test/parser.spec.js
Expand Up @@ -688,7 +688,7 @@ describe('parser', function () {
const text = expectedText +
'\n' +
'Closes #9462'
options.noteKeywords = ['BREAKING CHANGE']
options.noteKeywords = ['BREAKING CHANGE', 'BREAKING-CHANGE']
reg = regex(options)
const msg = parser(
'fix(core): report duplicate template bindings in templates\n' +
Expand All @@ -710,7 +710,7 @@ describe('parser', function () {
})

it('should not treat it as important notes if there are texts after `noteKeywords`', function () {
options.noteKeywords = ['BREAKING CHANGE']
options.noteKeywords = ['BREAKING CHANGE', 'BREAKING-CHANGE']
reg = regex(options)
const msg = parser(
'fix(core): report duplicate template bindings in templates\n' +
Expand Down
4 changes: 2 additions & 2 deletions packages/conventional-commits-parser/test/regex.spec.js
Expand Up @@ -20,7 +20,7 @@ describe('regex', function () {

it('should match notes with customized pattern', function () {
const reNotes = regex({
noteKeywords: ['BREAKING CHANGE'],
noteKeywords: ['BREAKING CHANGE', 'BREAKING-CHANGE'],
notesPattern: (noteKeywords) => new RegExp('^[\\s|*]*(' + noteKeywords + ')[:\\s]+(?:\\[.*\\] )(.*)', 'i')
}).notes
const notes = 'BREAKING CHANGE: [Do not match this prefix.] This is so important.'
Expand Down Expand Up @@ -62,7 +62,7 @@ describe('regex', function () {

it('should not match if there is text after `noteKeywords`', function () {
const reNotes = regex({
noteKeywords: [' BREAKING CHANGE'],
noteKeywords: ['BREAKING CHANGE', 'BREAKING-CHANGE'],
issuePrefixes: ['#']
}).notes
const match = 'BREAKING CHANGES: Wow.'.match(reNotes)
Expand Down