🐛 fix: compilation issues with tauri specta

This commit is contained in:
Pauline 2024-08-02 06:01:56 +02:00
parent d4781db671
commit 250d059e91
No known key found for this signature in database
GPG key ID: 722BB181973296AE
8 changed files with 35 additions and 33 deletions

7
TODO.md Normal file
View file

@ -0,0 +1,7 @@
# todo list
- migrate launcher backend storage to `prisma-client-rust` (see `prisma` branch).
- migrate api commands that currently use `tauri-specta` but don't actually rely on `tauri` to `rspc`
- waiting on `rspc` to update to the latest version (hopefully before tauri comes out of beta)
- bump `tauri` to stable v2 when it releases.
- test all major version/loader combos launching and mod loading.

View file

@ -1,4 +1,6 @@
use std::{collections::HashMap, path::PathBuf, str::FromStr};
use std::collections::HashMap;
use std::path::PathBuf;
use std::str::FromStr;
use onelauncher::cluster::content::logger;
use onelauncher::cluster::{self};

View file

@ -1,13 +1,6 @@
use onelauncher::constants::*;
use serde::Serialize;
use specta::Type;
// use tauri_specta::StaticCollection;
// pub fn get_static_collection() -> StaticCollection {
// StaticCollection::default()
// .register("PROGRAM_INFO", get_program_info())
// .to_owned()
// }
#[derive(Serialize, Type)]
pub struct ProgramInfo {

View file

@ -1,7 +1,7 @@
#![recursion_limit = "1024"]
// use api::statics::get_static_collection;
use tauri::{Manager, Emitter};
use api::statics::get_program_info;
use tauri::{Emitter, Manager};
pub mod api;
pub mod error;
@ -40,16 +40,16 @@ pub async fn run() {
pub async fn run_app<F: FnOnce(&mut tauri::App) + Send + 'static>(setup: F) {
let prebuild = tauri_specta::Builder::<tauri::Wry>::new()
// .header("/* eslint-disable -- auto-generated file */")
// .statics(get_static_collection())
.commands(collect_commands!())
.events(collect_events!());
.events(collect_events!())
.constant("PROGRAM_INFO", get_program_info());
#[cfg(debug_assertions)]
prebuild
.export(
specta_typescript::Typescript::default(),
"../frontend/src/bindings.ts"
specta_typescript::Typescript::default()
.bigint(specta_typescript::BigIntExportBehavior::BigInt),
"../frontend/src/bindings.ts",
)
.expect("failed to export debug bindings!");

View file

@ -1,5 +1,4 @@
import {
CheckIcon,
ChevronRightIcon,
DotsVerticalIcon,
EyeIcon,
@ -8,22 +7,13 @@ import {
SearchMdIcon,
} from '@untitled-theme/icons-solid';
import type { Accessor, Setter } from 'solid-js';
import { For, Show, createEffect, createMemo, createSignal } from 'solid-js';
import { For, Show, createEffect, createSignal } from 'solid-js';
import { useNavigate } from '@solidjs/router';
import {
DragDropProvider,
DragDropSensors,
type DragEventHandler,
DragOverlay,
SortableProvider,
createDroppable,
createSortable,
} from '@thisbeyond/solid-dnd';
import { mergeRefs } from '@solid-primitives/refs';
import image from '../../assets/images/header.png';
import ContextMenu from '../components/overlay/ContextMenu';
import Button from '../components/base/Button';
import Tag from '../components/base/Tag';
import TextField from '../components/base/TextField';
import ClusterRoot from './cluster/ClusterRoot';
import ClusterCover from '~ui/components/game/ClusterCover';
@ -166,7 +156,7 @@ export default HomePage;
// TODO: Replace this into it's own component
// possibly with the core ui lirbary with autogenerated and optimized svgs pls
function OneConfigLogo() {
function _OneConfigLogo() {
return (
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="Group 3544">

View file

@ -3,7 +3,7 @@ import Sidebar from '~ui/components/Sidebar';
import useClusterContext from '~ui/hooks/useCluster';
function ClusterGame() {
const cluster = useClusterContext();
const _cluster = useClusterContext();
// TODO: Save cluster settings

View file

@ -68,7 +68,11 @@ pub async fn list_grouped(clear: Option<bool>) -> crate::Result<HashMap<String,
let mut map = HashMap::<String, Vec<Cluster>>::new();
for cluster in list {
let group = cluster.meta.group.clone().unwrap_or(String::from("Ungrouped"));
let group = cluster
.meta
.group
.clone()
.unwrap_or(String::from("Ungrouped"));
if let Some(items) = map.get_mut(&group) {
items.push(cluster);
} else {

View file

@ -206,7 +206,10 @@ impl ChildType {
ChildType::ChildProcess(child) => Ok(child.kill().await.map_err(IOError::from)?),
ChildType::RescuedChild(pid) => {
let mut system = sysinfo::System::new();
if system.refresh_processes(sysinfo::ProcessesToUpdate::Some(&[sysinfo::Pid::from_u32(*pid)])) != 0 {
if system.refresh_processes(sysinfo::ProcessesToUpdate::Some(&[
sysinfo::Pid::from_u32(*pid),
])) != 0
{
let process = system.process(sysinfo::Pid::from_u32(*pid));
if let Some(process) = process {
process.kill();
@ -226,7 +229,10 @@ impl ChildType {
.map(|x| x.code().unwrap_or(0))),
ChildType::RescuedChild(pid) => {
let mut system = sysinfo::System::new();
if !(system.refresh_processes(sysinfo::ProcessesToUpdate::Some(&[sysinfo::Pid::from_u32(*pid)])) != 0) {
if system.refresh_processes(sysinfo::ProcessesToUpdate::Some(&[
sysinfo::Pid::from_u32(*pid),
])) == 0
{
return Ok(Some(0));
}
@ -475,7 +481,7 @@ impl Processor {
)
.into());
}
if cache.name != process.name().to_string_lossy().to_string() {
if cache.name != process.name().to_string_lossy() {
return Err(anyhow::anyhow!(
"restored process {} has a mismatched name {}",
cache.pid,