Skip to main content

Function: writeChangelog()

writeChangelog(catalogDir): (id, changelog, options) => Promise<void>

Defined in: changelogs.ts:34

Writes a changelog entry to a resource in EventCatalog.

The changelog file (changelog.mdx) is written to the same directory as the resource's index.mdx.

Parameters

ParameterType
catalogDirstring

Returns

Function

Parameters

ParameterType
idstring
changelogChangelog
options{ format: "md" | "mdx"; version: string; }
options.format?"md" | "mdx"
options.version?string

Returns

Promise<void>

Example

import utils from '@eventcatalog/utils';

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

// Write a changelog to a resource
await writeChangelog('OrderCreated', {
createdAt: '2024-08-01',
markdown: '### Added support for JSON Schema\n\nOrderCreated now supports JSON Draft 7.',
badges: [{ content: '⭐️ JSON Schema', backgroundColor: 'purple', textColor: 'purple' }],
});

// Write a changelog to a specific version
await writeChangelog('OrderCreated', {
createdAt: '2024-08-01',
markdown: '### Breaking change\n\nRemoved `gender` field from schema.',
}, { version: '1.0.0' });