Install and use the wireit VSCode extension
mainpackage.json files that utilize the wireit script runner. It enhances the developer experience by providing autocompletion, documentation, and refactoring tools directly within VSCode.repository·main·Indexed 27 days ago
https://github.com/google/wireitA tool to upgrade npm scripts with dependency management, parallelism, and incremental builds via caching. Wireit integrates with package.json to provide features such as watch mode, clean builds, and support for long-running services, as well as local and GitHub Actions caching.
package.json files that utilize the wireit script runner. It enhances the developer experience by providing autocompletion, documentation, and refactoring tools directly within VSCode.To publish the extension to the Marketplace, you must create a Personal Access Token (PAT) in Azure DevOps with specific scopes:
polymer-vscode.Custom defined (e.g., 1 year).Custom defined.Install wireit as a development dependency using npm.
npm i -D wireitoutput from a cache if the configuration and files haven't changed. To enable caching, you must define both the files and output arrays in your script configuration. For scripts that produce no files (like tests), set "output": [] to allow skipping tests if inputs remain unchanged.To enable features like Watch mode, Clean build, Incremental build, and Caching, you must define files (inputs) and output (outputs) using glob patterns in the wireit.<script> configuration.
| Feature | Requires files | Requires output |
|---|---|---|
| Dependency graph | - | - |
| Watch mode | ☑️ | - |
| Clean build | - | ☑️ |
| Incremental build | ☑️ | ☑️ |
| Caching | ☑️ | ☑️ |
Note: If a script has no files or output defined, it will always run. To tell Wireit it is safe to skip a script that has no inputs/outputs, set them to empty arrays: "files": [], "output": [].
{
"scripts": {
"build": "wireit",
"bundle": "wireit"
},
"wireit": {
"build": {
"command": "tsc",
"files": ["src/**/*.ts", "tsconfig.json"],
"output": ["lib/**"]
},
"bundle": {
"command": "rollup -c",
"dependencies": ["build"],
"files": ["rollup.config.json"],
"output": ["dist/bundle.js"]
}
}
}install-extension script. If you want the extension to rebuild and reinstall automatically on every file change, use the --watch flag. Note that after a rebuild, you must run the Developer: Reload Window command within VSCode to apply the changes.--watch flag to your execution command. For example, to watch your tests, use npm test --watch.npm test --watchUse a double-dash -- to pass arguments through Wireit to the underlying command.
Standard npm usage:
npm run {script} {npm args} {wireit args} -- {script args}
Example:
npm run build -- --verbose
Using node --run:
node --run {script} {node args} -- {wireit args} -- {script args}
npm run build -- --verboseFollow these steps to prepare and publish a new version of the extension:
cd wireit/vscode-extension.built/package.json following semver.CHANGELOG.md with the release notes.npm run package.npm run install-extension, reload VSCode, and perform manual testing.main.npx vsce login google (use your PAT when prompted)..vsix file: npx vsce publish -i built/wireit.vsix.cd wireit/vscode-extension
# ... (edit built/package.json and CHANGELOG.md) ...
npm run package
npm run install-extension
# ... (merge PR to main) ...
npx vsce login google
npx vsce publish -i built/wireit.vsixLocal caching stores files in the .wireit folder within each package. It is enabled by default unless the CI=true environment variable is detected.
WIREIT_CACHE=localWIREIT_CACHE=nonerm -rf .wireit/*/cacheIn GitHub Actions, Wireit uses the GitHub Actions cache service. To enable this, add the following uses clause to your workflow before your npm run or npm test commands:
- uses: google/wireit@setup-github-actions-caching/v2# Example workflow snippet
- uses: google/wireit@setup-github-actions-caching/v2
- run: npm ci
- run: npm testBefore using Wireit, ensure your environment meets the following requirements:
npm, node --run, pnpm, and yarn.The extension provides several productivity features for managing wireit configurations in package.json: