mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 08:44:25 +08:00
migrate to typescript
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
export function isProduction(): boolean {
|
||||
return __EZBOOKKEEPING_IS_PRODUCTION__;
|
||||
}
|
||||
|
||||
export function getVersion(): string {
|
||||
const isRelease = !getBuildTime();
|
||||
const commitHash = __EZBOOKKEEPING_BUILD_COMMIT_HASH__;
|
||||
let version = __EZBOOKKEEPING_VERSION__;
|
||||
|
||||
if (version && (!isRelease || !isProduction())) {
|
||||
version += '-dev';
|
||||
}
|
||||
|
||||
if (!version) {
|
||||
version = 'unknown';
|
||||
}
|
||||
|
||||
if (commitHash) {
|
||||
version += ` (${commitHash.substring(0, Math.min(7, commitHash.length))})`;
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
export function getBuildTime(): string {
|
||||
return __EZBOOKKEEPING_BUILD_UNIX_TIME__;
|
||||
}
|
||||
|
||||
export function getMobileVersionPath(): string {
|
||||
if (isProduction()) {
|
||||
return '../mobile';
|
||||
} else {
|
||||
return 'mobile.html';
|
||||
}
|
||||
}
|
||||
export function getDesktopVersionPath(): string {
|
||||
if (isProduction()) {
|
||||
return '../desktop';
|
||||
} else {
|
||||
return 'desktop.html';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user