git-conventional-commits
Advanced tools
Comparing version 2.5.2 to 2.6.0
@@ -70,6 +70,4 @@ module.exports = function (config) { | ||
`## **${releaseName || lastChangelogCommit.hash}**` + | ||
` <sub><sup>${yyyy_mm_dd(lastChangelogCommit.date)} (${changelogCommitRangeMarkdown})</sup></sub>\n`; | ||
` <sub><sup>${yyyy_mm_dd(lastChangelogCommit.date)} (${changelogCommitRangeMarkdown})</sup></sub>\n`; | ||
changelogMarkdown += "\n"; | ||
if (changesSectionCommits.length > 0 || breakingSectionCommits.length > 0) { | ||
@@ -80,6 +78,7 @@ // ------ generate changes section | ||
commitTypes.forEach((commitType) => { | ||
changelogMarkdown += generateMarkdownCommitTypeSection( | ||
commitType, | ||
groupedChangelog[commitType] | ||
); | ||
changelogMarkdown += "\n" + | ||
generateMarkdownCommitTypeSection( | ||
commitType, | ||
groupedChangelog[commitType] | ||
); | ||
}); | ||
@@ -96,3 +95,4 @@ | ||
if (breakingCommits.length) { | ||
changelogMarkdown += generateMarkdownBreakingChangesSection(breakingCommits); | ||
changelogMarkdown += "\n" + | ||
generateMarkdownBreakingChangesSection(breakingCommits); | ||
} | ||
@@ -102,9 +102,15 @@ | ||
if (customMarkdown && customMarkdown.length) { | ||
changelogMarkdown += generateCustomMarkdownSection(customMarkdown); | ||
changelogMarkdown += "\n" + | ||
generateCustomMarkdownSection(customMarkdown); | ||
} | ||
} else { | ||
changelogMarkdown += "*no relevant changes*\n"; | ||
changelogMarkdown += "\n"; | ||
changelogMarkdown += "\n" + | ||
"*no relevant changes*\n"; | ||
} | ||
changelogMarkdown += | ||
"\n" + | ||
"<br>\n" + | ||
"\n"; | ||
return changelogMarkdown; | ||
@@ -115,7 +121,7 @@ }; | ||
const typeSectionHeadline = config.headlines[commitType !== 'undefined' ? commitType : '?'] || commitType; | ||
let typeSectionMarkdown = `### ${typeSectionHeadline}\n`; | ||
let typeSectionMarkdown = `#### ${typeSectionHeadline}\n`; | ||
const groupedCommits = bucketAggregation(commits, commit => commit.scope); | ||
// sorted scopes with undefined scope at front, if present | ||
const commitScopes = Object.keys(groupedCommits).sort((l, r) => { | ||
const scopedCommits = bucketAggregation(commits, commit => commit.scope); | ||
// sort scopes by name with, undefined scope at front, if present | ||
const commitScopes = Object.keys(scopedCommits).sort((l, r) => { | ||
if (l === 'undefined') return -1; | ||
@@ -126,16 +132,22 @@ if (r === 'undefined') return 1; | ||
commitScopes.forEach(scope => { | ||
let scopeSectionMarkdown = ''; | ||
if (scope !== 'undefined') { | ||
scopeSectionMarkdown += `##### \`${scope}\`\n`; | ||
typeSectionMarkdown += "\n"; | ||
} | ||
groupedCommits[scope].forEach(commit => { | ||
scopeSectionMarkdown += `* ${generateMarkdownCommit(commit)}`; | ||
}); | ||
typeSectionMarkdown += scopeSectionMarkdown + "\n"; | ||
typeSectionMarkdown += generateMarkdownScopeSection(scope, scopedCommits[scope]); | ||
}); | ||
return typeSectionMarkdown + "\n"; | ||
return typeSectionMarkdown; | ||
} | ||
function generateMarkdownScopeSection(scope, commits) { | ||
let scopeSectionMarkdown = ''; | ||
if (scope !== 'undefined') { | ||
scopeSectionMarkdown += `##### \`${scope}\`\n`; | ||
} | ||
commits.forEach(commit => { | ||
scopeSectionMarkdown += `* ${generateMarkdownCommit(commit)}`; | ||
}); | ||
return scopeSectionMarkdown; | ||
} | ||
function generateMarkdownCommit(commit) { | ||
@@ -158,4 +170,5 @@ let commitMarkdown = ''; | ||
}); | ||
commitMarkdown += ` (${referencesMarkdown.join(', ')})`; | ||
return commitMarkdown + "\n"; | ||
commitMarkdown += ` (${referencesMarkdown.join(', ')})\n`; | ||
return commitMarkdown; | ||
} | ||
@@ -186,5 +199,6 @@ | ||
breakingChangeMarkdown += "\n"; | ||
changelogMarkdown += breakingChangeMarkdown; | ||
})); | ||
return changelogMarkdown + "\n"; | ||
return changelogMarkdown; | ||
} | ||
@@ -197,3 +211,3 @@ | ||
}); | ||
return changelogMarkdown + "\n"; | ||
return changelogMarkdown; | ||
} | ||
@@ -200,0 +214,0 @@ |
{ | ||
"name": "git-conventional-commits", | ||
"version": "2.5.2", | ||
"version": "2.6.0", | ||
"description": "git conventional commits util", | ||
@@ -5,0 +5,0 @@ "licence": "GPLv3", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75165
749