task-runner

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Task Runner

任务运行器

Purpose

用途

Execute project-specific commands using just, a modern command runner that's simpler than make and works cross-platform.
使用just执行项目专属命令,just是一款比make更简洁且支持跨平台的现代命令运行器。

Tools

工具

ToolCommandUse For
just
just
List available recipes
just
just test
Run specific recipe
工具命令用途
just
just
列出可用任务
just
just test
运行指定任务

Usage Examples

使用示例

Basic Usage

基础用法

bash
undefined
bash
undefined

List all available recipes

列出所有可用任务

just
just

Run a recipe

运行某一任务

just test just build just lint
just test just build just lint

Run recipe with arguments

带参数运行任务

just deploy production
just deploy production

Run specific recipe from subdirectory

从子目录运行指定任务

just --justfile backend/justfile test
undefined
just --justfile backend/justfile test
undefined

Common justfile Recipes

常见justfile任务示例

just
undefined
just
undefined

Example justfile

示例justfile

Run tests

运行测试

test: pytest tests/
test: pytest tests/

Build project

构建项目

build: npm run build
build: npm run build

Lint code

代码检查

lint: ruff check . eslint src/
lint: ruff check . eslint src/

Start development server

启动开发服务器

dev: npm run dev
dev: npm run dev

Clean build artifacts

清理构建产物

clean: rm -rf dist/ build/ *.egg-info/
clean: rm -rf dist/ build/ *.egg-info/

Deploy to environment

部署到指定环境

deploy env: ./scripts/deploy.sh {{env}}
undefined
deploy env: ./scripts/deploy.sh {{env}}
undefined

Discovery

功能发现

bash
undefined
bash
undefined

Check if justfile exists

检查是否存在justfile

just --summary
just --summary

Show recipe details

查看任务详情

just --show test
just --show test

List recipes with descriptions

列出带描述的任务

just --list
undefined
just --list
undefined

When to Use

适用场景

  • First check:
    just
    to see available project commands
  • Running tests:
    just test
  • Building:
    just build
  • Any project-specific task
  • Cross-platform command running
  • 首次检查:执行
    just
    查看项目可用命令
  • 运行测试:
    just test
  • 构建项目:
    just build
  • 任何项目专属任务
  • 跨平台命令执行

Best Practice

最佳实践

Always check for a justfile when entering a new project:
bash
just --list
This shows what commands are available without reading documentation.
进入新项目时,务必先检查justfile:
bash
just --list
无需阅读文档即可了解可用命令。