Skip to content

axle sync

Terminal window
axle sync
axle sync --check

Some files repeat what the graph already says, such as the references in each tsconfig.json. axle sync writes them from the graph, so they never fall behind the dependencies in package.json.

Turn it on in the root axle.toml:

[sync]
typescriptReferences = true

Then axle sync updates every package that has a tsconfig.json:

  • its references list each package it depends on that has a tsconfig.json too, such as { "path": "../ui" };
  • a reference to a workspace package it doesn’t depend on any more is removed;
  • references to anything else, such as ./tsconfig.node.json in the same package, stay where they are.

A root tsconfig.json that already has references lists every package with a tsconfig.json, so tsc --build at the root builds them all. Everything else in those files stays as it is, comments and formatting included. TypeScript needs "composite": true in each referenced package’s tsconfig.json; axle sync doesn’t add it.

A plugin that can sync writes its own files the same way, such as the CODEOWNERS the owners plugin keeps from each project’s owners. axle sync asks each such plugin for the files it wants, with every project, its tags and its dependencies, and writes those whose contents differ alongside the TypeScript references. A plugin can’t write outside the repository or into .git, and two that want the same file stop axle sync before it writes anything. If a plugin fails, axle sync stops too, since it can’t tell whether its files are current.

Option What it does
--check changes nothing, and fails with sync-out-of-date when any file is out of date
--dry-run shows the changes as a diff, and writes nothing

axle sync prints each file it updates, or “Nothing to change.” With typescriptReferences off and no plugin that syncs, it says there’s nothing to sync and passes, --check included. Run axle sync --check in CI so a pull request that changes dependencies also updates the files.