Skip to main content

writeCustomDoc

Callable

  • writeCustomDoc(directory: string): (customDoc: CustomDoc, options?: { path?: string }) => Promise<void>

  • Write a custom doc to EventCatalog.

    You can optionally override the path of the custom doc.

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

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

    // Write a custom doc to the catalog
    // Custom doc would be written to docs/inventory-management.mdx
    await writeCustomDoc({
    title: 'Inventory Management',
    summary: 'This is a summary',
    owners: ['John Doe'],
    badges: [{ content: 'Badge', backgroundColor: 'red', textColor: 'white' }],
    markdown: '# Hello world',
    fileName: 'inventory-management',
    });

    // Write a custom doc to the catalog but override the path
    // Custom doc would be written to docs/guides/inventory-management/introduction.mdx
    await writeCustomDoc({
    title: 'Inventory Management',
    summary: 'This is a summary',
    owners: ['John Doe'],
    badges: [{ content: 'Badge', backgroundColor: 'red', textColor: 'white' }],
    markdown: '# Hello world',
    fileName: 'introduction',
    }, { path: "/guides/inventory-management"});