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.

ScriptDescription
yarn / yarn installInstall the plugin's dependencies.
yarn cleanDelete transient directories and files (such as lib/, docs/, tmp/, *.log).
yarn clean-allRun yarn clean and remove node_modules.
yarn clean:libDelete the compiled source code (lib/).
yarn compileCompile source code into lib/.
yarn docsGenerate documentation for your plug-in. Requires that you add a typedoc.json configuration which isn't included in the generated plugin.
yarn formatPrettify your source code. This script runs automatically in the husky pre-commit hook.
yarn lintLint your source code.
yarn buildRun yarn clean, yarn compile, and yarn lint.
yarn postpackDelete the oclif.manifest.json file.
yarn prepackRun yarn build and generates oclif.manifest.json file.
yarn test:onlyRun unit tests, which are files that match the *.test.ts pattern.
yarn testRun unit tests, test compile/lint, and several checks to prevent breaking changes and documentation bugs.
yarn test:nutsRun NUT tests, which are files that match the *.nut.ts pattern.
yarn versionUpdate README with latest commands.