Use Yarn Scripts
If you use sf dev generate plugin to generate your initial plugin, we include yarn scripts that help you developer and release your plugin.
The templates and core CLI plugins use 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.
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.
| 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 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. |