initial commit
6
.gitignore
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
/_/
|
||||
|
||||
/node_modules/
|
||||
/public/build/
|
||||
|
||||
.DS_Store
|
4
.prettierrc
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"semi": false,
|
||||
"useTabs": true
|
||||
}
|
7
.vscode/extensions.json
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"recommendations": [
|
||||
"svelte.svelte-vscode",
|
||||
"bradlc.vscode-tailwindcss",
|
||||
"csstools.postcss"
|
||||
]
|
||||
}
|
12
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"cSpell.words": ["developomp", "tailwindcss", "tauri"],
|
||||
|
||||
"emmet.includeLanguages": {
|
||||
"postcss": "css"
|
||||
},
|
||||
|
||||
// prevents unknown at-rule error
|
||||
// https://github.com/tailwindlabs/tailwindcss-intellisense#recommended-vs-code-settings
|
||||
"css.validate": false,
|
||||
"scss.validate": false
|
||||
}
|
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright © 2022 developomp
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
71
README.md
Normal file
|
@ -0,0 +1,71 @@
|
|||
# WBM-installer
|
||||
|
||||
Installer for War Brokers Mods (WBM).
|
||||
|
||||
## Installing
|
||||
|
||||
instructions
|
||||
|
||||
## Contributing
|
||||
|
||||
**⚠️ High CPU usage warning ⚠️**
|
||||
|
||||
Running `yarn tauri XXX` command will use a LOT (I mean A **LOT**) of computing resource.
|
||||
No worries though, this is only for the first execution and it will be much quicker next time.
|
||||
|
||||
- versions in [`./src-tauri/Cargo.toml`](./src-tauri/Cargo.toml) is irrelevant. The version in [`./src-tauri/tauri.conf.json`](./src-tauri/tauri.conf.json) is the real deal.
|
||||
- Icons are from [svelte-icons](https://github.com/Introvertuous/svelte-icons)
|
||||
|
||||
### 0. Requirements
|
||||
|
||||
- nodejs v16 LTS
|
||||
- cargo
|
||||
- yarn
|
||||
- git
|
||||
|
||||
### 1. Setup
|
||||
|
||||
- [Setup tauri](https://tauri.studio/en/docs/getting-started/intro/#setting-up-your-environment)
|
||||
- install dependencies
|
||||
|
||||
```bash
|
||||
yarn install
|
||||
```
|
||||
|
||||
### 2. Run in development mode
|
||||
|
||||
Start the application in development environment with testing tools.
|
||||
|
||||
```bash
|
||||
yarn tauri dev
|
||||
```
|
||||
|
||||
Test front end in development mode with hot reloading (in browser)
|
||||
|
||||
```bash
|
||||
yarn dev
|
||||
```
|
||||
|
||||
Build front end in production mode (in browser)
|
||||
|
||||
```bash
|
||||
yarn build
|
||||
```
|
||||
|
||||
start front end in production mode (in browser)
|
||||
|
||||
```bash
|
||||
yarn start
|
||||
```
|
||||
|
||||
### 3. Build for production
|
||||
|
||||
Build the application for release.
|
||||
|
||||
```bash
|
||||
yarn tauri build
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
The source code for this project is available under the [MIT license](./LICENSE).
|
40
package.json
Normal file
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "rollup -c",
|
||||
"dev": "rollup -c -w",
|
||||
"start": "sirv public --no-clear",
|
||||
"check": "svelte-check --tsconfig ./tsconfig.json",
|
||||
"tauri": "tauri"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^1.0.0-beta.8",
|
||||
"sirv-cli": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fortawesome/fontawesome-free": "^5.15.4",
|
||||
"@rollup/plugin-commonjs": "^21.0.1",
|
||||
"@rollup/plugin-node-resolve": "^13.1.3",
|
||||
"@rollup/plugin-typescript": "^8.3.0",
|
||||
"@tauri-apps/cli": "^1.0.0-beta.10",
|
||||
"@tsconfig/svelte": "^3.0.0",
|
||||
"@types/jest": "^27.4.0",
|
||||
"autoprefixer": "^10.4.2",
|
||||
"postcss": "^8.4.5",
|
||||
"rollup": "^2.63.0",
|
||||
"rollup-plugin-livereload": "^2.0.5",
|
||||
"rollup-plugin-postcss": "^4.0.2",
|
||||
"rollup-plugin-svelte": "^7.1.0",
|
||||
"rollup-plugin-terser": "^7.0.2",
|
||||
"sass": "^1.47.0",
|
||||
"svelte": "^3.45.0",
|
||||
"svelte-check": "^2.2.11",
|
||||
"svelte-icons": "^2.1.0",
|
||||
"svelte-preprocess": "^4.10.1",
|
||||
"svelte-spa-router": "^3.2.0",
|
||||
"tailwindcss": "^3.0.12",
|
||||
"tslib": "^2.3.1",
|
||||
"typescript": "^4.5.4"
|
||||
}
|
||||
}
|
BIN
public/favicon.ico
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
public/favicon.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
public/img/logo@128x128.png
Normal file
After Width: | Height: | Size: 22 KiB |
18
public/index.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
||||
|
||||
<title>WBM Installer</title>
|
||||
|
||||
<link rel="icon" type="image/ico" href="/favicon.png" />
|
||||
<link rel="stylesheet" href="/build/bundle.css" />
|
||||
|
||||
<script defer src="/build/bundle.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app" />
|
||||
</body>
|
||||
</html>
|
97
rollup.config.js
Normal file
|
@ -0,0 +1,97 @@
|
|||
import sveltePreprocess from "svelte-preprocess"
|
||||
import svelte from "rollup-plugin-svelte"
|
||||
import { terser } from "rollup-plugin-terser"
|
||||
import livereload from "rollup-plugin-livereload"
|
||||
import postcss from "rollup-plugin-postcss"
|
||||
import commonjs from "@rollup/plugin-commonjs"
|
||||
import resolve from "@rollup/plugin-node-resolve"
|
||||
import typescript from "@rollup/plugin-typescript"
|
||||
|
||||
// postcss plugins
|
||||
|
||||
import autoprefixer from "autoprefixer"
|
||||
import tailwindcss from "tailwindcss"
|
||||
|
||||
const production = !process.env.ROLLUP_WATCH
|
||||
|
||||
function serve() {
|
||||
let server
|
||||
|
||||
function toExit() {
|
||||
if (server) server.kill(0)
|
||||
}
|
||||
|
||||
return {
|
||||
writeBundle() {
|
||||
if (server) return
|
||||
server = require("child_process").spawn(
|
||||
"npm",
|
||||
["run", "start", "--", "--dev"],
|
||||
{
|
||||
stdio: ["ignore", "inherit", "inherit"],
|
||||
shell: true,
|
||||
}
|
||||
)
|
||||
|
||||
process.on("SIGTERM", toExit)
|
||||
process.on("exit", toExit)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
input: "src/main.ts",
|
||||
output: {
|
||||
sourcemap: true,
|
||||
format: "iife",
|
||||
name: "app",
|
||||
file: "public/build/bundle.js",
|
||||
},
|
||||
plugins: [
|
||||
svelte({
|
||||
preprocess: sveltePreprocess({ sourceMap: !production }),
|
||||
compilerOptions: {
|
||||
// enable run-time checks when not in production
|
||||
dev: !production,
|
||||
},
|
||||
}),
|
||||
|
||||
postcss({
|
||||
plugins: [autoprefixer, tailwindcss],
|
||||
// extract any component CSS out into
|
||||
// a separate file - better for performance
|
||||
extract: true,
|
||||
extract: "bundle.css",
|
||||
}),
|
||||
|
||||
// If you have external dependencies installed from
|
||||
// npm, you'll most likely need these plugins. In
|
||||
// some cases you'll need additional configuration -
|
||||
// consult the documentation for details:
|
||||
// https://github.com/rollup/plugins/tree/master/packages/commonjs
|
||||
resolve({
|
||||
browser: true,
|
||||
dedupe: ["svelte"],
|
||||
}),
|
||||
commonjs(),
|
||||
typescript({
|
||||
sourceMap: !production,
|
||||
inlineSources: !production,
|
||||
}),
|
||||
|
||||
// In dev mode, call `npm run start` once
|
||||
// the bundle has been generated
|
||||
!production && serve(),
|
||||
|
||||
// Watch the `public` directory and refresh the
|
||||
// browser on changes when not in production
|
||||
!production && livereload("public"),
|
||||
|
||||
// If we're building for production (npm run build
|
||||
// instead of npm run dev), minify
|
||||
production && terser(),
|
||||
],
|
||||
watch: {
|
||||
clearScreen: false,
|
||||
},
|
||||
}
|
4
src-tauri/.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
WixTools
|
3736
src-tauri/Cargo.lock
generated
Normal file
22
src-tauri/Cargo.toml
Normal file
|
@ -0,0 +1,22 @@
|
|||
[package]
|
||||
name = "wbm-installer"
|
||||
version = "1.0.0"
|
||||
description = "WBM Installer"
|
||||
authors = ["developomp"]
|
||||
license = "MIT"
|
||||
repository = "https://github.com/War-Brokers-Mods/WBM-installer"
|
||||
default-run = "wbm-installer"
|
||||
edition = "2021"
|
||||
build = "src/build.rs"
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tauri = { version = "1.0.0-beta.8", features = ["api-all"] }
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "1.0.0-beta.4" }
|
||||
|
||||
[features]
|
||||
default = ["custom-protocol"]
|
||||
custom-protocol = ["tauri/custom-protocol"]
|
BIN
src-tauri/icons/128x128.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
src-tauri/icons/128x128@2x.png
Normal file
After Width: | Height: | Size: 37 KiB |
BIN
src-tauri/icons/32x32.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
src-tauri/icons/Square107x107Logo.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
src-tauri/icons/Square142x142Logo.png
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
src-tauri/icons/Square150x150Logo.png
Normal file
After Width: | Height: | Size: 38 KiB |
BIN
src-tauri/icons/Square30x30Logo.png
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
src-tauri/icons/Square44x44Logo.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
src-tauri/icons/Square71x71Logo.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
src-tauri/icons/Square89x89Logo.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
src-tauri/icons/StoreLogo.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
src-tauri/icons/icon.icns
Normal file
BIN
src-tauri/icons/icon.ico
Normal file
After Width: | Height: | Size: 353 KiB |
BIN
src-tauri/icons/icon.png
Normal file
After Width: | Height: | Size: 45 KiB |
14
src-tauri/rustfmt.toml
Normal file
|
@ -0,0 +1,14 @@
|
|||
max_width = 100
|
||||
hard_tabs = false
|
||||
tab_spaces = 4
|
||||
newline_style = "Auto"
|
||||
use_small_heuristics = "Default"
|
||||
reorder_imports = true
|
||||
reorder_modules = true
|
||||
remove_nested_parens = true
|
||||
edition = "2021"
|
||||
merge_derives = true
|
||||
use_try_shorthand = false
|
||||
use_field_init_shorthand = false
|
||||
force_explicit_abi = true
|
||||
imports_granularity = "Crate"
|
3
src-tauri/src/build.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
fn main() {
|
||||
tauri_build::build()
|
||||
}
|
10
src-tauri/src/main.rs
Normal 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
|
@ -0,0 +1,67 @@
|
|||
{
|
||||
"package": {
|
||||
"productName": "wbm-installer",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"build": {
|
||||
"distDir": "../public",
|
||||
"devPath": "http://localhost:8080",
|
||||
"beforeDevCommand": "npm run dev",
|
||||
"beforeBuildCommand": "npm run build"
|
||||
},
|
||||
"tauri": {
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"targets": "all",
|
||||
"identifier": "com.developomp.wbm.installer",
|
||||
"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": [],
|
||||
"minimumSystemVersion": "",
|
||||
"useBootstrapper": false,
|
||||
"exceptionDomain": "",
|
||||
"signingIdentity": null,
|
||||
"entitlements": null
|
||||
},
|
||||
"windows": {
|
||||
"certificateThumbprint": null,
|
||||
"digestAlgorithm": "sha256",
|
||||
"timestampUrl": ""
|
||||
}
|
||||
},
|
||||
"updater": {
|
||||
"active": false
|
||||
},
|
||||
"allowlist": {
|
||||
"all": true
|
||||
},
|
||||
"windows": [
|
||||
{
|
||||
"title": "WBM Installer",
|
||||
"width": 800,
|
||||
"height": 500,
|
||||
"resizable": false,
|
||||
"fullscreen": false
|
||||
}
|
||||
],
|
||||
"security": {
|
||||
"csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'"
|
||||
}
|
||||
}
|
||||
}
|
6
src/App.svelte
Normal file
|
@ -0,0 +1,6 @@
|
|||
<script lang="ts">
|
||||
import Router from "svelte-spa-router"
|
||||
import routes from "./routes"
|
||||
</script>
|
||||
|
||||
<Router {routes} />
|
0
src/components/Titlebar.svelte
Normal file
12
src/global.css
Normal file
|
@ -0,0 +1,12 @@
|
|||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
#app {
|
||||
@apply bg-neutral-800 text-neutral-300;
|
||||
|
||||
/* approximately golden ratio */
|
||||
|
||||
width: 500px;
|
||||
height: 300px;
|
||||
}
|
1
src/global.d.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/// <reference types="svelte" />
|
8
src/main.ts
Normal file
|
@ -0,0 +1,8 @@
|
|||
import App from "./App.svelte"
|
||||
import "./global.css"
|
||||
|
||||
const app = new App({
|
||||
target: document.getElementById("app"),
|
||||
})
|
||||
|
||||
export default app
|
47
src/pages/Home/ActionButtons.svelte
Normal file
|
@ -0,0 +1,47 @@
|
|||
<script lang="ts">
|
||||
import FaTasks from "svelte-icons/fa/FaTasks.svelte"
|
||||
import FaArrowAltCircleRight from "svelte-icons/fa/FaArrowAltCircleRight.svelte"
|
||||
import Update from "svelte-icons/fa/FaRedoAlt.svelte"
|
||||
</script>
|
||||
|
||||
<div class="main-buttons-container">
|
||||
<button>
|
||||
<div class="icon"><FaTasks /></div>
|
||||
<div>Status</div>
|
||||
</button>
|
||||
<button>
|
||||
<div class="icon"><FaArrowAltCircleRight /></div>
|
||||
<div>Install</div>
|
||||
</button>
|
||||
<button>
|
||||
<div class="icon"><Update /></div>
|
||||
<div>Update</div>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.main-buttons-container {
|
||||
@apply grid gap-6 grid-cols-3;
|
||||
|
||||
button {
|
||||
@apply p-4 aspect-square rounded bg-red-500 text-white;
|
||||
|
||||
.icon {
|
||||
@apply flex justify-center w-full mb-4;
|
||||
|
||||
$icon-size: 24px;
|
||||
|
||||
width: $icon-size;
|
||||
height: $icon-size;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
@apply bg-red-700;
|
||||
}
|
||||
|
||||
&:active {
|
||||
@apply bg-red-800;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
16
src/pages/Home/BottomButtons.svelte
Normal file
|
@ -0,0 +1,16 @@
|
|||
<div class="small-button-container">
|
||||
<button>
|
||||
<div>Docs</div>
|
||||
</button>
|
||||
<button>
|
||||
<div>GitHub</div>
|
||||
</button>
|
||||
<button>
|
||||
<div>Discord</div>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.small-button-container {
|
||||
}
|
||||
</style>
|
24
src/pages/Home/index.svelte
Normal file
|
@ -0,0 +1,24 @@
|
|||
<script lang="ts">
|
||||
import ActionButtons from "./ActionButtons.svelte"
|
||||
import BottomButtons from "./BottomButtons.svelte"
|
||||
</script>
|
||||
|
||||
<div class="home">
|
||||
<img alt="WBM icon" src="/img/logo@128x128.png" />
|
||||
|
||||
<ActionButtons />
|
||||
<BottomButtons />
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
.home {
|
||||
@apply flex flex-col justify-center items-center;
|
||||
|
||||
img {
|
||||
@apply place-self-center m-2;
|
||||
|
||||
/* prevent button position flickering */
|
||||
min-height: 128px;
|
||||
}
|
||||
}
|
||||
</style>
|
5
src/routes.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
import Home from "./pages/Home/index.svelte"
|
||||
|
||||
export default {
|
||||
"/": Home,
|
||||
}
|
5
svelte.config.js
Normal file
|
@ -0,0 +1,5 @@
|
|||
import sveltePreprocess from "svelte-preprocess"
|
||||
|
||||
export default {
|
||||
preprocess: sveltePreprocess({ postcss: true }),
|
||||
}
|
7
tailwind.config.cjs
Normal file
|
@ -0,0 +1,7 @@
|
|||
module.exports = {
|
||||
content: ["./src/**/*.{html,js}"],
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
}
|
10
tsconfig.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"extends": "@tsconfig/svelte/tsconfig.json",
|
||||
|
||||
"compilerOptions": {
|
||||
"types": ["node", "svelte", "jest"]
|
||||
},
|
||||
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules/*", "__sapper__/*", "public/*"]
|
||||
}
|