diff --git a/packages/_infra/src/version.ts b/packages/_infra/src/version.ts index b9feda701..ecd48ad01 100644 --- a/packages/_infra/src/version.ts +++ b/packages/_infra/src/version.ts @@ -52,7 +52,7 @@ export const VersionUtil = { version(): VersionInfo { if (versionInfo == null) { const info = getGitInfo(); - const version = info.tag == null ? 'HEAD' : info.tag; + const version = (info.tag == null ? `${info.lastTag}-${info.commitsSinceLastTag}` : info.tag) ?? 'HEAD'; const hash = info.sha; versionInfo = { version, hash }; } diff --git a/packages/cli/src/cli/cogify/__test__/semver.test.ts b/packages/cli/src/cli/cogify/__test__/semver.test.ts index 7f2d2cb03..8a79649dd 100644 --- a/packages/cli/src/cli/cogify/__test__/semver.test.ts +++ b/packages/cli/src/cli/cogify/__test__/semver.test.ts @@ -29,6 +29,11 @@ o.spec('VersionCompare', () => { o(SemVer.toNumber('1.1.1') > SemVer.toNumber('1.1.0')).equals(true); o(SemVer.toNumber('2.1.1') > SemVer.toNumber('1.1.0')).equals(true); }); + + o('should support release candidates', () => { + o(SemVer.toNumber('0.0.1-rc1')).equals(1); + o(SemVer.toNumber('1.0.0-rc2')).equals(SemVer.toNumber('1.0.0')); + }); }); o.spec('fromNumber', () => {