From 1a103de2f1ef75cd73347953cbe27e14606df871 Mon Sep 17 00:00:00 2001 From: 苏向夜 Date: Wed, 18 Feb 2026 15:08:40 +0800 Subject: refactor(client): rewrite macros to generate client --- src-tauri/src/core/game_version.rs | 50 ++++++++------------------------------ 1 file changed, 10 insertions(+), 40 deletions(-) (limited to 'src-tauri/src/core/game_version.rs') diff --git a/src-tauri/src/core/game_version.rs b/src-tauri/src/core/game_version.rs index 7df631a..82196bd 100644 --- a/src-tauri/src/core/game_version.rs +++ b/src-tauri/src/core/game_version.rs @@ -4,10 +4,7 @@ use ts_rs::TS; /// Represents a Minecraft version JSON, supporting both vanilla and modded (Fabric/Forge) formats. /// Modded versions use `inheritsFrom` to reference a parent vanilla version. #[derive(Debug, Deserialize, Serialize, Clone, TS)] -#[ts( - export, - export_to = "../../packages/ui-new/src/types/bindings/game_version.ts" -)] +#[ts(export, export_to = "game-version.ts")] pub struct GameVersion { pub id: String, /// Optional for mod loaders that inherit from vanilla @@ -34,20 +31,14 @@ pub struct GameVersion { } #[derive(Debug, Deserialize, Serialize, Clone, TS)] -#[ts( - export, - export_to = "../../packages/ui-new/src/types/bindings/game_version.ts" -)] +#[ts(export, export_to = "game-version.ts")] pub struct Downloads { pub client: DownloadArtifact, pub server: Option, } #[derive(Debug, Deserialize, Serialize, Clone, TS)] -#[ts( - export, - export_to = "../../packages/ui-new/src/types/bindings/game_version.ts" -)] +#[ts(export, export_to = "game-version.ts")] pub struct DownloadArtifact { pub sha1: Option, pub size: Option, @@ -56,10 +47,7 @@ pub struct DownloadArtifact { } #[derive(Debug, Deserialize, Serialize, Clone, TS)] -#[ts( - export, - export_to = "../../packages/ui-new/src/types/bindings/game_version.ts" -)] +#[ts(export, export_to = "game-version.ts")] pub struct AssetIndex { pub id: String, pub sha1: String, @@ -70,10 +58,7 @@ pub struct AssetIndex { } #[derive(Debug, Deserialize, Serialize, Clone, TS)] -#[ts( - export, - export_to = "../../packages/ui-new/src/types/bindings/game_version.ts" -)] +#[ts(export, export_to = "game-version.ts")] pub struct Library { pub downloads: Option, pub name: String, @@ -85,10 +70,7 @@ pub struct Library { } #[derive(Debug, Deserialize, Serialize, Clone, TS)] -#[ts( - export, - export_to = "../../packages/ui-new/src/types/bindings/game_version.ts" -)] +#[ts(export, export_to = "game-version.ts")] pub struct Rule { pub action: String, // "allow" or "disallow" pub os: Option, @@ -97,10 +79,7 @@ pub struct Rule { } #[derive(Debug, Deserialize, Serialize, Clone, TS)] -#[ts( - export, - export_to = "../../packages/ui-new/src/types/bindings/game_version.ts" -)] +#[ts(export, export_to = "game-version.ts")] pub struct OsRule { pub name: Option, // "linux", "osx", "windows" pub version: Option, // Regex @@ -108,10 +87,7 @@ pub struct OsRule { } #[derive(Debug, Deserialize, Serialize, Clone, TS)] -#[ts( - export, - export_to = "../../packages/ui-new/src/types/bindings/game_version.ts" -)] +#[ts(export, export_to = "game-version.ts")] pub struct LibraryDownloads { pub artifact: Option, #[ts(type = "Record")] @@ -119,10 +95,7 @@ pub struct LibraryDownloads { } #[derive(Debug, Deserialize, Serialize, Clone, TS)] -#[ts( - export, - export_to = "../../packages/ui-new/src/types/bindings/game_version.ts" -)] +#[ts(export, export_to = "game-version.ts")] pub struct Arguments { #[ts(type = "Record")] pub game: Option, @@ -131,10 +104,7 @@ pub struct Arguments { } #[derive(Debug, Deserialize, Serialize, Clone, TS)] -#[ts( - export, - export_to = "../../packages/ui-new/src/types/bindings/game_version.ts" -)] +#[ts(export, export_to = "game-version.ts")] pub struct JavaVersion { pub component: String, #[serde(rename = "majorVersion")] -- cgit v1.2.3-70-g09d2