Skip to content

Commit 19eb5fc

Browse files
committed
fix: improve tag detection regexps
1 parent 56207b1 commit 19eb5fc

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

scripts/next-version.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ export async function getNextVersion(): Promise<VersionInfo> {
6565

6666
for (const line of commits) {
6767
if (/BREAKING CHANGE|!:/.test(line)) hasBreaking = true
68-
if (/^feat[:(]/.test(line)) hasFeat = true
69-
if (/^fix[:(]/.test(line)) hasFix = true
68+
if (/^feat(?:\([^)]*\))?!?:/.test(line)) hasFeat = true
69+
if (/^fix(?:\([^)]*\))?!?:/.test(line)) hasFix = true
7070
}
7171

7272
const [major = 0, minor = 0, patch = 0] = current.split('.').map(Number)
7373

7474
let next: string
75-
if (hasBreaking && major > 0) {
76-
next = `${major + 1}.0.0`
75+
if (hasBreaking) {
76+
next = major > 0 ? `${major + 1}.0.0` : `${major}.${minor + 1}.0`
7777
} else if (hasFeat) {
7878
next = `${major}.${minor + 1}.0`
7979
} else if (hasFix || commits.length > 0) {

0 commit comments

Comments
 (0)