All Features
Development Velocity

Watch Mode

Automatically re-run tasks when files change. No more switching to the terminal and running jake build after every edit.

  • Automatic detection — Watches file target dependencies
  • Custom patterns@watch directive for tasks
  • Conditional logicis_watching() for dev-only behavior
Jakefile
# File target - watched automatically
file dist/bundle.js: src/**/*.ts
    esbuild src/index.ts --bundle --outfile=dist/bundle.js

# Task with explicit watch patterns
task dev:
    @watch src/**/*.ts tests/**/*.ts
    npm run dev

# Conditional behavior during watch
task build:
    @if is_watching()
        echo "Quick dev build..."
        esbuild src/index.ts --bundle --outfile=dist/app.js
    @else
        echo "Full production build..."
        npm run lint
        npm run typecheck
        esbuild src/index.ts --bundle --minify --outfile=dist/app.js
    @end

How It Works

Jake watches your source files and rebuilds when they change.

1

Determine Watch Patterns

Jake collects patterns from file target dependencies and @watch directives.

2

Monitor File System

Uses FSEvents (macOS) or inotify (Linux) for efficient file watching.

3

Trigger Rebuild

When a watched file changes, Jake re-runs the task. With -v, it shows which file triggered it.

Terminal
$ jake -w build

[watch] Watching 47 file(s) for changes...
[watch] Patterns: src/**/*.ts
[watch] Press Ctrl+C to stop

 build
  Quick dev build...
  esbuild src/index.ts --bundle --outfile=dist/app.js
 build (0.42s)

# Edit src/index.ts...

[watch] Change detected: src/index.ts
 build
  Quick dev build...
 build (0.18s)

# Jake keeps watching...

Conditional Watch Behavior

Use is_watching() to skip expensive operations during development.

In Watch Mode

  • Quick incremental builds
  • Skip linting
  • Skip type checking
  • Skip minification

Normal Mode / CI

  • Full production build
  • Run linting
  • Run type checking
  • Minify output

Use Cases

Watch mode for every development workflow.

Frontend Development

Auto-refresh on any source file change.

task dev:
    @watch src/**/*.{ts,tsx,css}
    npm run dev
jake -w dev

Test-Driven Development

Tests re-run automatically as you code.

task test:
    @watch src/**/*.ts tests/**/*.ts
    npm test
jake -w test

Documentation

Live preview of documentation changes.

task docs:
    @watch docs/**/*.md
    mkdocs serve
jake -w docs

Multi-Stage Builds

Chained file targets rebuild on change.

file dist/compiled.js: src/**/*.ts
    tsc

file dist/bundle.js: dist/compiled.js
    esbuild dist/compiled.js --bundle -o dist/bundle.js
jake -w dist/bundle.js

Usage

Common watch mode commands.

jake -w build Watch and rebuild on changes
jake -w "src/**/*.ts" build Watch specific pattern
jake -w -v build Verbose - show which files changed
jake -w -j4 build Parallel rebuilds on change

vs Make & Just

Neither Make nor Just has built-in watch mode. You need external tools.

Without Jake
# Need external tools
fswatch -o src/ | xargs -n1 make build

# Or install watchexec
watchexec -e ts just build

# Or nodemon
nodemon --watch src -e ts --exec "just build"
With Jake
$ jake -w build

# That's it. Built-in.
# No extra tools needed.

Try Watch Mode

Faster iteration, built into your build tool.