-
Notifications
You must be signed in to change notification settings - Fork 713
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: unified presets interface (#1045)
BREAKING CHANGE: Now all presets are exports preset config factory function. conventional-changelog-preset-loader now exports new loadPreset and createPresetLoader functions. If you are using presets indirectly, using preset name, no any changes in configuration needed, just upgrade packages to latest versions.
- Loading branch information
Showing
114 changed files
with
1,613 additions
and
1,256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
packages/conventional-changelog-angular/conventional-changelog.js
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
packages/conventional-changelog-angular/conventional-recommended-bump.js
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
packages/conventional-changelog-angular/conventionalChangelog.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
'use strict' | ||
|
||
function createConventionalChangelogOpts (parserOpts, writerOpts) { | ||
return { | ||
parserOpts, | ||
writerOpts | ||
} | ||
} | ||
|
||
module.exports.createConventionalChangelogOpts = createConventionalChangelogOpts |
34 changes: 34 additions & 0 deletions
34
packages/conventional-changelog-angular/conventionalRecommendedBump.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use strict' | ||
|
||
function createConventionalRecommendedBumpOpts (parserOpts) { | ||
return { | ||
parserOpts, | ||
|
||
whatBump (commits) { | ||
let level = 2 | ||
let breakings = 0 | ||
let features = 0 | ||
|
||
commits.forEach(commit => { | ||
if (commit.notes.length > 0) { | ||
breakings += commit.notes.length | ||
level = 0 | ||
} else if (commit.type === 'feat') { | ||
features += 1 | ||
if (level === 2) { | ||
level = 1 | ||
} | ||
} | ||
}) | ||
|
||
return { | ||
level: level, | ||
reason: breakings === 1 | ||
? `There is ${breakings} BREAKING CHANGE and ${features} features` | ||
: `There are ${breakings} BREAKING CHANGES and ${features} features` | ||
} | ||
} | ||
} | ||
} | ||
|
||
module.exports.createConventionalRecommendedBumpOpts = createConventionalRecommendedBumpOpts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
'use strict' | ||
const conventionalChangelog = require('./conventional-changelog') | ||
const parserOpts = require('./parser-opts') | ||
const recommendedBumpOpts = require('./conventional-recommended-bump') | ||
const writerOpts = require('./writer-opts') | ||
|
||
module.exports = Promise.all([conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts]) | ||
.then(([conventionalChangelog, parserOpts, recommendedBumpOpts, writerOpts]) => ({ | ||
conventionalChangelog, | ||
|
||
const { createParserOpts } = require('./parserOpts') | ||
const { createWriterOpts } = require('./writerOpts') | ||
const { createConventionalChangelogOpts } = require('./conventionalChangelog') | ||
const { createConventionalRecommendedBumpOpts } = require('./conventionalRecommendedBump') | ||
|
||
async function createPreset () { | ||
const parserOpts = createParserOpts() | ||
const writerOpts = await createWriterOpts() | ||
const recommendedBumpOpts = createConventionalRecommendedBumpOpts(parserOpts) | ||
const conventionalChangelog = createConventionalChangelogOpts(parserOpts, writerOpts) | ||
|
||
return { | ||
parserOpts, | ||
writerOpts, | ||
recommendedBumpOpts, | ||
writerOpts | ||
})) | ||
conventionalChangelog | ||
} | ||
} | ||
|
||
module.exports = createPreset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict' | ||
|
||
function createParserOpts () { | ||
return { | ||
headerPattern: /^(\w*)(?:\((.*)\))?: (.*)$/, | ||
headerCorrespondence: [ | ||
'type', | ||
'scope', | ||
'subject' | ||
], | ||
noteKeywords: ['BREAKING CHANGE'], | ||
revertPattern: /^(?:Revert|revert:)\s"?([\s\S]+?)"?\s*This reverts commit (\w*)\./i, | ||
revertCorrespondence: ['header', 'hash'] | ||
} | ||
} | ||
|
||
module.exports.createParserOpts = createParserOpts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
packages/conventional-changelog-atom/conventional-changelog.js
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
packages/conventional-changelog-atom/conventional-recommended-bump.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.