Skip to main content

getCommands

Callable

  • getCommands(directory: string): (options: { latestOnly?: boolean }) => Promise<Command[]>

  • Returns all commands from EventCatalog.

    You can optionally specify if you want to get the latest version of the events.

    @example
    import utils from '@eventcatalog/utils';

    const { getCommands } = utils('/path/to/eventcatalog');

    // Gets all commands (and versions) from the catalog
    const commands = await getCommands();

    // Gets all commands (only latest version) from the catalog
    const commands = await getCommands({ latestOnly: true });