just のインストール:justfile 作成、recipe 実行、make との比較

just を入れ justfile で recipe を回し、make との使い分けを押さえる。

lint → test → build を README に書いても誰も見ない。just は justfile で recipe を定義し just で実行するコマンドランナーです。本稿は macOS/Linux インストール、justfile 作成、recipe 実行、make との比較 を hereink 向けにまとめます。

検索語はjust のインストールと justfile で recipe を実行 make との違い。just --version、最初の recipe、just --list までできれば OK です。

導入brew · cargo
設定justfile
実行just · --list
installjustfilejust test

just が解くこと

発見可能なタスク

just --list で recipe 一覧。

スクリプトより軽い

変数・依存・引数を justfile に集約。

公式:github.com/casey/just、just.systems。

インストール

  1. 1
    macOS

    brew install just。

  2. 2
    Linux

    Arch: pacman -S just。古い distro は cargo install just。

  3. 3
    cargo

    cargo install just、PATH に ~/.cargo/bin。

  4. 4
    mise

    mise use -g just@latest。

justfile

default:
    just --list

test:
    cargo test

check: lint test
    echo "ok"

lint:
    cargo clippy -- -D warnings

実行

just --list
just test
just -n test

make との比較

justmake
用途タスクランナービルドグラフ
Windowsドキュメント充実GNU make / WSL 依存が多い
向く
polyglot repo、統一 dev/test。
make のまま
增量ビルドが中心の C/C++。
npm scripts と重複?

recipe から npm run を呼べる。Node 専用なら npm だけでも可。

.env は?

set dotenv-load を justfile に(公式マニュアル参照)。

タスクが揃ったら図で

スペースの作り方。

今すぐ開始