migrate to typescript

This commit is contained in:
MaysWind
2024-12-29 14:24:37 +08:00
parent b638a73e4d
commit 2560a70e5e
171 changed files with 3402 additions and 2557 deletions
+42
View File
@@ -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';
}
}