diff --git a/.gitignore b/.gitignore index 96ef6c0..2c96eb1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -/target +target/ Cargo.lock diff --git a/Cargo.toml b/Cargo.toml index 39d7f93..397f076 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,32 +1,13 @@ [package] +authors = ["Rob Watson "] +description = "Rust-powered audio editing" name = "audioview" -version = "0.1.0" -authors = ["Rob Watson "] +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] diff --git a/Makefile b/Makefile index 57c0c68..de57d80 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/frontend-core/Cargo.toml b/frontend-core/Cargo.toml new file mode 100644 index 0000000..bbae2f6 --- /dev/null +++ b/frontend-core/Cargo.toml @@ -0,0 +1,31 @@ +[package] +name = "audioview-frontend-core" +version = "0.1.0" +authors = ["Rob Watson "] +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", +] + diff --git a/src/agents/audio_agent.rs b/frontend-core/src/agents/audio_agent.rs similarity index 100% rename from src/agents/audio_agent.rs rename to frontend-core/src/agents/audio_agent.rs diff --git a/src/agents/mod.rs b/frontend-core/src/agents/mod.rs similarity index 100% rename from src/agents/mod.rs rename to frontend-core/src/agents/mod.rs diff --git a/src/components/app.rs b/frontend-core/src/components/app.rs similarity index 100% rename from src/components/app.rs rename to frontend-core/src/components/app.rs diff --git a/src/components/home.rs b/frontend-core/src/components/home.rs similarity index 100% rename from src/components/home.rs rename to frontend-core/src/components/home.rs diff --git a/src/components/mod.rs b/frontend-core/src/components/mod.rs similarity index 100% rename from src/components/mod.rs rename to frontend-core/src/components/mod.rs diff --git a/src/components/player.rs b/frontend-core/src/components/player.rs similarity index 100% rename from src/components/player.rs rename to frontend-core/src/components/player.rs diff --git a/src/components/waveform/canvas.rs b/frontend-core/src/components/waveform/canvas.rs similarity index 100% rename from src/components/waveform/canvas.rs rename to frontend-core/src/components/waveform/canvas.rs diff --git a/src/components/waveform/container.rs b/frontend-core/src/components/waveform/container.rs similarity index 100% rename from src/components/waveform/container.rs rename to frontend-core/src/components/waveform/container.rs diff --git a/src/components/waveform/mod.rs b/frontend-core/src/components/waveform/mod.rs similarity index 100% rename from src/components/waveform/mod.rs rename to frontend-core/src/components/waveform/mod.rs diff --git a/frontend-core/src/lib.rs b/frontend-core/src/lib.rs new file mode 100644 index 0000000..3fb7d68 --- /dev/null +++ b/frontend-core/src/lib.rs @@ -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::::new().mount_to_body(); +} diff --git a/src/utils.rs b/frontend-core/src/utils.rs similarity index 100% rename from src/utils.rs rename to frontend-core/src/utils.rs diff --git a/src/lib.rs b/src/lib.rs index 3fb7d68..bdf0c0f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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::::new().mount_to_body(); -} +// Core library