til.jpace121/posts/quick_just_review.qmd

39 lines
1.2 KiB
Plaintext

---
title: "Just: A quick review"
author: "James Pace"
date: "2024/01/10"
---
[Just](https://just.systems/man/en/) is a command runner that operates kind of like make.
Just lets you define tasks in a simple, human-readable file called a Justfile.
To run a task, simply call `just <task_name>`. Just will automatically find the
Justfile in the nearest parent directory and execute the commands defined for that
task.
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. Eliminates the need for manual .PHONY target creation, saving you time and reducing
clutter in Justfiles compared to Makefiles.
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 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 and lead to quicker
iterations.