Skip to content

Commit 1b5cf71

Browse files
clydinKeen Yee Liau
authored andcommitted
build: generate valid version when on release commit
1 parent f3b47ae commit 1b5cf71

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/packages.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,10 @@ function _getVersionFromGit(experimental: boolean): string {
164164
const hasLocalChanges = _exec(`git status --porcelain`) != '';
165165
const scmVersionTagRaw = _exec(`git describe --match v[0-9].[0-9].[0-9]* --abbrev=7 --tags`)
166166
.slice(1);
167-
stableVersion = scmVersionTagRaw.replace(/-([0-9]+)-g/, '+$1.')
168-
+ (hasLocalChanges ? '.with-local-changes' : '');
167+
stableVersion = scmVersionTagRaw.replace(/-([0-9]+)-g/, '+$1.');
168+
if (hasLocalChanges) {
169+
stableVersion += stableVersion.includes('+') ? '.with-local-changes' : '+with-local-changes';
170+
}
169171

170172
experimentalVersion = `0.${stableVersion.replace(/^(\d+)\.(\d+)/, (_, major, minor) => {
171173
return '' + (parseInt(major, 10) * 100 + parseInt(minor, 10));

0 commit comments

Comments
 (0)