Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): show number of commits since last tag #836

Merged
merged 1 commit into from
Jun 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/_infra/src/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
}
Expand Down
5 changes: 5 additions & 0 deletions packages/cli/src/cli/cogify/__test__/semver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down