Updated for 0.4.0. Cleaned up makefile.toml

master
David O'Connor 5 years ago
parent 454bbdee7a
commit 9b14437513

@ -10,10 +10,19 @@ crate-type = ["cdylib"]
[dependencies] [dependencies]
seed = "^0.3.6" seed = "^0.4.0"
wasm-bindgen = "^0.2.42" wasm-bindgen = "^0.2.45"
web-sys = "^0.3.19" web-sys = "^0.3.19"
# For serialization, eg sending requests to a server. Otherwise, not required. # For serialization, eg sending requests to a server. Otherwise, not required.
serde = { version = "^1.0.85", features = ['derive'] } serde = { version = "^1.0.85", features = ['derive'] }
futures = "^0.1.26" futures = "^0.1.26"
[dev-dependencies]
wasm-bindgen-test = "0.2.45" # NOTE: keep in sync with wasm-bindgen version
[profile.release]
lto = true
opt-level = 'z'

@ -4,34 +4,22 @@ CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = "true"
PORT = "8000" PORT = "8000"
# ---- BUILD & CREATE WASMS ---- # ---- BUILD & CREATE WASMS ----
[tasks.build] [tasks.compile]
description = "Build" description = "Build"
workspace = false workspace = false
command = "cargo" command = "cargo"
args = ["build"] args = ["build"]
[tasks.build_release] [tasks.compile_release]
description = "Build, with the --release flag" description = "Build, with the --release flag"
workspace = false workspace = false
command = "cargo" command = "cargo"
args = ["build", "--release"] args = ["build", "--release"]
[tasks.create_wasm] [tasks.build]
description = "Build with wasm-pack"
install_crate = "wasm-pack"
command = "wasm-pack"
args = ["build", "--target", "no-modules", "--out-name", "package", "--dev"]
[tasks.create_wasm_release]
description = "Build with wasm-pack"
install_crate = "wasm-pack"
command = "wasm-pack"
args = ["build", "--target", "no-modules", "--out-name", "package"]
[tasks.all]
description = "Build, and create wasms" description = "Build, and create wasms"
workspace = false workspace = false
dependencies = ["build", "create_wasm"] dependencies = ["compile", "create_wasm"]
[tasks.watch] [tasks.watch]
description = "Build, create wasms, and watch/recompile files for changes" description = "Build, create wasms, and watch/recompile files for changes"
@ -39,11 +27,23 @@ workspace = false
dependencies = ["build", "create_wasm"] dependencies = ["build", "create_wasm"]
watch = { ignore_pattern="pkg/*" } watch = { ignore_pattern="pkg/*" }
[tasks.all_release] [tasks.compile_release]
description = "Build, and create wasms, with the --release flag" description = "Build, and create wasms, with the --release flag"
workspace = false workspace = false
dependencies = ["build_release", "create_wasm_release"] dependencies = ["build_release", "create_wasm_release"]
[tasks.create_wasm]
description = "Build with wasm-pack"
install_crate = { crate_name = "wasm-pack", binary = "wasm-pack", test_arg = "-V" }
command = "wasm-pack"
args = ["build", "--target", "no-modules", "--out-name", "package", "--dev"]
[tasks.create_wasm_release]
description = "Build with wasm-pack"
install_crate = { crate_name = "wasm-pack", binary = "wasm-pack", test_arg = "-V" }
command = "wasm-pack"
args = ["build", "--target", "no-modules", "--out-name", "package"]
[tasks.serve] [tasks.serve]
description = "Start server" description = "Start server"
install_crate = { crate_name = "microserver", binary = "microserver", test_arg = "-h" } install_crate = { crate_name = "microserver", binary = "microserver", test_arg = "-h" }
@ -51,6 +51,23 @@ workspace = false
command = "microserver" command = "microserver"
args = ["--port", "${PORT}"] args = ["--port", "${PORT}"]
# ---- LINT ----
[tasks.clippy]
description = "Lint with Clippy"
clear = true
workspace = false
install_crate = { rustup_component_name = "clippy", binary = "cargo-clippy", test_arg = "--help" }
command = "cargo"
args = ["clippy", "--all-features", "--", "--deny", "warnings", "--deny", "clippy::pedantic", "--deny", "clippy::nursery"]
[tasks.fmt]
description = "Format with rustfmt"
workspace = false
dependencies = ["fmt"]
# ---- TEST ---- # ---- TEST ----
[tasks.test] [tasks.test]
@ -74,12 +91,4 @@ args = ["test", "--headless", "--${@}"]
[tasks.test_h_release] [tasks.test_h_release]
extend = "test_h" extend = "test_h"
description = "Run headless tests in release mode. Ex: 'cargo make test_h firefox'. Test envs: [chrome, firefox, safari]" description = "Run headless tests in release mode. Ex: 'cargo make test_h firefox'. Test envs: [chrome, firefox, safari]"
args = ["test", "--headless", "--${@}", "--release"] args = ["test", "--headless", "--${@}", "--release"]
[tasks.test_one]
description = "Run Seed's tests. Ex: 'cargo make test firefox'. Test envs: [chrome, firefox, safari]"
clear = true
workspace = false
install_crate = { crate_name = "wasm-pack", binary = "wasm-pack", test_arg = "-V" }
command = "wasm-pack"
args = ["test", "--firefox", "--headless", "--", "--lib", "${@}"]

@ -11,9 +11,9 @@
`cargo install --force cargo-make` `cargo install --force cargo-make`
Run `cargo make all` in a terminal to build the app, and `cargo make serve` to start a dev server Run `cargo make build` in a terminal to build the app, and `cargo make serve` to start a dev server
on `127.0.0.1:8000`. on `127.0.0.1:8000`.
If you'd like the compiler automatically check for changes, recompiling as If you'd like the compiler automatically check for changes, recompiling as
needed, run `cargo make watch` instead of `cargo make all`. needed, run `cargo make watch` instead of `cargo make build`.

@ -34,7 +34,7 @@ fn update(msg: Msg, model: &mut Model, _: &mut Orders<Msg>) {
// View // View
fn view(model: &Model) -> El<Msg> { fn view(model: &Model) -> View<Msg> {
button![ button![
simple_ev(Ev::Click, Msg::Increment), simple_ev(Ev::Click, Msg::Increment),
format!("Hello, World × {}", model.val) format!("Hello, World × {}", model.val)

Loading…
Cancel
Save