git-conventional-commits
Advanced tools
Comparing version 2.1.2 to 2.2.0
@@ -89,3 +89,6 @@ const fs = require("fs"); | ||
config.convention.msgRegex = /^(?<type>\w+)(?:\((?<scope>[^()]+)\))?(?<breaking>!)?:\s*(?<description>.+)/i; | ||
config.convention.msgMergeRegex = /^Merge branch +["'](?<branch>.+)['"]/i; | ||
config.convention.msgMergeRegexList = [ | ||
/^Merge (?<description>.+)/i, // Default Git merge message | ||
/^Merged in (?<description>.+)/i, // Bitbucket merge message e.g. "Merged in team/repository/branch" | ||
]; | ||
config.convention.msgRevertRegex = /^Revert +["'](?<subject>.+)['"]/i; | ||
@@ -92,0 +95,0 @@ config.convention.bodyRevertRegex = /(?<hash>\S+)\.+?$/im; // \S - no white spaces |
@@ -97,6 +97,6 @@ const Git = require("./git"); | ||
} else { | ||
const msgMergeMatch = commit.subject.match(convention.msgMergeRegex); | ||
const msgMergeMatch = getFirstMatch(commit.subject, convention.msgMergeRegexList); | ||
if (msgMergeMatch) { | ||
conventionalSubject.type = 'merge'; | ||
conventionalSubject.description = msgMergeMatch.groups.branch; | ||
conventionalSubject.description = msgMergeMatch.groups.description; | ||
} else { | ||
@@ -136,2 +136,11 @@ const msgRevertMatch = commit.subject.match(convention.msgRevertRegex); | ||
} | ||
function getFirstMatch(string, regexList) { | ||
for (const regex of regexList) { | ||
const match = string.match(regex); | ||
if (match) { | ||
return match; | ||
} | ||
} | ||
} | ||
}; |
{ | ||
"name": "git-conventional-commits", | ||
"version": "2.1.2", | ||
"version": "2.2.0", | ||
"description": "git conventional commits util", | ||
@@ -14,3 +14,3 @@ "licence": "GPLv3", | ||
"dependencies": { | ||
"yargs": "^17.3.1" | ||
"yargs": "^17.6.2" | ||
}, | ||
@@ -17,0 +17,0 @@ "devDependencies": { |
73688
760
Updatedyargs@^17.6.2