Migrating from Taskfile
Taskfile (taskfile.dev) is a popular YAML-based task runner. Jake provides similar features with a more concise syntax.
Syntax Comparison
Section titled “Syntax Comparison”| Taskfile | Jake |
|---|---|
version: '3' | Not needed |
tasks: block | Top-level recipes |
desc: | @desc or doc comment |
cmds: array | Indented commands |
deps: | [dependencies] |
vars: | Variable assignments |
dotenv: | @dotenv |
sources:/generates: | File recipe |
includes: | @import |
preconditions: | @needs, @require |
prompt: | @confirm |
Basic Task Conversion
Section titled “Basic Task Conversion”Taskfile
Section titled “Taskfile”version: "3"
tasks: build: desc: Build the application cmds: - go build -o app - echo "Done"# Build the applicationtask build: go build -o app echo "Done"Variables
Section titled “Variables”Taskfile
Section titled “Taskfile”version: "3"
vars: APP_NAME: myapp VERSION: sh: git describe --tags
tasks: show: cmds: - echo "{{.APP_NAME}} v{{.VERSION}}"app_name = "myapp"version = `git describe --tags`
task show: echo "{{app_name}} v{{version}}"Dependencies
Section titled “Dependencies”Taskfile
Section titled “Taskfile”tasks: build: deps: [clean, install] cmds: - go build -o app
clean: cmds: - rm -rf dist/
install: cmds: - go mod downloadtask build: [clean, install] go build -o app
task clean: rm -rf dist/
task install: go mod downloadFile Tracking (sources/generates)
Section titled “File Tracking (sources/generates)”Taskfile
Section titled “Taskfile”tasks: bundle: desc: Bundle JavaScript files sources: - src/**/*.js - package.json generates: - dist/bundle.js cmds: - esbuild src/index.js --bundle --outfile=dist/bundle.js# Bundle JavaScript filesfile dist/bundle.js: src/**/*.js package.json esbuild src/index.js --bundle --outfile=dist/bundle.jsJake uses checksum-based tracking like Taskfile, but with a cleaner syntax.
Environment Variables
Section titled “Environment Variables”Taskfile
Section titled “Taskfile”version: "3"
dotenv: [".env", ".env.local"]
env: DEBUG: true
tasks: serve: env: PORT: 8080 cmds: - ./server@dotenv@dotenv ".env.local"@export DEBUG=true
task serve: PORT=8080 ./serverIncludes / Imports
Section titled “Includes / Imports”Taskfile
Section titled “Taskfile”version: "3"
includes: docker: taskfile: ./tasks/Docker.yml dir: ./docker vars: IMAGE: myapp
tasks: build: cmds: - task: docker:build@import "tasks/docker.jake" as docker
task build: [docker.build] echo "Build complete"Preconditions
Section titled “Preconditions”Taskfile
Section titled “Taskfile”tasks: deploy: preconditions: - sh: test -f .env msg: ".env file required" - sh: command -v kubectl msg: "kubectl not installed" cmds: - kubectl apply -f deploy.yaml@needs kubectltask deploy: @if not exists(.env) echo ".env file required" exit 1 @end kubectl apply -f deploy.yamlOr more concisely with @require for environment checks:
@require KUBECONFIG@needs kubectl
task deploy: kubectl apply -f deploy.yamlConfirmation Prompts
Section titled “Confirmation Prompts”Taskfile
Section titled “Taskfile”tasks: deploy: prompt: Deploy to production? cmds: - ./deploy.shtask deploy: @confirm "Deploy to production?" ./deploy.shFor Loops
Section titled “For Loops”Taskfile
Section titled “Taskfile”tasks: build-images: vars: IMAGES: nginx postgres redis cmds: - for: { var: IMAGES, split: " " } cmd: docker build -t {{.ITEM}} .task build-images: @each nginx postgres redis docker build -t {{item}} . @endDeferred Commands (Cleanup)
Section titled “Deferred Commands (Cleanup)”Taskfile
Section titled “Taskfile”tasks: test: cmds: - docker-compose up -d - defer: docker-compose down - go test ./...task test: @pre docker-compose up -d go test ./... @post docker-compose downPost-hooks run even if the recipe fails.
Platform-Specific Tasks
Section titled “Platform-Specific Tasks”Taskfile
Section titled “Taskfile”tasks: install: platforms: [linux, darwin] cmds: - make install
install-windows: platforms: [windows] cmds: - choco install myapp@platform linux macostask install: make install
@platform windowstask install: choco install myappComplete Migration Example
Section titled “Complete Migration Example”Before (Taskfile.yml)
Section titled “Before (Taskfile.yml)”version: "3"
dotenv: [".env"]
vars: APP_NAME: myapp BUILD_DIR: dist
tasks: default: deps: [build]
build: desc: Build the application deps: [clean, install] sources: - src/**/*.go - go.mod generates: - "{{.BUILD_DIR}}/{{.APP_NAME}}" cmds: - mkdir -p {{.BUILD_DIR}} - go build -o {{.BUILD_DIR}}/{{.APP_NAME}}
install: desc: Install dependencies cmds: - go mod download sources: - go.mod - go.sum
clean: desc: Remove build artifacts cmds: - rm -rf {{.BUILD_DIR}}
test: desc: Run tests deps: [build] cmds: - go test ./... -v
deploy: desc: Deploy to server deps: [test] prompt: "Deploy to production?" cmds: - rsync -avz {{.BUILD_DIR}}/ server:/app/After (Jakefile)
Section titled “After (Jakefile)”@dotenv
app_name = "myapp"build_dir = "dist"
@defaulttask build: [clean, install, dist/{{app_name}}] @desc "Build the application"
file dist/{{app_name}}: src/**/*.go go.mod mkdir -p {{build_dir}} go build -o {{build_dir}}/{{app_name}}
task install: @desc "Install dependencies" @cache go.mod go.sum go mod download
task clean: @desc "Remove build artifacts" rm -rf {{build_dir}}
task test: [build] @desc "Run tests" go test ./... -v
task deploy: [test] @desc "Deploy to server" @confirm "Deploy to production?" rsync -avz {{build_dir}}/ server:/app/CLI Comparison
Section titled “CLI Comparison”| Taskfile | Jake |
|---|---|
task | jake |
task build | jake build |
task --list | jake --list |
task --dry | jake -n |
task --watch | jake -w |
task --parallel t1 t2 | jake -j t1 t2 |
task --force | Delete cache, re-run |
task VAR=value | jake var=value |
Key Differences
Section titled “Key Differences”- Syntax: Jake uses a Makefile-inspired DSL instead of YAML
- File recipes: Jake has dedicated
filekeyword vssources/generates - Simpler structure: No version declaration or nesting required
- Single binary: Both are single binaries, but Jake is smaller (Zig vs Go)
What You Keep
Section titled “What You Keep”- Checksum-based file tracking
- Parallel execution
- Includes with namespacing
- Environment variable support
- Watch mode
- Cross-platform support
See Also
Section titled “See Also”- Migrating from Make - For Make users
- File Targets - Jake’s file recipes
- Imports - Organizing with imports