Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

appBranding.ts

27 lines771 Bytes

1import type { DesktopAppBranding, DesktopAppStageLabel } from "@t3tools/contracts";
2​
3const APP_BASE_NAME = "T3 Code";
4const NIGHTLY_VERSION_PATTERN = /-nightly\.\d{8}\.\d+$/;
5​
6export function resolveDesktopAppStageLabel(input: {
7 readonly isDevelopment: boolean;
8 readonly appVersion: string;
9}): DesktopAppStageLabel {
10 if (input.isDevelopment) {
11 return "Dev";
12 }
13​
14 return NIGHTLY_VERSION_PATTERN.test(input.appVersion) ? "Nightly" : "Alpha";
16​
17export function resolveDesktopAppBranding(input: {
18 readonly isDevelopment: boolean;
19 readonly appVersion: string;
20}): DesktopAppBranding {
21 const stageLabel = resolveDesktopAppStageLabel(input);
22 return {
23 baseName: APP_BASE_NAME,
24 stageLabel,
25 displayName: `${APP_BASE_NAME} (${stageLabel})`,
26 };