Skip to content

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 'obsidian-dev-utils/script-utils/npm-run';

Signature:

function npmRunOptional(command: string): Promise<boolean>

Parameters:

ParameterTypeDescription
commandstringThe command to run.

Returns: Promise<boolean> — true if the command was found and run, false otherwise.