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]
seed = "^0.3.6"
wasm-bindgen = "^0.2.42"
seed = "^0.4.0"
wasm-bindgen = "^0.2.45"
web-sys = "^0.3.19"
# For serialization, eg sending requests to a server. Otherwise, not required.
serde = { version = "^1.0.85", features = ['derive'] }
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"
# ---- BUILD & CREATE WASMS ----
[tasks.build]
[tasks.compile]
description = "Build"
workspace = false
command = "cargo"
args = ["build"]
[tasks.build_release]
[tasks.compile_release]
description = "Build, with the --release flag"
workspace = false
command = "cargo"
args = ["build", "--release"]
[tasks.create_wasm]
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]
[tasks.build]
description = "Build, and create wasms"
workspace = false
dependencies = ["build", "create_wasm"]
dependencies = ["compile", "create_wasm"]
[tasks.watch]
description = "Build, create wasms, and watch/recompile files for changes"
@ -39,11 +27,23 @@ workspace = false
dependencies = ["build", "create_wasm"]
watch = { ignore_pattern="pkg/*" }
[tasks.all_release]
[tasks.compile_release]
description = "Build, and create wasms, with the --release flag"
workspace = false
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]
description = "Start server"
install_crate = { crate_name = "microserver", binary = "microserver", test_arg = "-h" }
@ -51,6 +51,23 @@ workspace = false
command = "microserver"
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 ----
[tasks.test]
@ -75,11 +92,3 @@ args = ["test", "--headless", "--${@}"]
extend = "test_h"
description = "Run headless tests in release mode. Ex: 'cargo make test_h firefox'. Test envs: [chrome, firefox, safari]"
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`
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`.
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
fn view(model: &Model) -> El<Msg> {
fn view(model: &Model) -> View<Msg> {
button![
simple_ev(Ev::Click, Msg::Increment),
format!("Hello, World × {}", model.val)

Loading…
Cancel
Save