From 036a567bae8346eb38f9237f59645dbcc4f1cd8c Mon Sep 17 00:00:00 2001 From: jelemux Date: Tue, 9 Feb 2021 23:18:45 +0100 Subject: switch to cargo-make; format files with rustfmt --- Makefile.toml | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Makefile.toml (limited to 'Makefile.toml') diff --git a/Makefile.toml b/Makefile.toml new file mode 100644 index 0000000..00ea9b9 --- /dev/null +++ b/Makefile.toml @@ -0,0 +1,71 @@ +[env] +PORT = "8000" + +[config] +skip_core_tasks = true + +# ---- BASIC ---- + +[tasks.watch] +description = "Watch files and recompile the project on change" +run_task = [ + { name = "build" }, +] +watch = true + +[tasks.serve] +description = "Start server" +install_crate = { crate_name = "microserver", binary = "microserver", test_arg = "-h" } +command = "microserver" +args = ["--port", "${PORT}"] + +[tasks.verify] +description = "Format, lint with Clippy and run tests" +dependencies = ["fmt", "clippy", "test_h_firefox"] + +# ---- BUILD ---- + +[tasks.build] +description = "Build with wasm-pack" +install_crate = { crate_name = "wasm-pack", binary = "wasm-pack", test_arg = "-V" } +command = "wasm-pack" +args = ["build", "--target", "web", "--out-name", "app", "--dev", "--debug"] + +[tasks.build_release] +description = "Build with wasm-pack in release mode" +install_crate = { crate_name = "wasm-pack", binary = "wasm-pack", test_arg = "-V" } +command = "wasm-pack" +args = ["build", "--target", "web", "--out-name", "app", "--release"] + +# ---- LINT ---- + +[tasks.clippy] +description = "Lint with Clippy" +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" +install_crate = { rustup_component_name = "rustfmt", binary = "rustfmt", test_arg = "-V" } +command = "cargo" +args = ["fmt"] + + +# ---- TEST ---- + +[tasks.test_h] +description = "Run headless tests. Ex: 'cargo make test_h firefox'. Test envs: [chrome, firefox, safari]" +extend = "test" +args = ["test", "--headless", "--${@}"] + +[tasks.test_h_firefox] +description = "Run headless tests with Firefox." +extend = "test" +args = ["test", "--headless", "--firefox"] + +[tasks.test] +description = "Run tests. Ex: 'cargo make test firefox'. Test envs: [chrome, firefox, safari]" +install_crate = { crate_name = "wasm-pack", binary = "wasm-pack", test_arg = "-V" } +command = "wasm-pack" +args = ["test", "--${@}"] \ No newline at end of file -- cgit v1.2.3