1
Fork 0

Move the pnpm scripts to cargo-make tasks.

This commit is contained in:
Bauke 2024-01-15 13:37:43 +01:00
parent 1549473c46
commit aa37acf1dc
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
3 changed files with 37 additions and 46 deletions

View File

@ -1,40 +1,41 @@
[tasks.fmt] # Build the website.
command = "cargo"
args = ["fmt", "${@}"]
[tasks.check]
command = "cargo"
args = ["check", "${@}"]
[tasks.clippy]
command = "cargo"
args = ["clippy", "${@}"]
[tasks.test]
command = "cargo"
args = ["test", "${@}"]
[tasks.doc]
command = "cargo"
args = ["doc", "${@}"]
[tasks.build] [tasks.build]
clear = true
command = "cargo" command = "cargo"
args = ["build", "${@}"] args = ["run", "--release"]
[tasks.complete-check] # Remove build directories.
dependencies = ["fmt", "check", "clippy", "test", "doc", "build"] [tasks.clean]
clear = true
command = "pnpm"
args = ["trash", "public"]
[tasks.code-coverage] # Deploy the website to Netlify.
workspace = false [tasks.deploy-netlify]
install_crate = "cargo-tarpaulin" clear = true
command = "pnpm"
dependencies = ["clean", "lint", "build"]
args = ["netlify", "deploy", "-p", "-d", "public/", "-s", "bauke.xyz"]
# Run all other linting tasks.
[tasks.lint]
clear = true
dependencies = ["lint-clippy", "lint-js", "lint-scss"]
# Run Clippy.
[tasks.lint-clippy]
clear = true
command = "cargo" command = "cargo"
args = [ args = ["clippy"]
"tarpaulin",
"--exclude-files=target/*", # Run XO.
"--out=html", [tasks.lint-js]
"--output-dir=coverage", clear = true
"--skip-clean", command = "pnpm"
"--target-dir=target/tarpaulin", args = ["xo"]
"--workspace"
] # Run Stylelint.
[tasks.lint-scss]
clear = true
command = "pnpm"
args = ["stylelint", "source/**/*.scss"]

View File

@ -4,12 +4,7 @@
## Development ## Development
Requires working installations of [Rust and Cargo](https://www.rust-lang.org/learn/get-started), [NodeJS](https://nodejs.org) and [pnpm](https://pnpm.io). With [Nix flakes](https://nixos.wiki/wiki/Flakes) and [direnv](https://direnv.net/) installed and enabled, all the required dependencies are automatically loaded from [`shell.nix`](./shell.nix). Then [cargo-make](https://sagiegurari.github.io/cargo-make/) can be used to build, deploy and lint the code. The available tasks are all described in the [`Makefile.toml`](Makefile.toml) configuration.
* Install the dependencies with `pnpm install`.
* Build the website with `cargo run`.
* Deploy to Netlify with `pnpm run deploy`.
* Test the code with `pnpm test`.
## License ## License

View File

@ -1,10 +1,5 @@
{ {
"private": "true", "private": "true",
"scripts": {
"deploy": "cargo run --release -q && pnpm deploy:netlify",
"deploy:netlify": "netlify deploy --prod --dir 'public/' -s bauke.xyz",
"test": "xo && stylelint 'source/**/*.scss'"
},
"dependencies": { "dependencies": {
"modern-normalize": "^1.1.0" "modern-normalize": "^1.1.0"
}, },