Skip to main content
New project sponsor 🪝Hookdeck: Serverless infrastructure for event-driven architecture. Learn more.

writeCommand

Callable

  • writeCommand(directory: string): (command: Command, options?: { path: string }) => Promise<void>

  • Write a command to EventCatalog.

    You can optionally override the path of the command.

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

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

    // Write a command to the catalog
    // Command would be written to commands/UpdateInventory
    await writeCommand({
    id: 'UpdateInventory',
    name: 'Update Inventory',
    version: '0.0.1',
    summary: 'This is a summary',
    markdown: '# Hello world',
    });

    // Write a command to the catalog but override the path
    // Command would be written to commands/Inventory/UpdateInventory
    await writeCommand({
    id: 'UpdateInventory',
    name: 'Update Inventory',
    version: '0.0.1',
    summary: 'This is a summary',
    markdown: '# Hello world',
    }, { path: "/Inventory/UpdateInventory"});