Upgrade your npm scripts to make them smarter and more efficient
Wireit is a build orchestration tool from Google that enhances npm, pnpm, and Yarn scripts without replacing them. It adds intelligent features like incremental builds, task caching, and dependency graphs directly into your package.json through a wireit configuration object. You continue using npm run commands exactly as before, but tasks automatically skip when inputs haven't changed, re-run only affected dependencies, and cache outputs locally or in CI.
The package solves a common pain point in JavaScript projects: npm scripts run blindly every time, even when nothing has changed. Large monorepos waste minutes re-building unchanged packages, and developers manually manage script execution order. Wireit brings build tool intelligence—similar to Make or Bazel—to standard npm workflows without requiring migration to a separate task runner. It reads file globs to detect changes, hashes inputs for cache keys, and parallelizes independent tasks.
With 186,000 weekly downloads, Wireit is used in projects that need efficient CI pipelines and local development workflows. It's particularly valuable in TypeScript monorepos where compilation is expensive, microservice architectures with multiple watch processes, and teams wanting faster builds without adopting heavier tools like Nx or Turborepo. The Apache 2.0 license and Google backing provide stability for production use.
Wireit requires Node.js and works by wrapping your script commands with dependency tracking and caching logic. Installation is a single dev dependency, and configuration lives alongside existing scripts in package.json. The tool integrates with GitHub Actions for shared caching across CI runs and includes VSCode extensions for autocomplete and validation.
// package.json configuration
{
"scripts": {
"build": "wireit",
"test": "wireit",
"dev": "wireit",
"api": "wireit"
},
"wireit": {
"build": {
"command": "tsc --build",
"files": ["src/**/*.ts", "tsconfig.json"],
"output": ["dist/**"]
},
"test": {
"command": "vitest run",
"dependencies": ["build"],
"files": ["src/**/*.ts", "tests/**/*.test.ts"],
"output": []
},
"api": {
"command": "node dist/server.js",
"service": true,
"dependencies": ["build"]
},
"dev": {
"dependencies": ["api"],
"files": [],
"output": []
}
},
"devDependencies": {
"wireit": "^0.14.12"
}
}
// Terminal usage:
// npm run build # Builds once, caches output
// npm run build # Skips—no changes detected
// npm run test # Runs after build completes
// npm run dev --watch # Starts API service, rebuilds on file changes
// WIREIT_CACHE=none npm run build # Disables caching for debuggingTypeScript monorepo builds: A workspace with 20 packages where each has a build script. Wireit tracks which packages changed since last build, compiles only those and their dependents, then caches compiled outputs. A full rebuild drops from 3 minutes to 15 seconds on subsequent runs.
Development servers with prerequisites: A Next.js app that requires Prisma client generation and TypeScript compilation before starting. Configure the dev script with dependencies on generate and build tasks. Running npm run dev --watch automatically rebuilds only changed files and restarts the server when needed.
Parallel test execution: Unit tests, integration tests, and linting run concurrently instead of sequentially. Wireit executes independent tasks simultaneously while respecting dependencies—e.g., tests wait for build completion but run alongside linting.
CI pipeline optimization: GitHub Actions jobs that build, test, and deploy. Wireit's GitHub cache mode stores task outputs between workflow runs. PR builds skip unchanged packages entirely, reducing CI time from 10 minutes to 2 minutes for typical changes.
Microservice orchestration: Local development spinning up 5 backend services plus a frontend. Mark services with service: true so they stay running while Wireit manages their build dependencies and restarts them only when source files change.
Lerna is a fast, modern build system for managing and publishing multiple JavaScript/TypeScript packages from the same repository
The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.
npm install wireitpnpm add wireitbun add wireit