Move existing code to subcrate

This commit is contained in:
Rob Watson 2020-09-16 15:02:15 +02:00
parent 3c9a59df3f
commit 080f509385
16 changed files with 64 additions and 54 deletions

2
.gitignore vendored
View File

@ -1,2 +1,2 @@
/target
target/
Cargo.lock

View File

@ -1,32 +1,13 @@
[package]
authors = ["Rob Watson <rfwatson@users.no-reply.github.com>"]
description = "Rust-powered audio editing"
name = "audioview"
version = "0.1.0"
authors = ["Rob Watson <rob@netflux.io>"]
version = "1.0.0"
edition = "2018"
[lib]
crate-type = ["cdylib", "rlib"]
[dependencies]
yew = "0.17"
#yew = { path = "/home/rob/dev/yew/yew" }
yewtil = "0.3.1"
wasm-bindgen = "0.2"
js-sys = "0.3.44"
futures = "0.3.5"
cpal = { path = "/home/rob/dev/cpal", version = "0.12.1", features = ["wasm-bindgen"] }
wasm-bindgen-futures = "0.4"
console_error_panic_hook = "0.1.6"
[dependencies.web-sys]
version = "0.3.44"
features = [
"console",
"AudioContext",
"AudioBuffer",
"HtmlCanvasElement",
"CanvasRenderingContext2d",
"Window",
[workspace]
members = [
"frontend-core",
]
[profile.release]

View File

@ -1,19 +1,16 @@
# Based on https://raw.githubusercontent.com/saschagrunert/webapp.rs/master/Makefile
.PHONY: \
build \
run
all: build-frontend
all: build
build:
wasm-pack build --dev --target web --out-name wasm --out-dir ./static
build-frontend:
cd frontend-core && \
wasm-pack build --dev --target web --out-name wasm --out-dir ./static
build-doc:
cargo doc --all --no-deps
run:
simple-http-server -i ./static/ -p 3000 --nocache --try-file ./static/index.html
simple-http-server -i ./frontend-core/static/ -p 3000 --nocache --try-file ./frontend-core/static/index.html
lint: lint-rustfmt lint-clippy

31
frontend-core/Cargo.toml Normal file
View File

@ -0,0 +1,31 @@
[package]
name = "audioview-frontend-core"
version = "0.1.0"
authors = ["Rob Watson <rob@netflux.io>"]
edition = "2018"
[lib]
crate-type = ["cdylib", "rlib"]
[dependencies]
yew = "0.17"
#yew = { path = "/home/rob/dev/yew/yew" }
yewtil = "0.3.1"
wasm-bindgen = "0.2"
js-sys = "0.3.44"
futures = "0.3.5"
cpal = { path = "/home/rob/dev/cpal", version = "0.12.1", features = ["wasm-bindgen"] }
wasm-bindgen-futures = "0.4"
console_error_panic_hook = "0.1.6"
[dependencies.web-sys]
version = "0.3.44"
features = [
"console",
"AudioContext",
"AudioBuffer",
"HtmlCanvasElement",
"CanvasRenderingContext2d",
"Window",
]

20
frontend-core/src/lib.rs Normal file
View File

@ -0,0 +1,20 @@
#![recursion_limit = "1024"]
extern crate console_error_panic_hook;
extern crate js_sys;
use std::panic;
use wasm_bindgen::prelude::*;
use yew::prelude::*;
mod agents;
mod components;
mod utils;
#[wasm_bindgen(start)]
pub fn run_app() {
#[cfg(debug_assertions)]
panic::set_hook(Box::new(console_error_panic_hook::hook));
App::<components::App>::new().mount_to_body();
}

View File

@ -1,20 +1 @@
#![recursion_limit = "1024"]
extern crate console_error_panic_hook;
extern crate js_sys;
use std::panic;
use wasm_bindgen::prelude::*;
use yew::prelude::*;
mod agents;
mod components;
mod utils;
#[wasm_bindgen(start)]
pub fn run_app() {
#[cfg(debug_assertions)]
panic::set_hook(Box::new(console_error_panic_hook::hook));
App::<components::App>::new().mount_to_body();
}
// Core library