Open History to see the last commit
1import type { DesktopUpdateChannel } from "@t3tools/contracts";
2
3const NIGHTLY_VERSION_PATTERN = /^[^-+]+-nightly\.\d{8}\.\d+$/;
4// They share nightly's branding but are packaged without an update feed (see
5// isDesktopPreviewVersion in scripts/build-desktop-artifact.ts), so the channel
6// a preview install reports is cosmetic: it never checks for updates and no
7// updater feed ever lists a preview release.
8const PRERELEASE_VERSION_PATTERN = /^[^-+]+-(?:nightly|preview)\.\d{8}\.\d+$/;
9
10export function isNightlyDesktopVersion(version: string): boolean {
11 return PRERELEASE_VERSION_PATTERN.test(version);
12}
13
14export function resolveDefaultDesktopUpdateChannel(appVersion: string): DesktopUpdateChannel {
15 return NIGHTLY_VERSION_PATTERN.test(appVersion) ? "nightly" : "latest";
16}