[READ-ONLY] Mirror of https://github.com/danielroe/uppt. A composite GitHub Action that turns conventional commits into a draft release PR, tags the PR on merge, and stages publishing to npm via OIDC
github-action npm npmjs oidc staged-publish trusted-publishing
0

Configure Feed

Select the types of activity you want to include in your feed.

feat: handle `0.x.y` versions (#35)

author
Teages
committer
GitHub
date (Jun 4, 2026, 4:28 PM +0100) commit 25e9affe parent 79ae3a6e
+27 -5
+12 -5
scripts/update-changelog.ts
··· 177 177 `Cannot bump version "${version}": expected strict "X.Y.Z" semver. uppt does not currently support prerelease or build-metadata versions.`, 178 178 ) 179 179 } 180 - let [, major, minor, patch] = match.map(Number) as [number, number, number, number, number] 181 - if (bump === 'major') { major += 1; minor = 0; patch = 0 } 182 - else if (bump === 'minor') { minor += 1; patch = 0 } 183 - else { patch += 1 } 184 - return `${major}.${minor}.${patch}` 180 + 181 + let [, x, y, z] = match.map(Number) as [number, number, number, number, number] 182 + 183 + if (x === 0) { 184 + if (bump === 'major') { bump = 'minor' } 185 + else if (bump === 'minor') { bump = 'patch' } 186 + } 187 + 188 + if (bump === 'major') { x += 1; y = 0; z = 0 } 189 + else if (bump === 'minor') { y += 1; z = 0 } 190 + else { z += 1 } 191 + return `${x}.${y}.${z}` 185 192 } 186 193 187 194 function formatChangelog (
+15
test/update-changelog.test.ts
··· 35 35 expect(incVersion('1.2.3', 'major')).toBe('2.0.0') 36 36 }) 37 37 38 + it('maps a major bump in 0.x.y to the minor slot', () => { 39 + expect(incVersion('0.2.3', 'major')).toBe('0.3.0') 40 + }) 41 + 42 + it('maps minor and patch bumps in 0.x.y to the patch slot', () => { 43 + expect(incVersion('0.2.3', 'minor')).toBe('0.2.4') 44 + expect(incVersion('0.2.3', 'patch')).toBe('0.2.4') 45 + }) 46 + 47 + it('supports 0.0.x versions with the same 0.x.y mapping', () => { 48 + expect(incVersion('0.0.3', 'major')).toBe('0.1.0') 49 + expect(incVersion('0.0.3', 'minor')).toBe('0.0.4') 50 + expect(incVersion('0.0.3', 'patch')).toBe('0.0.4') 51 + }) 52 + 38 53 it('throws on a prerelease version', () => { 39 54 expect(() => incVersion('1.2.3-rc.1', 'patch')).toThrowError(/strict "X\.Y\.Z" semver/) 40 55 })