Introduction
Wireit is a build orchestration tool by Google that enhances existing npm/pnpm/Yarn scripts with dependency graphs, file-based caching, incremental builds, and watch mode. Instead of replacing your build tool, Wireit wraps your existing scripts and adds intelligence: it skips tasks when inputs have not changed, runs independent tasks in parallel, and watches files for automatic rebuilds.
What Wireit Does
- Adds dependency graphs between npm scripts so tasks run in correct order
- Caches task outputs based on input file fingerprints to skip unchanged work
- Runs independent tasks in parallel for faster builds
- Provides file-watch mode that reruns tasks when source files change
- Works across monorepo packages with cross-package dependencies
Architecture Overview
Wireit reads its configuration from the wireit key in package.json. Each script entry declares its command, input files, output files, and dependencies on other scripts. When a script is invoked, Wireit builds a DAG of all dependencies, fingerprints input files, and checks a local cache. If the fingerprint matches a cached run, it restores outputs from cache instead of re-executing. Independent branches of the DAG run concurrently.
Self-Hosting & Configuration
- Install as a dev dependency; no global install required
- All configuration lives in package.json under the wireit key
- Specify input files with glob patterns in the files array
- Declare task dependencies with the dependencies array referencing other script names
- Enable watch mode by running the script with WIREIT_WATCH=true or --watch flag
Key Features
- Zero migration cost — works with existing npm scripts; just wrap with wireit
- Input-based caching skips tasks when source files have not changed
- Cross-package dependencies in monorepos via colon-separated package references
- Parallel execution of independent tasks in the dependency graph
- GitHub Actions cache integration for sharing build caches across CI runs
Comparison with Similar Tools
- Turborepo — monorepo-focused build system; Wireit works at the script level without a separate config file
- Nx — full monorepo toolkit with generators; Wireit is lighter, enhancing existing scripts
- GNU Make — classic build tool with Makefile syntax; Wireit uses package.json natively
- Task — Go-based task runner with YAML config; Wireit integrates directly into the npm ecosystem
- Lerna — monorepo version/publish tool; Wireit focuses on build orchestration and caching
FAQ
Q: Does Wireit replace my build tools (tsc, esbuild, Webpack)? A: No. Wireit wraps your existing scripts and adds caching, dependencies, and parallelism. Your build tools run unchanged.
Q: Does Wireit work with pnpm and Yarn? A: Yes. Wireit works with any package manager that runs scripts from package.json.
Q: How does caching work? A: Wireit fingerprints all files listed in the files array. If the fingerprint matches a previous run, it restores outputs from a local cache directory.
Q: Can I share caches across CI runs? A: Yes. Wireit supports GitHub Actions cache integration and can store/restore caches from remote storage.