wireit _Wireit upgrades your npm scripts to make them smarter and more efficient._ [![Published on npm](https://img.shields.io/npm/v/wireit.svg?logo=npm)](https://www.npmjs.com/package/wireit) [![Build Status](https://github.com/google/wireit/actions/workflows/tests.yml/badge.svg)](https://github.com/google/wireit/actions/workflows/tests.yml) [![Discord](https://discordapp.com/api/guilds/1036766782867914792/widget.png?style=shield)](https://discord.gg/chmdAwvq4e)
## Features - 🙂 Use the `npm run` commands you already know - ⛓️ Automatically run dependencies between npm scripts in parallel - 👀 Watch any script and continuously re-run on changes - 🥬 Skip scripts that are already fresh - ♻️ Cache output locally and remotely on GitHub Actions for free - 🛠️ Works with single packages, npm workspaces, and other monorepos - ✏️ [VSCode plugin](https://marketplace.visualstudio.com/items?itemName=google.wireit) gives suggestions, documentation, and warnings as you develop ## Contents - [Features](#features) - [Install](#install) - [Setup](#setup) - [VSCode Extension](#vscode-extension) - [Discord](#discord) - [Dependencies](#dependencies) - [Vanilla scripts](#vanilla-scripts) - [Cross-package dependencies](#cross-package-dependencies) - [Parallelism](#parallelism) - [Extra arguments](#extra-arguments) - [Input and output files](#input-and-output-files) - [Incremental build](#incremental-build) - [Caching](#caching) - [Local caching](#local-caching) - [GitHub Actions caching](#github-actions-caching) - [Cleaning output](#cleaning-output) - [Watch mode](#watch-mode) - [Services](#services) - [Execution cascade](#execution-cascade) - [Environment variables](#environment-variables) - [Failures and errors](#failures-and-errors) - [Package locks](#package-locks) - [Recipes](#recipes) - [TypeScript](#typescript) - [ESLint](#eslint) - [Reference](#reference) - [Configuration](#configuration) - [Dependency syntax](#dependency-syntax) - [Environment variable reference](#environment-variable-reference) - [Glob patterns](#glob-patterns) - [Fingerprint](#fingerprint) - [Requirements](#requirements) - [Related tools](#related-tools) - [Contributing](#contributing) ## Install ```sh npm i -D wireit ``` ## Setup Wireit works _with_ `npm run`, it doesn't replace it. To configure an NPM script for Wireit, move the command into a new `wireit` section of your `package.json`, and replace the original script with the `wireit` command.
Before After
{
  "scripts": {
    "build": "tsc"
  }
}
{
  "scripts": {
    "build": "wireit"
  },
  "wireit": {
    "build": {
      "command": "tsc"
    }
  }
}
Now when you run `npm run build`, Wireit upgrades the script to be smarter and more efficient. Wireit works with [yarn](https://yarnpkg.com/) (both 1.X "[Classic](https://classic.yarnpkg.com/)" and its successor "Berry") and [pnpm](https://pnpm.io/), too. You should also add `.wireit` to your `.gitignore` file. Wireit uses the `.wireit` directory to store caches and other data for your scripts. ```sh echo .wireit >> .gitignore ``` ## VSCode Extension If you use VSCode, consider installing the `google.wireit` extension. It adds documentation on hover, autocomplete, can diagnose a number of common mistakes, and even suggest a refactoring to convert an npm script to use wireit. Install it [from the marketplace](https://marketplace.visualstudio.com/items?itemName=google.wireit) or on the command line like: ``` code --install-extension google.wireit ``` ## Discord Join the [Wireit Discord](https://discord.gg/chmdAwvq4e) to chat with the Wireit community and get support for your project. [![Discord](https://discordapp.com/api/guilds/1036766782867914792/widget.png?style=banner2)](https://discord.gg/chmdAwvq4e) ## Dependencies To declare a dependency between two scripts, edit the `wireit.