Open History to see the last commit
1const NIGHTLY_SERVER_VERSION_PATTERN = /-nightly\.\d{8}\.\d+$/;
2
3export function formatAppDisplayName(input: {
4 readonly baseName: string;
5 readonly stageLabel: string;
6}): string {
7 return `${input.baseName} (${input.stageLabel})`;
8}
9
10export function resolveServerBackedAppStageLabel(input: {
11 readonly primaryServerVersion: string | null | undefined;
12 readonly fallbackStageLabel: string;
13}): string {
14 return input.primaryServerVersion &&
15 NIGHTLY_SERVER_VERSION_PATTERN.test(input.primaryServerVersion)
16 ? "Nightly"
17 : input.fallbackStageLabel;
18}
19
20export function resolveServerBackedAppDisplayName(input: {
21 readonly baseName: string;
22 readonly fallbackDisplayName: string;
23 readonly fallbackStageLabel: string;
24 readonly primaryServerVersion: string | null | undefined;
25}): string {
26 const stageLabel = resolveServerBackedAppStageLabel({
27 primaryServerVersion: input.primaryServerVersion,
28 fallbackStageLabel: input.fallbackStageLabel,
29 });
30
31 return stageLabel === input.fallbackStageLabel
32 ? input.fallbackDisplayName
33 : formatAppDisplayName({ baseName: input.baseName, stageLabel });
34}