···
11
11
"build:web": "vite build",
12
12
"lint": "svelte-check --tsconfig ./tsconfig.json && eslint src && prettier --check src",
13
13
"format": "eslint --fix src && prettier --write src",
14
14
-
"tauri": "tauri"
14
14
+
"tauri": "tauri",
15
15
+
"gen-types": "cargo run -p ferrum_mobile --bin export_ts"
15
16
},
16
17
"license": "MIT",
17
18
"dependencies": {
···
1
1
+
use ferrum_lib::gen_types;
2
2
+
3
3
+
pub fn main() {
4
4
+
gen_types();
5
5
+
}
···
52
52
Ok(tracks)
53
53
}
54
54
55
55
-
#[cfg_attr(mobile, tauri::mobile_entry_point)]
56
56
-
pub fn run() {
57
57
-
#[cfg(target_os = "android")]
58
58
-
android_logger::init_once(
59
59
-
android_logger::Config::default()
60
60
-
.with_max_level(log::LevelFilter::Trace)
61
61
-
.with_tag("{{app.name}}"),
62
62
-
);
55
55
+
Ok(library_tauri)
56
56
+
}
63
57
58
58
+
pub fn gen_types() -> Builder {
64
59
let specta_builder = tauri_specta::Builder::<tauri::Wry>::new()
65
60
.commands(tauri_specta::collect_commands![error_popup, load_library]);
66
61
···
70
65
.export(
71
66
specta_typescript::Typescript::default()
72
67
.bigint(specta_typescript::BigIntExportBehavior::String),
73
73
-
"../bindings.ts",
68
68
+
"./bindings.ts",
74
69
)
75
70
.expect("Failed to export typescript bindings");
71
71
+
specta_builder
72
72
+
}
73
73
+
74
74
+
#[cfg_attr(mobile, tauri::mobile_entry_point)]
75
75
+
pub fn run() {
76
76
+
#[cfg(target_os = "android")]
77
77
+
android_logger::init_once(
78
78
+
android_logger::Config::default()
79
79
+
.with_max_level(log::LevelFilter::Trace)
80
80
+
.with_tag("{{app.name}}"),
81
81
+
);
82
82
+
83
83
+
let specta_builder = gen_types();
76
84
77
85
tauri::Builder::default()
78
86
.plugin(tauri_plugin_fs::init())