til.jpace121/blog/quick_just_review.qmd

42 lines
1.4 KiB
Plaintext

---
title: "Quick Review of Just"
author: "James Pace"
date: "2024/01/10"
draft: true
---
[Just](https://just.systems/man/en/) is a command runner that operates kind of like make,
if make was a command runner, not a build tool.
When you call `just <thing>`, just looks for a `Justfile` in a parent directory, and does
whatever is under the `<thing>` entry in the file, where "things under" includes running a set
of bash commands or running a script that can be written inline.
For example, given the `Justfile`:
```
build:
cargo build
test:
cargo test --features log
```
the command `just test` will call `cargo test --features log` in the current terminal window.
Compared to `make`, `just`:
1. Doesn't require `.PHONY` targets for targets that don't produce any files.
2. Can be called below the directory the `Justfile` is in, and still find the `Justfile`
in the parent directory.
In my recent development where I was doing development calling wasm written in rust in a
web app, I found `just` particularly useful.
Building the app took multiple commands, one command for compiling the rust part and
a second command to bundle the JavaScript.
Combining things under a single `just` target was nice.
I considered just using `make` for this application, but:
1. Having to add .PHONY targets adds line noise that adds up.
2. I found being able to call `just` from any subdirectory really
convenient.