Make Theseus compilable out of the box again, update Tauri to 1.0.4

Changes made:
- migrate to Vite 3 (Svelte Kit errors out and forces you to migrate)
- bumped unplugin-icons to 0.14.7 (Vite 3 support)
- disable strict-peer-dependencies (changes needed in omorphia - unplugin-icons there requires Vite 2)
- bumped Tauri to 1.0.4 (finally stable!)
- removed useBootstrapper (removed in v1.0.0-rc.5)
- migrated from create_window to setup (removed in v1.0.0-rc.7)
- replaced %svelte% with %sveltekit% (renamed in SvelteKit 1.0.0-next.339)

Notes:
- Vite 3 exposes its dev server on port 5173.
This commit is contained in:
Wuzado 2022-07-16 19:52:30 +02:00
parent b223dc7cba
commit 855604c9e0
No known key found for this signature in database
GPG Key ID: B3850B7EB5273145
11 changed files with 1386 additions and 1230 deletions

1
.idea/theseus.iml generated
View File

@ -47,6 +47,7 @@
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/crossbeam-utils-bab62be590a5955d/out" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/target/debug/build/memoffset-235ac8b3550fb50a/out" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/theseus/examples" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/theseus_gui/src-tauri/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
<excludeFolder url="file://$MODULE_DIR$/theseus_gui/.svelte-kit" />
<excludeFolder url="file://$MODULE_DIR$/theseus_gui/build" />

679
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1 +1,2 @@
engine-strict=true
strict-peer-dependencies=false

View File

@ -1,11 +1,11 @@
{
"scripts": {
"dev": "tauri dev",
"dev:web": "svelte-kit dev",
"kill:web": "kill-port 3000",
"dev:web": "vite",
"kill:web": "kill-port 5173",
"tauri": "tauri",
"build": "tauri build",
"build:web": "svelte-kit build",
"build:web": "vite build",
"test": "cargo ../test --manifest-path ./src-tauri/Cargo.toml",
"format": "prettier --ignore-path .gitignore --write --plugin-search-dir=. src",
"check": "cargo check --manifest-path src-tauri/Cargo.toml && svelte-check --tsconfig ./tsconfig.json"
@ -13,7 +13,7 @@
"devDependencies": {
"@sveltejs/adapter-static": "next",
"@sveltejs/kit": "next",
"@tauri-apps/cli": "^1.0.0-rc.5",
"@tauri-apps/cli": "^1.0.4",
"@typescript-eslint/eslint-plugin": "^5.10.1",
"@typescript-eslint/parser": "^5.10.1",
"eslint": "^7.32.0",
@ -25,7 +25,8 @@
"svelte": "^3.46.0",
"svelte-check": "^2.2.6",
"tslib": "^2.3.1",
"typescript": "~4.5.4"
"typescript": "~4.5.4",
"vite": "^3.0.0"
},
"type": "module",
"dependencies": {
@ -37,6 +38,6 @@
"@tauri-apps/api": "^1.0.0-rc.1",
"omorphia": "0.0.17",
"svrollbar": "^0.10.4",
"unplugin-icons": "^0.13.2"
"unplugin-icons": "^0.14.7"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -8,12 +8,12 @@ rust-version = "1.57"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies]
tauri-build = { version = "1.0.0-rc.3", features = [] }
tauri-build = { version = "1.0.4", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.0.0-rc.3", features = ["api-all"] }
tauri = { version = "1.0.4", features = ["api-all"] }
[features]
# by default Tauri runs in production mode

View File

@ -13,8 +13,8 @@ fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![])
.create_window("main", WindowUrl::default(), |win, webview| {
let win = win
.setup(|app| {
let _win = WindowBuilder::new(app, "main", WindowUrl::default())
.title("Modrinth")
.resizable(true)
.decorations(true)
@ -22,8 +22,9 @@ fn main() {
.inner_size(800.0, 550.0)
.min_inner_size(400.0, 200.0)
.skip_taskbar(false)
.fullscreen(false);
return (win, webview);
.fullscreen(false)
.build()?;
Ok(())
})
.menu(Menu::with_items([
#[cfg(target_os = "macos")]

View File

@ -4,7 +4,7 @@
},
"build": {
"distDir": "../build",
"devPath": "http://localhost:3000",
"devPath": "http://localhost:5173",
"beforeDevCommand": "pnpm dev:web",
"beforeBuildCommand": "pnpm run build:web"
},
@ -32,13 +32,11 @@
"shortDescription": "",
"longDescription": "",
"deb": {
"depends": [],
"useBootstrapper": false
"depends": []
},
"macOS": {
"frameworks": [],
"minimumSystemVersion": "",
"useBootstrapper": false,
"exceptionDomain": "",
"signingIdentity": null,
"providerShortName": null,

View File

@ -3,9 +3,9 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%svelte.head%
%sveltekit.head%
</head>
<body style="background-color: hsl(220, 13%, 15%)">
%svelte.body%
%sveltekit.body%
</body>
</html>

View File

@ -1,6 +1,5 @@
import adapter from '@sveltejs/adapter-static';
import path from "path";
import { preprocess, plugins } from 'omorphia/config/svelte.config'
import { preprocess } from 'omorphia/config/svelte.config'
/** @type {import('@sveltejs/kit').Config} */
const config = {
@ -8,23 +7,7 @@ const config = {
kit: {
adapter: adapter({
fallback: '200.html',
}),
vite: {
plugins: [
...plugins,
],
resolve: {
alias: {
$assets: path.resolve('./src/assets'),
$components: path.resolve('./src/components'),
$layout: path.resolve('./src/layout'),
$lib: path.resolve('./src/lib'),
$stores: path.resolve('./src/stores'),
$styles: path.resolve('./src/styles'),
$generated: path.resolve('./src/generated'),
},
},
}
})
}
};

View File

@ -0,0 +1,24 @@
import { sveltekit } from '@sveltejs/kit/vite';
import path from "path";
import { plugins } from 'omorphia/config/svelte.config'
/** @type {import('vite').UserConfig} */
const config = {
plugins: [
sveltekit(),
...plugins
],
resolve: {
alias: {
$assets: path.resolve('./src/assets'),
$components: path.resolve('./src/components'),
$layout: path.resolve('./src/layout'),
$lib: path.resolve('./src/lib'),
$stores: path.resolve('./src/stores'),
$styles: path.resolve('./src/styles'),
$generated: path.resolve('./src/generated'),
},
},
};
export default config;