Remove wasm stuff

This commit is contained in:
Gregory Schier
2023-03-12 21:25:31 -07:00
parent 1b6c32c7ac
commit 364cdb06df
13 changed files with 33 additions and 169 deletions

View File

@@ -15,21 +15,19 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- uses: dtolnay/rust-toolchain@stable
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install dependencies
run: |
cargo install rsw
npm install -g wasm-pack
npm ci
run: npm ci
- name: Run tests
run: npm test
- uses: tauri-apps/tauri-action@v0

1
.gitignore vendored
View File

@@ -23,5 +23,4 @@ dist-ssr
*.sln
*.sw?
.rsw
*.sqlite

17
package-lock.json generated
View File

@@ -57,7 +57,6 @@
"tailwindcss": "^3.2.7",
"typescript": "^4.6.4",
"vite": "^4.0.0",
"vite-plugin-rsw": "^2.0.11",
"vite-plugin-top-level-await": "^1.2.4",
"vitest": "^0.29.2"
}
@@ -7485,15 +7484,6 @@
"url": "https://github.com/sponsors/antfu"
}
},
"node_modules/vite-plugin-rsw": {
"version": "2.0.11",
"resolved": "https://registry.npmjs.org/vite-plugin-rsw/-/vite-plugin-rsw-2.0.11.tgz",
"integrity": "sha512-OqbGAtdDfK88gDoxA9wVdGowCmlzLSXEyRvD8CgTu9IP5O7tx8Tg2CtIzKOyOWZtHHZPhtdYiN+5Il6rTZCkzw==",
"dev": true,
"peerDependencies": {
"vite": ">2.8.0-0"
}
},
"node_modules/vite-plugin-top-level-await": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/vite-plugin-top-level-await/-/vite-plugin-top-level-await-1.2.4.tgz",
@@ -13130,13 +13120,6 @@
"vite": "^3.0.0 || ^4.0.0"
}
},
"vite-plugin-rsw": {
"version": "2.0.11",
"resolved": "https://registry.npmjs.org/vite-plugin-rsw/-/vite-plugin-rsw-2.0.11.tgz",
"integrity": "sha512-OqbGAtdDfK88gDoxA9wVdGowCmlzLSXEyRvD8CgTu9IP5O7tx8Tg2CtIzKOyOWZtHHZPhtdYiN+5Il6rTZCkzw==",
"dev": true,
"requires": {}
},
"vite-plugin-top-level-await": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/vite-plugin-top-level-await/-/vite-plugin-top-level-await-1.2.4.tgz",

View File

@@ -4,13 +4,12 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"tauri-dev": "concurrently -n app,rsw \"tauri dev\" \"rsw watch\"",
"tauri-dev": "tauri dev",
"tauri-build": "npm run build:icon && tauri build",
"build": "npm run build:rsw && npm run build:frontend",
"build": "npm run build:frontend",
"dev": "vite dev",
"lint": "tsc && eslint . --ext .ts,.tsx",
"build:icon": "tauri icon src-tauri/icons/icon.png",
"build:rsw": "rsw build",
"build:frontend": "vite build",
"test": "vitest",
"coverage": "vitest run --coverage"
@@ -65,7 +64,6 @@
"tailwindcss": "^3.2.7",
"typescript": "^4.6.4",
"vite": "^4.0.0",
"vite-plugin-rsw": "^2.0.11",
"vite-plugin-top-level-await": "^1.2.4",
"vitest": "^0.29.2"
}

View File

@@ -1,39 +0,0 @@
name = "rsw"
version = "0.1.0"
#! time interval for file changes to trigger wasm-pack build, default `50` milliseconds
interval = 50
#! link
#! npm link @see https://docs.npmjs.com/cli/v8/commands/npm-link
#! yarn link @see https://classic.yarnpkg.com/en/docs/cli/link
#! pnpm link @see https://pnpm.io/cli/link
#! The link command will only be executed if `[[crates]] link = true`
#! cli: `npm` | `yarn` | `pnpm`, default is `npm`
cli = "npm"
#! ---------------------------
#! rsw new <name>
[new]
#! @see https://rustwasm.github.io/docs/wasm-pack/commands/new.html
#! using: `wasm-pack` | `rsw` | `user`, default is `wasm-pack`
#! 1. wasm-pack: `rsw new <name> --template <template> --mode <normal|noinstall|force>`
#! 2. rsw: `rsw new <name>`, built-in templates
#! 3. user: `rsw new <name>`, if `dir` is not configured, use `wasm-pack new <name>` to initialize the project
using = "wasm-pack"
#! this field needs to be configured when `using = "user"`
#! `using = "wasm-pack"` or `using = "rsw"`, this field will be ignored
#! copy all files in this directory
dir = "my-template"
#! ################# NPM Package #################
#! When there is only `name`, other fields will use the default configuration
#! 📦 -------- package: @rsw --------
[[crates]]
#! npm package name (path: $ROOT/@rsw)
name = "src-wasm/hello"
#! run `npm link`: `true` | `false`, default is `false`
link = true

