mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
refactor(website): improve types
This commit is contained in:
parent
be7fe9610f
commit
f0ce728982
@ -1,5 +1,7 @@
|
||||
import rootPackageJson from '../../../../package.json';
|
||||
|
||||
type App = "desktop";
|
||||
|
||||
export type Architecture = 'x64' | 'arm64';
|
||||
|
||||
export type Platform = 'mac' | 'windows' | 'linux';
|
||||
@ -10,8 +12,16 @@ export function buildDesktopDownloadUrl(platform: Platform, format: string, arch
|
||||
return `https://github.com/TriliumNext/Notes/releases/download/${version}/TriliumNextNotes-${version}-${platform}-${architecture}.${format}`;
|
||||
}
|
||||
|
||||
interface DownloadMatrixEntry {
|
||||
title: Record<Architecture, string>;
|
||||
description: Record<Architecture, string>;
|
||||
downloads: Record<string, { recommended?: boolean; name: string }>;
|
||||
}
|
||||
|
||||
type DownloadMatrix = Record<App, Record<Platform, DownloadMatrixEntry>>;
|
||||
|
||||
// Keep compatibility info inline with https://github.com/electron/electron/blob/main/README.md#platform-support.
|
||||
export const downloadMatrix = {
|
||||
export const downloadMatrix: DownloadMatrix = {
|
||||
desktop: {
|
||||
windows: {
|
||||
title: {
|
||||
|
@ -2,7 +2,7 @@
|
||||
import type { Platform } from "$lib/download-helper";
|
||||
import { buildDesktopDownloadUrl, downloadMatrix, getArchitecture } from "$lib/download-helper";
|
||||
|
||||
let architectures = ["x64", "arm64"];
|
||||
let architectures = ["x64", "arm64"] as const;
|
||||
let architecture = getArchitecture();
|
||||
</script>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user