Skip to content

Commit

Permalink
feat: re-use parser options within each preset (#335)
Browse files Browse the repository at this point in the history
Re-use the same preset options object between the `conventional-changelog`
configuration object and the `conventional-recommended-bump` configuration
object.

This will improve alignment of behavior between `conventional-changelog`
libraries.

BREAKING CHANGE:

Re-use parser options object between components of a preset. For some
presets this may change the behavior of `conventional-recommended-bump`
as the parser options object for the `conventional-recommended-bump` options
within a preset were different than the parser options object for the
`conventional-changelog` options within a preset.

If you are not using `conventional-recommended-bump`, then this is
**not** a breaking change for you.

Related to #241
  • Loading branch information
hutson committed Jun 6, 2018
1 parent a5e9f0f commit d3eaacf
Show file tree
Hide file tree
Showing 11 changed files with 157 additions and 447 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
'use strict'

const parserOpts = require(`./parser-opts`)

module.exports = {
parserOpts,

whatBump: (commits) => {
let level = 2
let breakings = 0
Expand All @@ -24,17 +28,5 @@ module.exports = {
? `There is ${breakings} BREAKING CHANGE and ${features} features`
: `There are ${breakings} BREAKING CHANGES and ${features} features`
}
},

parserOpts: {
headerPattern: /^(\w*)(?:\((.*)\))?: (.*)$/,
headerCorrespondence: [
`type`,
`scope`,
`subject`
],
noteKeywords: `BREAKING CHANGE`,
revertPattern: /^revert:\s([\s\S]*?)\s*This reverts commit (\w*)\./,
revertCorrespondence: [`header`, `hash`]
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
'use strict'

const parserOpts = require(`./parser-opts`)

module.exports = {
parserOpts,

whatBump: (commits) => {
let level = 2
let breakings = 0
Expand All @@ -22,17 +26,5 @@ module.exports = {
level: level,
reason: `There are ${breakings} BREAKING CHANGES and ${features} features`
}
},

parserOpts: {
headerPattern: /^(\w*)(?:\((.*)\))?: (.*)$/,
headerCorrespondence: [
`type`,
`scope`,
`subject`
],
noteKeywords: `BREAKING CHANGE`,
revertPattern: /^revert:\s([\s\S]*?)\s*This reverts commit (\w*)\./,
revertCorrespondence: [`header`, `hash`]
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
'use strict'

const parserOpts = require(`./parser-opts`)

module.exports = {
parserOpts,

whatBump: (commits) => {
let level = 2
let breakings = 0
Expand All @@ -22,16 +26,5 @@ module.exports = {
level: level,
reason: `There are ${breakings} BREAKING CHANGES and ${features} features`
}
},
parserOpts: {
headerPattern: /^(\w*)(?:\((.*)\))?: (.*)$/,
headerCorrespondence: [
`type`,
`scope`,
`subject`
],
noteKeywords: `BREAKING CHANGE`,
revertPattern: /^revert:\s([\s\S]*?)\s*This reverts commit (\w*)\./,
revertCorrespondence: [`header`, `hash`]
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
'use strict'

const parserOpts = require(`./parser-opts`)

module.exports = {
parserOpts,

whatBump: (commits) => {
let level = 2
let breakings = 0
Expand All @@ -22,17 +26,5 @@ module.exports = {
level: level,
reason: `There are ${breakings} BREAKING CHANGES and ${features} features`
}
},

parserOpts: {
headerPattern: /^(\w*)(?:\((.*)\))?: (.*)$/,
headerCorrespondence: [
`type`,
`scope`,
`subject`
],
noteKeywords: `BREAKING CHANGE`,
revertPattern: /^revert:\s([\s\S]*?)\s*This reverts commit (\w*)\./,
revertCorrespondence: [`header`, `hash`]
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
'use strict'

const parserOpts = require(`./parser-opts`)

module.exports = {
parserOpts,

whatBump: commits => {
let level = 2
let breakings = 0
Expand All @@ -26,14 +30,5 @@ module.exports = {
level: level,
reason: `There are ${breakings} breaking changes and ${features} features`
}
},
parserOpts: {
headerPattern: /^(\w*): (.*)$/,
headerCorrespondence: [
'type',
'subject'
],
revertPattern: /^[rR]evert:\s([\s\S]*?)\s*This reverts commit (\w*)\./,
revertCorrespondence: ['header', 'hash']
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
'use strict'

const parserOpts = require(`./parser-opts`)

module.exports = {
parserOpts,

whatBump: (commits) => {
let level = 2
let breakings = 0
Expand All @@ -22,17 +26,5 @@ module.exports = {
level: level,
reason: `There are ${breakings} BREAKING CHANGES and ${features} features`
}
},

parserOpts: {
headerPattern: /^(\w*)(?:\((.*)\))?: (.*)$/,
headerCorrespondence: [
`type`,
`scope`,
`subject`
],
noteKeywords: `BREAKING CHANGE`,
revertPattern: /^revert:\s([\s\S]*?)\s*This reverts commit (\w*)\./,
revertCorrespondence: [`header`, `hash`]
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
'use strict'

const parserOpts = require(`./parser-opts`)

module.exports = {
parserOpts,

whatBump: (commits) => {
let level = 2
let breakings = 0
Expand All @@ -22,17 +26,5 @@ module.exports = {
level: level,
reason: `There are ${breakings} BREAKING CHANGES and ${features} features`
}
},

parserOpts: {
headerPattern: /^(\w*)(?:\((.*)\))?: (.*)$/,
headerCorrespondence: [
`type`,
`scope`,
`subject`
],
noteKeywords: `BREAKING CHANGE`,
revertPattern: /^revert:\s([\s\S]*?)\s*This reverts commit (\w*)\./,
revertCorrespondence: [`header`, `hash`]
}
}

0 comments on commit d3eaacf

Please sign in to comment.