Scripts2026年4月11日·1 分钟阅读

Just — A Modern Command Runner and Makefile Alternative

Just is a command runner, like Make but for modern dev workflows. Write recipes in a Justfile, run them with `just recipe-name`. Simpler syntax than Make, no obscure behaviors, cross-platform, and works great for project tasks.

SC
Script Depot · Community
快速使用

先拿来用,再决定要不要深挖

这里应该同时让用户和 Agent 知道第一步该复制什么、安装什么、落到哪里。

# Install
brew install just                           # macOS
cargo install just                          # Rust
scoop install just                          # Windows

Create justfile in your project root:

# List recipes
default:
  @just --list

# Run tests
test:
  npm test

# Build for production
build:
  npm run build
  @echo "Build complete"

# Deploy with arg
deploy env="staging":
  ./scripts/deploy.sh {{env}}

# Multi-line recipe
release version:
  git tag v{{version}}
  git push --tags
  cargo publish

# Recipe with dependencies
ci: test build
  echo "CI passed"

Run:

just              # default recipe
just test         # run tests
just deploy prod  # with argument
just ci           # runs test then build then echo
介绍

Just is a command runner, inspired by Make but built for modern developer workflows. Written in Rust by Casey Rodarmor, it offers cleaner syntax, cross-platform support, and avoids Make quirks (tab-only indentation, .PHONY gotchas, shell escaping). Perfect for project task automation.

What Just Does

  • Recipes — named task definitions in a justfile
  • Arguments — positional and named with defaults
  • Dependencies — recipes can depend on other recipes
  • Shebang recipes — run entire recipe with python/node/bash
  • String interpolation{{var}} substitution
  • Env vars — dotenv support via set dotenv-load
  • Conditionalif os == "macos" { ... }
  • Private recipes — prefix with _
  • Groups — organize recipes into groups

Architecture

Parses the justfile, builds a DAG of recipes, and runs them via the configured shell (sh by default, or any shebang). No make-style file timestamps or incremental logic — simpler and more predictable.

Self-Hosting

Single Rust binary.

Key Features

  • Modern clean syntax
  • Cross-platform (macOS, Linux, Windows)
  • Recipe arguments with defaults
  • Dependencies and groups
  • Shebang recipes for multi-language tasks
  • Env var integration
  • Nice error messages
  • just --list auto-help
  • Tab or space indentation

Comparison

Tool Language Scope Strengths
Just Rust Task runner Simple modern syntax
Make C Build + tasks Ubiquitous, incremental
Taskfile Go Task runner YAML-based
npm scripts JS Node projects Built into npm
mise tasks Rust Task runner Integrated env manager
cargo-make Rust Rust projects Rust-focused

常见问题 FAQ

Q: 和 Make 区别? A: Just 不做增量构建(无文件时间戳追踪),专注于任务运行。语法更干净,无 tab 强制、无 .PHONY 坑。适合 project tasks,不适合 C/C++ 大型构建。

Q: 可以在 CI 用吗? A: 非常合适。CI 上 just ci 一行跑所有检查,开发者本地完全一样的体验。

Q: 支持 include 吗? A: 支持 import 语法(v1.14+)来复用 recipes。

来源与致谢 Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产