aboutsummaryrefslogtreecommitdiff
path: root/src-tauri/src
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2023-02-05 15:53:34 +0100
committerGitHub <noreply@github.com>2023-02-05 15:53:34 +0100
commit802d7dfee77a3f58ee14a7ef6e2454e5aae62cbb (patch)
tree1c63107fafa7b535acd1a31a2e317e7535f85b62 /src-tauri/src
parent24cabc6019e702ac888a33311532a9832863b572 (diff)
downloadFlightCore-802d7dfee77a3f58ee14a7ef6e2454e5aae62cbb.tar.gz
FlightCore-802d7dfee77a3f58ee14a7ef6e2454e5aae62cbb.zip
feat: Auto-generate TS bindings (#140)
* feat: Initial trial to auto-generate TS bindings That way instead of manually duplicating code, we can just run `cargo test` to generate them. * fix: Update forgotten imports * refactor: Move FlightCoreVersion to autogen bind TypeScript binding autogenerated from Rust code * refactor: Move ReleaseInfo to autogen binding TypeScript binding autogenerated from Rust code * docs: Explain how to generate TS binds from Rust * feat: Check for binding changes in CI Checks for uncommitted binding changes in CI and fails if they differ * style: Formatting fixes
Diffstat (limited to 'src-tauri/src')
-rw-r--r--src-tauri/src/github/release_notes.rs7
-rw-r--r--src-tauri/src/lib.rs4
2 files changed, 8 insertions, 3 deletions
diff --git a/src-tauri/src/github/release_notes.rs b/src-tauri/src/github/release_notes.rs
index 758f7ace..6dee4576 100644
--- a/src-tauri/src/github/release_notes.rs
+++ b/src-tauri/src/github/release_notes.rs
@@ -1,15 +1,18 @@
use crate::constants::APP_USER_AGENT;
use serde::{Deserialize, Serialize};
use std::vec::Vec;
+use ts_rs::TS;
-#[derive(Serialize, Deserialize, Debug, Clone)]
+#[derive(Serialize, Deserialize, Debug, Clone, TS)]
+#[ts(export)]
pub struct ReleaseInfo {
pub name: String,
pub published_at: String,
pub body: String,
}
-#[derive(Serialize, Deserialize, Debug, Clone)]
+#[derive(Serialize, Deserialize, Debug, Clone, TS)]
+#[ts(export)]
pub struct FlightCoreVersion {
tag_name: String,
published_at: String,
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 62cc07ae..e43e5935 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -13,6 +13,7 @@ use platform_specific::linux;
use serde::{Deserialize, Serialize};
use sysinfo::SystemExt;
+use ts_rs::TS;
use zip::ZipArchive;
use northstar::get_northstar_version_number;
@@ -31,7 +32,8 @@ pub struct GameInstall {
pub install_type: InstallType,
}
-#[derive(Serialize, Deserialize, Debug, Clone)]
+#[derive(Serialize, Deserialize, Debug, Clone, TS)]
+#[ts(export)]
pub struct NorthstarMod {
pub name: String,
pub thunderstore_mod_string: Option<String>,