calver-bump 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.js +15 -5
- package/test/release.test.js +2 -0
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -153,6 +153,7 @@ async function releaseNotes(cwd, options = {}) {
|
|
|
153
153
|
const requestUrlBuilder = remoteUrl ? buildRequestUrlBuilder(remoteUrl) : null;
|
|
154
154
|
const allowedTypes = options.types ?? ['feat', 'fix', 'docs', 'style', 'refactor', 'perf', 'test', 'build', 'ci', 'chore', 'revert'];
|
|
155
155
|
const conventionalCommits = commits
|
|
156
|
+
.map((commit) => ({ ...commit, subject: conventionalSubjectForCommit(commit) ?? commit.subject }))
|
|
156
157
|
.filter((commit) => isConventionalCommit(commit.subject))
|
|
157
158
|
.filter((commit) => allowedTypes.includes(conventionalType(commit.subject)))
|
|
158
159
|
.filter((commit) => !isCommitInChangelog(commit, options.existingChangelog ?? ''))
|
|
@@ -186,6 +187,16 @@ function isConventionalCommit(subject) {
|
|
|
186
187
|
return /^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\([^)]+\))?!?: .+/.test(subject);
|
|
187
188
|
}
|
|
188
189
|
|
|
190
|
+
function conventionalSubjectForCommit(commit) {
|
|
191
|
+
return commitLines(commit).find((line) => isConventionalCommit(line)) ?? null;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function commitLines(commit) {
|
|
195
|
+
return [commit.subject, ...(commit.body ?? '').split('\n')]
|
|
196
|
+
.map((line) => line.trim())
|
|
197
|
+
.filter(Boolean);
|
|
198
|
+
}
|
|
199
|
+
|
|
189
200
|
function formatReleaseNotes(changes) {
|
|
190
201
|
if (changes.length === 1 && changes[0] === 'No conventional commits in this release.') {
|
|
191
202
|
return `- ${changes[0]}`;
|
|
@@ -317,13 +328,12 @@ function requestForCommit(commit, requestUrlBuilder) {
|
|
|
317
328
|
}
|
|
318
329
|
|
|
319
330
|
function requestTitleForCommit(commit) {
|
|
320
|
-
|
|
321
|
-
|
|
331
|
+
const conventionalSubject = conventionalSubjectForCommit(commit);
|
|
332
|
+
if (conventionalSubject) {
|
|
333
|
+
return conventionalSubject;
|
|
322
334
|
}
|
|
323
335
|
|
|
324
|
-
return (commit
|
|
325
|
-
.split('\n')
|
|
326
|
-
.map((line) => line.trim())
|
|
336
|
+
return commitLines(commit)
|
|
327
337
|
.find((line) => line && !parseRequestReference(line) && !/^Merge\b/i.test(line)) ?? null;
|
|
328
338
|
}
|
|
329
339
|
|
package/test/release.test.js
CHANGED
|
@@ -269,6 +269,8 @@ test('runRelease links changelog entries to GitLab merge requests and dedupes th
|
|
|
269
269
|
execFileSync('git', [
|
|
270
270
|
'commit',
|
|
271
271
|
'-m',
|
|
272
|
+
'Merge branch feature/review into main',
|
|
273
|
+
'-m',
|
|
272
274
|
'fix(review): block rule-listed reviewers',
|
|
273
275
|
'-m',
|
|
274
276
|
'See merge request platform/demo-app!77',
|