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]
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", "${@}"]
# Build the website.
[tasks.build]
clear = true
command = "cargo"
args = ["build", "${@}"]
args = ["run", "--release"]
[tasks.complete-check]
dependencies = ["fmt", "check", "clippy", "test", "doc", "build"]
# Remove build directories.
[tasks.clean]
clear = true
command = "pnpm"
args = ["trash", "public"]
[tasks.code-coverage]
workspace = false
install_crate = "cargo-tarpaulin"
# Deploy the website to Netlify.
[tasks.deploy-netlify]
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"
args = [
"tarpaulin",
"--exclude-files=target/*",
"--out=html",
"--output-dir=coverage",
"--skip-clean",
"--target-dir=target/tarpaulin",
"--workspace"
]
args = ["clippy"]
# Run XO.
[tasks.lint-js]
clear = true
command = "pnpm"
args = ["xo"]
# Run Stylelint.
[tasks.lint-scss]
clear = true
command = "pnpm"
args = ["stylelint", "source/**/*.scss"]

View File

@ -4,12 +4,7 @@
## 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).
* 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`.
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.
## License

View File

@ -1,10 +1,5 @@
{
"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": {
"modern-normalize": "^1.1.0"
},