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

updateChannels.ts

16 lines784 Bytes

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);
13​
14export function resolveDefaultDesktopUpdateChannel(appVersion: string): DesktopUpdateChannel {
15 return NIGHTLY_VERSION_PATTERN.test(appVersion) ? "nightly" : "latest";