mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 03:29:51 +02:00
branch names
This commit is contained in:
1 parent
c5bb537bf2
commit
5bda754b6e
10 files changed
+22
-124
No files matched your search
@@ -3,19 +3,12 @@ import { STRINGS } from "@blitzkit/i18n";
|
||||
import locales from "@blitzkit/i18n/locales.json";
|
||||
|
||||
export function resolveBranchName(locale: string = locales.default) {
|
||||
if (!(locale in STRINGS)) throw new Error(`Unsupported locale: ${locale}`);
|
||||
|
||||
const strings = STRINGS[locale];
|
||||
const secret = assertSecret(import.meta.env.PUBLIC_BRANCH);
|
||||
const environment = assertSecret(import.meta.env.PUBLIC_ENVIRONMENT);
|
||||
|
||||
if (
|
||||
assertSecret(import.meta.env.MODE) === "development" &&
|
||||
secret === "dev"
|
||||
) {
|
||||
return strings.common.branches.local;
|
||||
} else {
|
||||
return (strings.common.branches as Record<string, string>)[secret] as
|
||||
| string
|
||||
| undefined;
|
||||
}
|
||||
if (environment === "production") return undefined;
|
||||
|
||||
return strings.common.branches[
|
||||
environment as keyof typeof strings.common.branches
|
||||
];
|
||||
}
|
||||
Reference in new issue
Block a user