Skip to content

Prepare experimental

The mise prepare command ensures project dependencies are ready by checking if lockfiles are newer than installed outputs (e.g., package-lock.json vs node_modules/) and running install commands if needed.

Quick Start

bash
# Enable experimental features
export MISE_EXPERIMENTAL=1

# Run all applicable prepare steps
mise prepare

# Or use the alias
mise prep

Configuration

Configure prepare providers in mise.toml:

toml
# Built-in npm provider (auto-detects lockfile)
[prepare.npm]
auto = true  # Auto-run before mise x/run

# Built-in providers for other package managers
[prepare.yarn]
[prepare.pnpm]
[prepare.bun]
[prepare.go]
[prepare.pip]
[prepare.poetry]
[prepare.uv]
[prepare.bundler]
[prepare.composer]

# Custom provider
[prepare.codegen]
auto = true
sources = ["schema/*.graphql"]
outputs = ["src/generated/"]
run = "npm run codegen"

# Disable specific providers
[prepare]
disable = ["npm"]

Built-in Providers

mise includes built-in providers for common package managers:

ProviderLockfileOutputCommand
npmpackage-lock.jsonnode_modules/npm install
yarnyarn.locknode_modules/yarn install
pnpmpnpm-lock.yamlnode_modules/pnpm install
bunbun.lockb or bun.locknode_modules/bun install
gogo.modvendor/ or go.sumgo mod vendor or go mod download
piprequirements.txt.venv/pip install -r requirements.txt
poetrypoetry.lock.venv/poetry install
uvuv.lock.venv/uv sync
bundlerGemfile.lockvendor/bundle/bundle install
composercomposer.lockvendor/composer install

Built-in providers are only active when explicitly configured in mise.toml and their lockfile exists.

Custom Providers

Create custom providers for project-specific build steps:

toml
[prepare.codegen]
sources = ["schema/*.graphql", "codegen.yml"]
outputs = ["src/generated/"]
run = "npm run codegen"
description = "Generate GraphQL types"

[prepare.prisma]
sources = ["prisma/schema.prisma"]
outputs = ["node_modules/.prisma/"]
run = "npx prisma generate"

Provider Options

OptionTypeDescription
autoboolAuto-run before mise x and mise run (default: false)
sourcesstring[]Files/patterns to check for changes
outputsstring[]Files/directories that should be newer than sources
runstringCommand to run when stale
envtableEnvironment variables to set
dirstringWorking directory for the command
descriptionstringDescription shown in output

Freshness Checking

mise uses modification time (mtime) comparison to determine if outputs are stale:

  1. Find the most recent mtime among all source files
  2. Find the most recent mtime among all output files
  3. If any source is newer than all outputs, the provider is stale

This means:

  • If you modify package-lock.json, node_modules/ will be considered stale
  • If node_modules/ doesn't exist, the provider is always stale
  • If sources don't exist, the provider is considered fresh (nothing to do)

Auto-Prepare

When auto = true is set on a provider, it will automatically run before:

  • mise run (task execution)
  • mise x (exec command)

This ensures dependencies are always up-to-date before running tasks or commands.

To skip auto-prepare for a single invocation:

bash
mise run --no-prepare build
mise x --no-prepare -- npm test

Staleness Warnings

When using mise activate, mise will warn you if any auto-enabled providers have stale dependencies:

mise WARN prepare: npm may need update, run `mise prep`

This can be disabled with:

toml
[settings]
status.show_prepare_stale = false

CLI Usage

bash
# Run all applicable prepare steps
mise prepare

# Show what would run without executing
mise prepare --dry-run

# Force run even if outputs are fresh
mise prepare --force

# List available prepare providers
mise prepare --list

# Run only specific providers
mise prepare --only npm --only codegen

# Skip specific providers
mise prepare --skip npm

Parallel Execution

Prepare providers run in parallel, respecting the jobs setting for concurrency limits. This speeds up preparation when multiple providers need to run (e.g., both npm and pip).

toml
[settings]
jobs = 4  # Run up to 4 providers in parallel

Example: Full-Stack Project

toml
# mise.toml for a project with Node.js frontend and Python backend

[prepare.npm]
auto = true

[prepare.poetry]
auto = true

[prepare.prisma]
auto = true
sources = ["prisma/schema.prisma"]
outputs = ["node_modules/.prisma/"]
run = "npx prisma generate"

[prepare.frontend-codegen]
sources = ["schema.graphql", "codegen.ts"]
outputs = ["src/generated/"]
run = "npm run codegen"

Running mise prep will check all four providers and run any that are stale, in parallel.

Licensed under the MIT License. Maintained by @jdx and friends.