From 9b14437513ad9e45012632addd82ca54093528c6 Mon Sep 17 00:00:00 2001 From: David O'Connor Date: Sun, 28 Jul 2019 21:16:06 +0400 Subject: [PATCH] Updated for 0.4.0. Cleaned up makefile.toml --- .gitignore | 0 Cargo.toml | 13 +++++++++-- Makefile.toml | 61 +++++++++++++++++++++++++++++---------------------- README.md | 4 ++-- index.html | 0 src/lib.rs | 2 +- 6 files changed, 49 insertions(+), 31 deletions(-) mode change 100644 => 100755 .gitignore mode change 100644 => 100755 Cargo.toml mode change 100644 => 100755 Makefile.toml mode change 100644 => 100755 README.md mode change 100644 => 100755 index.html mode change 100644 => 100755 src/lib.rs diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/Cargo.toml b/Cargo.toml old mode 100644 new mode 100755 index 3d90de9..65d19dc --- a/Cargo.toml +++ b/Cargo.toml @@ -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' \ No newline at end of file diff --git a/Makefile.toml b/Makefile.toml old mode 100644 new mode 100755 index e855b2d..e3f35e2 --- a/Makefile.toml +++ b/Makefile.toml @@ -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] @@ -74,12 +91,4 @@ args = ["test", "--headless", "--${@}"] [tasks.test_h_release] 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", "${@}"] +args = ["test", "--headless", "--${@}", "--release"] \ No newline at end of file diff --git a/README.md b/README.md old mode 100644 new mode 100755 index a8eaf71..e301cc2 --- a/README.md +++ b/README.md @@ -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`. diff --git a/index.html b/index.html old mode 100644 new mode 100755 diff --git a/src/lib.rs b/src/lib.rs old mode 100644 new mode 100755 index bddcc78..0544623 --- a/src/lib.rs +++ b/src/lib.rs @@ -34,7 +34,7 @@ fn update(msg: Msg, model: &mut Model, _: &mut Orders) { // View -fn view(model: &Model) -> El { +fn view(model: &Model) -> View { button![ simple_ev(Ev::Click, Msg::Increment), format!("Hello, World × {}", model.val)