show "-dev" after the version number when the build version is not a release version

This commit is contained in:
MaysWind
2024-04-06 17:05:04 +08:00
parent cfc7a5bd49
commit 176d5a15c5
+14 -5
View File
@@ -3,14 +3,23 @@ export function isProduction() {
}
export function getVersion() {
let version = __EZBOOKKEEPING_VERSION__ || 'unknown'; // eslint-disable-line
let commitHash = __EZBOOKKEEPING_BUILD_COMMIT_HASH__; // eslint-disable-line
const isRelease = !getBuildTime();
const commitHash = __EZBOOKKEEPING_BUILD_COMMIT_HASH__; // eslint-disable-line
let version = __EZBOOKKEEPING_VERSION__; // eslint-disable-line
if (version && (!isRelease || !isProduction())) {
version += '-dev';
}
if (!version) {
version = 'unknown';
}
if (commitHash) {
return `${version} (${commitHash.substring(0, Math.min(7, commitHash.length))})`
} else {
return version;
version += ` (${commitHash.substring(0, Math.min(7, commitHash.length))})`;
}
return version;
}
export function getBuildTime() {