git-conventional-commits
Advanced tools
Comparing version 2.2.0 to 2.3.0
@@ -18,4 +18,3 @@ { | ||
"commitScopes": [], | ||
"releaseTagGlobPattern": "v[0-9]*.[0-9]*.[0-9]*", | ||
"issueRegexPattern": "(^|\\s)#\\d+(\\s|$)" | ||
"releaseTagGlobPattern": "v[0-9]*.[0-9]*.[0-9]*" | ||
}, | ||
@@ -36,3 +35,3 @@ | ||
"perf": "Performance Improvements", | ||
"merge": "Merged Branches", | ||
"merge": "Merges", | ||
"breakingChange": "BREAKING CHANGES" | ||
@@ -43,4 +42,5 @@ }, | ||
"commitRangeUrl": "https://github.com/ACCOUNT/REPOSITORY/compare/%from%...%to%?diff=split", | ||
"issueRegexPattern": "#\\d+", | ||
"issueUrl": "https://github.com/ACCOUNT/REPOSITORY/issues/%issue%" | ||
} | ||
} |
@@ -140,12 +140,15 @@ module.exports = function (config) { | ||
} | ||
let descriptionMarkdown = escapeMarkdown(commit.description); | ||
// replace issue references with links | ||
commit.description.match(config.issueRegex())?.forEach(issueId => { | ||
descriptionMarkdown = descriptionMarkdown.replace(escapeMarkdown(issueId), markdownIssueId(issueId)); | ||
}); | ||
commitMarkdown += ` ${descriptionMarkdown}`; | ||
commitMarkdown += ` ${escapeMarkdown(commit.description)}`; | ||
commitMarkdown += ` (${markdownCommitHash(commit.hash)}`; | ||
if (commit.relatedIssues) { | ||
commit.relatedIssues.forEach(issueId => { | ||
commitMarkdown += `, ${markdownIssueId(issueId)}`; | ||
}); | ||
} | ||
commitMarkdown += ")\n"; | ||
let referencesMarkdown = [markdownCommitHash(commit.hash)]; | ||
// add issue references from body | ||
commit.body.match(config.issueRegex())?.forEach(issueId => { | ||
referencesMarkdown.push(markdownIssueId(issueId)); | ||
}); | ||
commitMarkdown += ` (${referencesMarkdown.join(', ')})\n`; | ||
return commitMarkdown; | ||
@@ -152,0 +155,0 @@ } |
@@ -23,3 +23,4 @@ const fs = require("fs"); | ||
conventionConfig.commitScopes = conventionOverride.commitScopes || conventionConfig.commitScopes; | ||
conventionConfig.issueRegexPattern = conventionOverride.issueRegexPattern || conventionConfig.issueRegexPattern; | ||
// Legacy support convention.issueRegexPattern | ||
config.changelog.issueRegexPattern = conventionOverride.issueRegexPattern || config.changelog.issueRegexPattern; | ||
} | ||
@@ -43,2 +44,3 @@ | ||
changelogConfig.commitRangeUrl = changelogOverride.commitRangeUrl || changelogConfig.commitRangeUrl; | ||
changelogConfig.issueRegexPattern = changelogOverride.issueRegexPattern || changelogConfig.issueRegexPattern; | ||
changelogConfig.issueUrl = changelogOverride.issueUrl || changelogConfig.issueUrl; | ||
@@ -68,3 +70,2 @@ } | ||
commitScopes: null, | ||
issueRegexPattern: null, | ||
}, | ||
@@ -80,3 +81,3 @@ changelog: { | ||
"perf": "Performance Improvements", | ||
"merge": "Merged Branches", | ||
"merge": "Merges", | ||
"breakingChange": "BREAKING CHANGES", | ||
@@ -87,2 +88,3 @@ "?": "???" | ||
commitRangeUrl: null, | ||
issueRegexPattern: null, | ||
issueUrl: null | ||
@@ -105,4 +107,4 @@ } | ||
config.convention.issueRegex = () => RegExp( | ||
"(?<=(^|\\s))" + (config.convention.issueRegexPattern || '(?!)') + "(?=(\\s|$))", | ||
config.changelog.issueRegex = () => RegExp( | ||
"(?<=(^|\\s))" + (config.changelog.issueRegexPattern || '(?!)') + "(?=(\\s|$))", | ||
"mg" | ||
@@ -109,0 +111,0 @@ ); |
@@ -78,5 +78,2 @@ const Git = require("./git"); | ||
// parse issue ids | ||
conventionalCommit.relatedIssues = [commit.subject, commit.body].join("\n\n").match(convention.issueRegex()) || []; | ||
return conventionalCommit; | ||
@@ -83,0 +80,0 @@ } |
{ | ||
"name": "git-conventional-commits", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "git conventional commits util", | ||
@@ -5,0 +5,0 @@ "licence": "GPLv3", |
@@ -45,4 +45,3 @@ # Git Conventional Commits [![Sparkline](https://stars.medv.io/qoomon/git-conventional-commits.svg)](https://stars.medv.io/qoomon/git-conventional-commits) | ||
"commitScopes": [], | ||
"releaseTagGlobPattern": "v[0-9]*.[0-9]*.[0-9]*", | ||
"issueRegexPattern": "(^|\\s)#\\d+(\\s|$)" | ||
"releaseTagGlobPattern": "v[0-9]*.[0-9]*.[0-9]*" | ||
}, | ||
@@ -64,3 +63,3 @@ | ||
"perf": "Performance Improvements", | ||
"merge": "Merged Branches", | ||
"merge": "Merges", | ||
"breakingChange": "BREAKING CHANGES" | ||
@@ -71,2 +70,3 @@ }, | ||
"commitRangeUrl": "https://github.com/ACCOUNT/REPOSITORY/compare/%from%...%to%?diff=split", | ||
"issueRegexPattern": "#\\d+", | ||
"issueUrl": "https://github.com/ACCOUNT/REPOSITORY/issues/%issue%" | ||
@@ -111,3 +111,3 @@ } | ||
* e.g. `{ "feat": "Features", "fix": "Bug Fixes", "breakingChange": "BREAKING CHANGES"}` | ||
* default `{ "feat": "Features", "fix": "Bug Fixes", "merge": "Merged Branches", "breakingChange": "BREAKING CHANGES"}` | ||
* default `{ "feat": "Features", "fix": "Bug Fixes", "merge": "Merges", "breakingChange": "BREAKING CHANGES"}` | ||
* `commitUrl` an URL template for generating markdown links to repository commits | ||
@@ -114,0 +114,0 @@ * `%commit%` commit hash placeholder |
73985
764