npmRunOptional
Runs a command using npm only if the command is defined in the package.json scripts. If the command is not defined, it is silently skipped.
Import:
import { npmRunOptional } from '@mnaoumov/typescript-dev-toolkit/npm-run';Signature:
function npmRunOptional(command: string): Promise<NpmRunOptionalResult>Parameters:
| Parameter | Type | Description |
|---|---|---|
command |
string | The command to run. |
Returns: Promise<NpmRunOptionalResult> — A Promise that resolves to NpmRunOptionalResult.Success if the command was found and run, or NpmRunOptionalResult.Skipped otherwise.
Links to this page: