Skip to content

Commit

Permalink
feat(conventional-changelog-conventionalcommits): sort groups based o…
Browse files Browse the repository at this point in the history
…n config types (#702) (#1002)
  • Loading branch information
davidgoitia committed Jun 17, 2023
1 parent f251b68 commit 0e59f0c
Showing 1 changed file with 3 additions and 6 deletions.
Expand Up @@ -73,6 +73,8 @@ function findTypeEntry (types, commit) {
function getWriterOpts (config) {
config = defaultConfig(config)

const commitGroupOrder = config.types.flatMap(t => t.section).filter(t => t)

return {
transform: (commit, context) => {
let discard = true
Expand Down Expand Up @@ -160,14 +162,9 @@ function getWriterOpts (config) {
// the groupings of commit messages, e.g., Features vs., Bug Fixes, are
// sorted based on their probable importance:
commitGroupsSort: (a, b) => {
const commitGroupOrder = ['Reverts', 'Performance Improvements', 'Bug Fixes', 'Features']
const gRankA = commitGroupOrder.indexOf(a.title)
const gRankB = commitGroupOrder.indexOf(b.title)
if (gRankA >= gRankB) {
return -1
} else {
return 1
}
return gRankA - gRankB
},
commitsSort: ['scope', 'subject'],
noteGroupsSort: 'title',
Expand Down

0 comments on commit 0e59f0c

Please sign in to comment.