From 3eebb4a8cfa587444cd84db3136a9b0807c34d4f Mon Sep 17 00:00:00 2001 From: Bharath Lakshman Kumar <108531789+BharathxD@users.noreply.github.com> Date: Fri, 23 Aug 2024 14:29:39 +0530 Subject: [PATCH] fix: add types to releases --- src/lib/releases.ts | 76 +++++++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 34 deletions(-) diff --git a/src/lib/releases.ts b/src/lib/releases.ts index dea6041..4989f2a 100644 --- a/src/lib/releases.ts +++ b/src/lib/releases.ts @@ -1,46 +1,54 @@ -export const releases: any = { - WindowsInstaller: "zen.installer.exe", - WindowsInstallerGeneric: "zen.installer-generic.exe", - - WindowsZip: "zen.win-specific.zip", - WindowsZipGeneric: "zen.win-generic.zip", +export const releases = { + WindowsInstaller: "zen.installer.exe", + WindowsInstallerGeneric: "zen.installer-generic.exe", - MacOS: "zen.macos-aarch64.dmg", - MacOSIntel: "zen.macos-x64.dmg", + WindowsZip: "zen.win-specific.zip", + WindowsZipGeneric: "zen.win-generic.zip", - Linux: "zen.linux-specific.tar.bz2", - LinuxGeneric: "zen.linux-generic.tar.bz2", + MacOS: "zen.macos-aarch64.dmg", + MacOSIntel: "zen.macos-x64.dmg", - LinuxAppImage: "zen-specific.AppImage", - LinuxAppImageGeneric: "zen-generic.AppImage", -}; + Linux: "zen.linux-specific.tar.bz2", + LinuxGeneric: "zen.linux-generic.tar.bz2", + + LinuxAppImage: "zen-specific.AppImage", + LinuxAppImageGeneric: "zen-generic.AppImage", +} as const; // platform // -> arch // -> file export const releaseTree: any = { - windows: { - specific: { - installer: "WindowsInstaller", - portable: "WindowsZip", - }, - generic: { - installer: "WindowsInstallerGeneric", - portable: "WindowsZipGeneric", - }, + windows: { + specific: { + installer: "WindowsInstaller", + portable: "WindowsZip", }, - macos: { - generic: "MacOSIntel", - specific: "MacOS", + generic: { + installer: "WindowsInstallerGeneric", + portable: "WindowsZipGeneric", }, - linux: { - specific: { - portable: "Linux", - appimage: "LinuxAppImage", - }, - generic: { - portable: "LinuxGeneric", - appimage: "LinuxAppImageGeneric", - }, + }, + macos: { + generic: "MacOSIntel", + specific: "MacOS", + }, + linux: { + specific: { + portable: "Linux", + appimage: "LinuxAppImage", }, + generic: { + portable: "LinuxGeneric", + appimage: "LinuxAppImageGeneric", + }, + }, }; + +type Platform = "Windows" | "MacOS" | "Linux"; +type Architecture = "specific" | "generic"; + +type WindowsDownloadType = "installer" | "portable"; +type LinuxDownloadType = "portable" | "appimage" | "flatpak"; + +export type { Platform, Architecture, WindowsDownloadType, LinuxDownloadType };