Skip to content

axle migrate

Terminal window
axle migrate
axle migrate --check
axle migrate --upgrade

When a setting is renamed or changes shape, Axle refuses the old one with migration-needed, so a repository never runs with settings Axle reads differently. axle migrate rewrites them for you, in every file Axle reads its settings from:

  • the root axle.toml;
  • each preset it extends from a folder in the repository, such as ./config/axle.toml, and the presets those extend in turn;
  • the settings of each plugin under [plugins] that can migrate them.

Everything else in those files stays as it is, comments and formatting included. Presets installed as npm packages aren’t changed: update the package instead. axle migrate prints each file it updates, then one line for each change, such as:

Updated axle.toml
axle.toml: env at the root is now globalEnv

Running it again changes nothing, and prints “Nothing to migrate: the settings are up to date.”

Since Before After
0.1 env at the root globalEnv
0.1 passThroughEnv at the root globalPassThroughEnv

env and passThroughEnv in a task keep their names. A file that sets both the old and the new name stops axle migrate with file-has-a-mistake before anything is written: move what the old key lists into the new one, and delete the old one.

axle migrate --upgrade also asks each plugin under [plugins] that can upgrade to move the projects it knows about to the version of its tool that it supports, and to make the changes to their code and settings that the new version needs, which a codemod would. The Next.js plugin, for example, moves apps to Next.js 16 and replaces next lint in their scripts.

Updated apps/web/package.json
plugin next: web: next ^15.3.0 is now ^16.0.0
plugin next: web: the lint script runs eslint . instead of next lint, which Next.js 16 removed

A plugin knows the version it supports, so updating the plugin’s source in axle.toml and running axle migrate --upgrade is how a repository moves to a new version of a tool. A project that’s already there, or that takes the tool from workspace:, a link or a tag, is left alone. The settings are migrated first, then the plugins read the files as they are on disk. With --dry-run or --check and settings that still need migrating, the plugins’ changes show once you’ve run axle migrate.

When a package.json changed, Axle says to install the dependencies again, so the lockfile has the new versions. Then run the builds and tests, check the changes, and commit them. Two plugins that would change the same file stop axle migrate --upgrade before it writes anything.

Option What it does
--check changes nothing, and fails with migration-needed when any file needs migrating
--dry-run shows the changes as a diff, and writes nothing
--upgrade also asks the plugins to upgrade the tools they know about, and the code that needs it

Run axle migrate after updating Axle, check the changes, and commit them.