Merge pull request #5 from xTVaser/v/tauri-boilerplate

Migrate from Electron to Tauri
This commit is contained in:
tripp 2022-04-07 08:07:36 -04:00 committed by GitHub
commit f8faf3ffd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
58 changed files with 5074 additions and 12778 deletions

View file

@ -9,13 +9,18 @@ A launcher for users to install and run the OpenGOAL project with ease
## Disclaimer
Users are required to provide their own copy of the ISO file in order to run the game.
## Built With
- [Electron Forge](https://www.electronforge.io/)
- [Node.js](https://nodejs.org/en/)
- [Electron](https://www.electronjs.org/)
- [Bootstrap Icons](https://icons.getbootstrap.com/)
## Resources
- [OpenGOAL Github Organization](https://github.com/open-goal/)
- [OpenGOAL Documentation](https://open-goal.github.io/)
- [OpenGOAL Discord](https://discord.gg/twBEFbMnqw)
## Development
We are using Tauri to build a native app, but still with simple Web technology. You will need to setup the prerequesites using the instructions here https://tauri.studio/docs/getting-started/prerequisites
> Additionally, this presumes your environment has WebView2 (windows) or webkit2 (linux) already available. This is a requirement for end-users as well! Many modern OSes already ship with such a thing, but it's something we'll need to investigate.
- `npm install`
- `npm run tauri dev`
This builds the app with Tauri (this is a rust compilation, the first run will take a while) and the frontend is served via Vite -- a nice web server that will hot-reload any changes as you develop.

13475
package-lock.json generated

File diff suppressed because it is too large Load diff

72
package.bak.json Normal file
View file

@ -0,0 +1,72 @@
{
"name": "opengoal-launcher",
"productName": "OpenGOAL-Launcher",
"version": "0.0.1",
"description": "OpenGOAL Launcher",
"main": "src/index.js",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish",
"lint": "echo \"No linting configured\""
},
"keywords": [],
"author": {
"name": "trippjoe"
},
"license": "MIT",
"config": {
"forge": {
"packagerConfig": {
"icon": "src/assets/images/opengoal/icon.icns",
"executableName": "opengoal-launcher",
"platforms": [
"darwin",
"linux",
"win32"
]
},
"makers": [
{
"name": "@electron-forge/maker-squirrel",
"config": {
"name": "opengoal-launcher",
"icon": "/src/assets/images/opengoal/icon.ico"
}
},
{
"name": "@electron-forge/maker-deb",
"config": {
"name": "opengoal-launcher"
}
},
{
"name": "@electron-forge/maker-dmg",
"config": {
"name": "OpenGOAL Launcher",
"icon": "src/assets/images/opengoal/icon.icns",
"format": "ULFO"
}
}
]
}
},
"dependencies": {
"@terascope/fetch-github-release": "^0.8.7",
"7zip": "^0.0.6",
"async": "^3.2.3",
"bootstrap-icons": "^1.8.1",
"electron-squirrel-startup": "^1.0.0",
"fs-extra": "^10.0.1"
},
"devDependencies": {
"@electron-forge/cli": "^6.0.0-beta.63",
"@electron-forge/maker-deb": "^6.0.0-beta.63",
"@electron-forge/maker-dmg": "^6.0.0-beta.63",
"@electron-forge/maker-rpm": "^6.0.0-beta.63",
"@electron-forge/maker-squirrel": "^6.0.0-beta.63",
"@electron-forge/maker-zip": "^6.0.0-beta.63",
"electron": "17.2.0"
}
}

View file

@ -3,70 +3,22 @@
"productName": "OpenGOAL-Launcher",
"version": "0.0.1",
"description": "OpenGOAL Launcher",
"main": "src/index.js",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish",
"lint": "echo \"No linting configured\""
},
"keywords": [],
"author": {
"name": "trippjoe"
},
"license": "MIT",
"config": {
"forge": {
"packagerConfig": {
"icon": "src/assets/images/opengoal/icon.icns",
"executableName": "opengoal-launcher",
"platforms": [
"darwin",
"linux",
"win32"
]
},
"makers": [
{
"name": "@electron-forge/maker-squirrel",
"config": {
"name": "opengoal-launcher",
"icon": "/src/assets/images/opengoal/icon.ico"
}
},
{
"name": "@electron-forge/maker-deb",
"config": {
"name": "opengoal-launcher"
}
},
{
"name": "@electron-forge/maker-dmg",
"config": {
"name": "OpenGOAL Launcher",
"icon": "src/assets/images/opengoal/icon.icns",
"format": "ULFO"
}
}
]
}
},
"dependencies": {
"@terascope/fetch-github-release": "^0.8.7",
"7zip": "^0.0.6",
"async": "^3.2.3",
"bootstrap-icons": "^1.8.1",
"electron-squirrel-startup": "^1.0.0",
"fs-extra": "^10.0.1"
"scripts": {
"dev": "vite serve src-frontend",
"build": "vite build",
"preview": "vite preview",
"tauri": "tauri"
},
"devDependencies": {
"@electron-forge/cli": "^6.0.0-beta.63",
"@electron-forge/maker-deb": "^6.0.0-beta.63",
"@electron-forge/maker-dmg": "^6.0.0-beta.63",
"@electron-forge/maker-rpm": "^6.0.0-beta.63",
"@electron-forge/maker-squirrel": "^6.0.0-beta.63",
"@electron-forge/maker-zip": "^6.0.0-beta.63",
"electron": "17.2.0"
"@tauri-apps/cli": "^1.0.0-rc.8",
"vite": "^2.9.0"
},
"dependencies": {
"@tauri-apps/api": "^1.0.0-rc.3"
}
}

View file

Before

Width:  |  Height:  |  Size: 2.6 MiB

After

Width:  |  Height:  |  Size: 2.6 MiB

View file

Before

Width:  |  Height:  |  Size: 3.6 MiB

After

Width:  |  Height:  |  Size: 3.6 MiB

View file

Before

Width:  |  Height:  |  Size: 3 MiB

After

Width:  |  Height:  |  Size: 3 MiB

View file

Before

Width:  |  Height:  |  Size: 3.8 MiB

After

Width:  |  Height:  |  Size: 3.8 MiB

View file

Before

Width:  |  Height:  |  Size: 378 KiB

After

Width:  |  Height:  |  Size: 378 KiB

View file

Before

Width:  |  Height:  |  Size: 3 MiB

After

Width:  |  Height:  |  Size: 3 MiB

View file

Before

Width:  |  Height:  |  Size: 3 MiB

After

Width:  |  Height:  |  Size: 3 MiB

View file

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 396 KiB

View file

Before

Width:  |  Height:  |  Size: 4 MiB

After

Width:  |  Height:  |  Size: 4 MiB

View file

Before

Width:  |  Height:  |  Size: 4.3 MiB

After

Width:  |  Height:  |  Size: 4.3 MiB

View file

Before

Width:  |  Height:  |  Size: 514 KiB

After

Width:  |  Height:  |  Size: 514 KiB

View file

Before

Width:  |  Height:  |  Size: 569 KiB

After

Width:  |  Height:  |  Size: 569 KiB

View file

Before

Width:  |  Height:  |  Size: 483 KiB

After

Width:  |  Height:  |  Size: 483 KiB

View file

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View file

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

View file

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 104 KiB

View file

@ -4,23 +4,22 @@
<head>
<meta charset="UTF-8" />
<title>OpenGOAL Launcher</title>
<link rel="stylesheet" href="../../../node_modules/bootstrap-icons/font/bootstrap-icons.css">
<link rel="stylesheet" href="index.css" />
<script defer src="render.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css">
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<div class="container">
<div class="background-container">
<div class="overlay"></div>
<!-- <img class="background" src="../../assets/images/backgrounds/jak1/map.jpg"> -->
<!-- <img class="background" src="assets/images/backgrounds/jak1/map.jpg"> -->
<video autoplay loop muted>
<source src="../../assets/images/backgrounds/jak1/background.mp4" type="video/mp4">
<source src="assets/images/backgrounds/jak1/background.mp4" type="video/mp4">
</video>
</div>
<div class="body">
<div class="logo">
<img src="../../assets/images/opengoal/logo.png" class="logo" width="100%">
<img src="assets/images/opengoal/logo.png" class="logo" width="100%">
</div>
<div class="buttons">
<div class="config">
@ -35,17 +34,17 @@
<div class="games">
<div class="btn_jak1 nav-item">
<a data-tooltip="Jak & Daxter: The Precursor Legacy">
<img src="../../assets/images/games/jak-tpl.png">
<img src="assets/images/games/jak-tpl.png">
</a>
</div>
<div class="btn_jak2 nav-item">
<a data-tooltip="Jak 2">
<img src="../../assets/images/games/jak-2.png">
<img src="assets/images/games/jak-2.png">
</a>
</div>
<div class="btn_jak3 nav-item">
<a data-tooltip="Jak 3">
<img src="../../assets/images/games/jak-3.png">
<img src="assets/images/games/jak-3.png">
</a>
</div>
</div>
@ -63,6 +62,7 @@
</div>
</div>
</div>
<script src="index.js"></script>
</body>
</html>

4
src-tauri/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
# Generated by Cargo
# will have compiled files and executables
/target/
WixTools

4056
src-tauri/Cargo.lock generated Normal file

File diff suppressed because it is too large Load diff

28
src-tauri/Cargo.toml Normal file
View file

@ -0,0 +1,28 @@
[package]
name = "app"
version = "0.1.0"
description = "A Tauri App"
authors = ["you"]
license = ""
repository = ""
default-run = "app"
edition = "2021"
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.5", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.0.0-rc.5", features = ["api-all"] }
[features]
# by default Tauri runs in production mode
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
default = [ "custom-protocol" ]
# this feature is used used for production builds where `devPath` points to the filesystem
# DO NOT remove this
custom-protocol = [ "tauri/custom-protocol" ]

3
src-tauri/build.rs Normal file
View file

@ -0,0 +1,3 @@
fn main() {
tauri_build::build()
}

BIN
src-tauri/icons/128x128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

BIN
src-tauri/icons/32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 974 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 903 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
src-tauri/icons/icon.icns Normal file

Binary file not shown.

BIN
src-tauri/icons/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

BIN
src-tauri/icons/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

10
src-tauri/src/main.rs Normal file
View file

@ -0,0 +1,10 @@
#![cfg_attr(
all(not(debug_assertions), target_os = "windows"),
windows_subsystem = "windows"
)]
fn main() {
tauri::Builder::default()
.run(tauri::generate_context!())
.expect("error while running tauri application");
}

67
src-tauri/tauri.conf.json Normal file
View file

@ -0,0 +1,67 @@
{
"package": {
"productName": "yeehaw2",
"version": "0.1.0"
},
"build": {
"distDir": "../dist",
"devPath": "http://localhost:3000",
"beforeDevCommand": "npm run dev",
"beforeBuildCommand": "npm run build"
},
"tauri": {
"bundle": {
"active": true,
"targets": "all",
"identifier": "com.tauri.dev",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
],
"resources": [],
"externalBin": [],
"copyright": "",
"category": "DeveloperTool",
"shortDescription": "",
"longDescription": "",
"deb": {
"depends": [],
"useBootstrapper": false
},
"macOS": {
"frameworks": [],
"useBootstrapper": false,
"exceptionDomain": "",
"signingIdentity": null,
"providerShortName": null,
"entitlements": null
},
"windows": {
"certificateThumbprint": null,
"digestAlgorithm": "sha256",
"timestampUrl": ""
}
},
"updater": {
"active": false
},
"allowlist": {
"all": true
},
"windows": [
{
"title": "Tauri App",
"width": 800,
"height": 600,
"resizable": true,
"fullscreen": false
}
],
"security": {
"csp": null
}
}
}