Skip to main content

addFileToCommand

Callable

  • addFileToCommand(directory: string): (id: string, file: { content: string; fileName: string }, version?: string) => Promise<void>

  • Add a file to a command by it's id.

    Optionally specify a version to add a file to a specific version of the command.

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

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

    // adds a file to the latest UpdateInventory command
    await addFileToCommand('UpdateInventory', { content: 'Hello world', fileName: 'hello.txt' });

    // adds a file to a specific version of the UpdateInventory command
    await addFileToCommand('UpdateInventory', { content: 'Hello world', fileName: 'hello.txt' }, '0.0.1');