Function run

  • Run a command with optional plugins and dynamic command discovery.

    Parameters

    Returns Promise<unknown>

    The result of the executed command.

    Example

    run({
    command: 'build ./src --watch --env=prod',
    plugins: [help()]
    });

    Remarks

    If no commands directory is provided, this function will try to find one by first looking for a "commands" directory in the current working directory, then looking for a "commands" directory adjacent to the file that called this function.

    For example, if the node process is started from the root of a project and this function is called from a file at "src/cli.js", it will look for a "commands" directory in the root of the project and in the "src" directory.