summaryrefslogtreecommitdiff
path: root/Makefile.toml
diff options
context:
space:
mode:
authorjelemux <jeremias.weber@protonmail.com>2021-02-09 23:18:45 +0100
committerjelemux <jeremias.weber@protonmail.com>2021-02-09 23:18:45 +0100
commit036a567bae8346eb38f9237f59645dbcc4f1cd8c (patch)
tree21a86e3c5cb8964030c414718190af12f3d26125 /Makefile.toml
parent9df3ff8d633a18e934d4e62b0e2e718620760552 (diff)
downloadwasm-card-036a567bae8346eb38f9237f59645dbcc4f1cd8c.tar.gz
wasm-card-036a567bae8346eb38f9237f59645dbcc4f1cd8c.tar.bz2
switch to cargo-make; format files with rustfmt
Diffstat (limited to 'Makefile.toml')
-rw-r--r--Makefile.toml71
1 files changed, 71 insertions, 0 deletions
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