Skip to content
NewBun 1.4.5 is out. Release notes
AphrodyBun

Runtime · Core Runtime

Recipes with bun just

Run justfile recipes with the just task runner shipped as a Bun plugin.

bun just runs just recipes with the just plugin (bun-just, downloaded on first use). It searches the current directory and its parents for justfile or .justfile.

test:
  bun test

build: test
  bun build ./src/index.ts --outdir dist
bun just --list
bun just test
bun just --dry-run build

Recipes use just's default sh -cu interpreter. On Windows, install a POSIX shell and make sh available on PATH, or select another interpreter with set windows-shell.

Use bun just --bun-shell recipe to run recipes with Bun Shell instead. It runs with unset-variable checking and does not implement every POSIX shell feature. set shell, set windows-shell, command-line shell options and shebang recipes keep their configured interpreters. Recipe dependencies, arguments, variables, imports, modules, dotenv files, listing, formatting and exit codes behave as in just.

Enable set positional-arguments or add [positional-arguments] to a recipe to receive its name as $0 and its arguments as $1, $2, and so on:

set positional-arguments

greet name:
  @printf '%s: %s\n' "$0" "$1"

bun just greet 'Bun user' prints greet: Bun user. In shell(command, args...), $0 is the command string and the additional arguments start at $1.

Use bun --cwd path/to/project just build to select a project. Options after just belong to the recipe runner:

bun just --justfile tasks.just --working-directory . --list
bun just --fmt --check
bun just --dump --dump-format json

A package script named just takes precedence over the built-in command. Inside that script, bun just runs the built-in runner.

{{just_command()}} returns a quoted command that runs the built-in runner again, including the just subcommand and --bun-shell when it is selected. Use it for recursive recipes. just_executable() returns only the path of the executable, as in just. Recipes run with npm_lifecycle_event=just, so recursive calls stay in the built-in runner even when a recipe changes to a directory that has a package script named just.

again:
  {{just_command()}} test

Running recipes does not download a separate task runner. bun just --help lists the available options.