* @param rawGitCommits * @returns {Map } - Map of commit message to [commit info, version]
(rawGitCommits)
| 72 | * @returns {Map<string, [string, string]>} - Map of commit message to [commit info, version] |
| 73 | */ |
| 74 | function collectCommitsAsMap(rawGitCommits) { |
| 75 | const commits = toArray(rawGitCommits); |
| 76 | const commitsMap = new Map(); |
| 77 | let version = initialVersion; |
| 78 | commits.reverse().forEach((commit) => { |
| 79 | const ignore = shouldIgnoreCommit(commit, ignoreCommitPatterns); |
| 80 | // Keep track of the current version while going though the list of commits, so that we can use |
| 81 | // this information in the output (i.e. display a version when a commit was introduced). |
| 82 | version = maybeExtractReleaseVersion(commit) || version; |
| 83 | if (!ignore) { |
| 84 | // Extract original commit description from commit message, so that we can find matching |
| 85 | // commit in other commit range. For example, for the following commit message: |
| 86 | // |
| 87 | // 15d3e741e9 feat: update the locale files (#33556) |
| 88 | // |
| 89 | // we extract only "feat: update the locale files" part and use it as a key, since commit SHA |
| 90 | // and PR number may be different for the same commit in main and patch branches. |
| 91 | const key = commit |
| 92 | .slice(11) |
| 93 | .replace(/\(\#\d+\)/g, '') |
| 94 | .trim(); |
| 95 | commitsMap.set(key, [commit, version]); |
| 96 | } |
| 97 | }); |
| 98 | return commitsMap; |
| 99 | } |
| 100 | |
| 101 | function getCommitInfoAsString(version, commitInfo) { |
| 102 | const formattedVersion = version === initialVersion ? version : `${version}+`; |
no test coverage detected
searching dependent graphs…