mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-19 17:24:26 +08:00
show "-dev" after the version number when the build version is not a release version
This commit is contained in:
+14
-5
@@ -3,14 +3,23 @@ export function isProduction() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getVersion() {
|
export function getVersion() {
|
||||||
let version = __EZBOOKKEEPING_VERSION__ || 'unknown'; // eslint-disable-line
|
const isRelease = !getBuildTime();
|
||||||
let commitHash = __EZBOOKKEEPING_BUILD_COMMIT_HASH__; // eslint-disable-line
|
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) {
|
if (commitHash) {
|
||||||
return `${version} (${commitHash.substring(0, Math.min(7, commitHash.length))})`
|
version += ` (${commitHash.substring(0, Math.min(7, commitHash.length))})`;
|
||||||
} else {
|
|
||||||
return version;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getBuildTime() {
|
export function getBuildTime() {
|
||||||
|
|||||||
Reference in New Issue
Block a user