44
src-tauri/Cargo.lock generated
View File

@@ -4035,28 +4035,6 @@ dependencies = [
"zip",
]
[[package]]
name = "tauri-app"
version = "0.0.0"
dependencies = [
"chrono",
"cocoa",
"deno_ast",
"deno_core",
"futures",
"http",
"objc",
"rand 0.8.5",
"reqwest",
"serde",
"serde_json",
"sqlx",
"tauri",
"tauri-build",
"tokio",
"uuid 1.3.0",
]
[[package]]
name = "tauri-build"
version = "1.2.1"
@@ -5187,6 +5165,28 @@ dependencies = [
"libc",
]
[[package]]
name = "yaak-app"
version = "0.0.0"
dependencies = [
"chrono",
"cocoa",
"deno_ast",
"deno_core",
"futures",
"http",
"objc",
"rand 0.8.5",
"reqwest",
"serde",
"serde_json",
"sqlx",
"tauri",
"tauri-build",
"tokio",
"uuid 1.3.0",
]
[[package]]
name = "zip"
version = "0.6.4"

View File

@@ -1,10 +1,10 @@
[package]
name = "tauri-app"
name = "yaak-app"
version = "0.0.0"
description = "A Tauri App"
authors = ["you"]
license = ""
repository = ""
description = "A network protocol testing utility app"
authors = ["Gregory Schier"]
license = "MIT"
repository = "https://github.com/gschier/yaak-app"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@@ -1,6 +0,0 @@
/target
**/*.rs.bk
Cargo.lock
bin/
pkg/
wasm-pack.log

View File

@@ -1,33 +0,0 @@
[package]
name = "hello"
version = "0.1.0"
authors = ["Gregory Schier <gschier1990@gmail.com>"]
edition = "2018"
[lib]
crate-type = ["cdylib", "rlib"]
[features]
default = ["console_error_panic_hook"]
[dependencies]
wasm-bindgen = "0.2.63"
# The `console_error_panic_hook` crate provides better debugging of panics by
# logging them with `console.error`. This is great for development, but requires
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
# code size when deploying.
console_error_panic_hook = { version = "0.1.6", optional = true }
# `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size
# compared to the default allocator's ~10K. It is slower than the default
# allocator, however.
wee_alloc = { version = "0.4.5", optional = true }
wasm-bindgen-futures = "0.4.34"
[dev-dependencies]
wasm-bindgen-test = "0.3.13"
[profile.release]
# Tell `rustc` to optimize for small code size.
opt-level = "s"

View File

@@ -1,21 +0,0 @@
use wasm_bindgen::prelude::*;
mod utils;
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global allocator.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
#[wasm_bindgen]
extern "C" {
fn alert(s: &str);
#[wasm_bindgen(js_namespace = console)]
fn log(s: &str);
}
#[wasm_bindgen]
pub fn greet() {
log("Hello from Rust WASM!");
}

View File

@@ -1,10 +0,0 @@
pub fn set_panic_hook() {
// When the `console_error_panic_hook` feature is enabled, we can call the
// `set_panic_hook` function at least once during initialization, and then
// we will get better error messages if our code ever panics.
//
// For more details see
// https://github.com/rustwasm/console_error_panic_hook#readme
#[cfg(feature = "console_error_panic_hook")]
console_error_panic_hook::set_once();
}

View File

@@ -14,10 +14,6 @@ import './main.css';
setAppearance();
// WASM stuff
// await init();
// greet();
const queryClient = new QueryClient();
await listen('updated_request', ({ payload: request }: { payload: HttpRequest }) => {

View File

@@ -1,11 +1,10 @@
import preact from '@preact/preset-vite';
import { defineConfig } from 'vite';
import { ViteRsw } from 'vite-plugin-rsw';
import topLevelAwait from 'vite-plugin-top-level-await';
// https://vitejs.dev/config/
const config = defineConfig({
plugins: [preact({ devToolsEnabled: true }), ViteRsw(), topLevelAwait()],
plugins: [preact({ devToolsEnabled: true }), topLevelAwait()],
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
// prevent vite from obscuring rust errors