---
schema_version: "1"
id: e0cc784e397365b1e9b3e678c459767991ca9439bd819280d973b0288e507075
title: Use Yarn Scripts
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfcliplugin/guides/code/yarn-scripts.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-cli-plugin/guide/yarn-scripts.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: a04a9eb00e34b9055704fe863731e2aae9d286e44df69bfea17fed1973f08730
products:
  - Salesforce CLI Plugin Developer Guide
  - salesforcedx
---
# Use Yarn Scripts

If you use `sf dev generate plugin` to generate your initial plugin, we include [`yarn`](https://www.npmjs.com/package/yarn) scripts that help you developer and release your plugin.

## wireit

The templates and core CLI plugins use [wireit](https://github.com/google/wireit) by default. This tool simplifies running scripts in parallel, understands script dependencies, and uses cached results based on file changes.

If you want to use different scripts, or add to the wireit configuration, modify `sfdevrc.json` and not `package.json`. Otherwise, the `yarn install` scripts keep changing it back to the default. The properties under `wireit` in `sfdevrc.json` overwrite the matching property in `package.json#wireit` during `yarn install`. See [this example](https://github.com/salesforcecli/cli-plugins-testkit/blob/f9b0ecd9f373d94e3daf4fbc61eb9a4d63657da0/.sfdevrc.json#L2).

For better performance, We encourage you to use `wireit` `dependencies` over npm-style hooks, such as `pretest`.

If you suspect incorrect results due to caching, run `yarn clean-all` to delete all the cached materials.

## Scripts

| Script                  | Description                                                                                                                                                                                                |
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `yarn` / `yarn install` | Install the plugin's dependencies.                                                                                                                                                                         |
| `yarn clean`            | Delete transient directories and files (such as `lib/`, `docs/`, `tmp/`, `*.log`).                                                                                                                         |
| `yarn clean-all`        | Run `yarn clean` and remove `node_modules`.                                                                                                                                                                |
| `yarn clean:lib`        | Delete the compiled source code (`lib/`).                                                                                                                                                                  |
| `yarn compile`          | Compile source code into `lib/`.                                                                                                                                                                           |
| `yarn docs`             | Generate documentation for your plug-in. Requires that you add a [`typedoc.json` configuration](https://typedoc.org/guides/installation/#json-configuration) which isn't included in the generated plugin. |
| `yarn format`           | Prettify your source code. This script runs automatically in the husky `pre-commit` hook.                                                                                                                  |
| `yarn lint`             | Lint your source code.                                                                                                                                                                                     |
| `yarn build`            | Run `yarn clean`, `yarn compile`, and `yarn lint`.                                                                                                                                                         |
| `yarn postpack`         | Delete the `oclif.manifest.json` file.                                                                                                                                                                     |
| `yarn prepack`          | Run `yarn build` and generates `oclif.manifest.json` file.                                                                                                                                                 |
| `yarn test:only`        | Run unit tests, which are files that match the `*.test.ts` pattern.                                                                                                                                        |
| `yarn test`             | Run unit tests, test compile/lint, and several checks to prevent breaking changes and documentation bugs.                                                                                                  |
| `yarn test:nuts`        | Run NUT tests, which are files that match the `*.nut.ts` pattern.                                                                                                                                          |
| `yarn version`          | Update README with latest commands.                                                                                                                                                                        |
