Copy as Markdown[View as Markdown](/docs/sdk/functions/writeChangelog.md)

***

# 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[​](#parameters "Direct link to Parameters")

| Parameter    | Type     |
| ------------ | -------- |
| `catalogDir` | `string` |

## Returns[​](#returns "Direct link to Returns")

`Function`

### Parameters[​](#parameters-1 "Direct link to Parameters")

| Parameter          | Type                                                  |
| ------------------ | ----------------------------------------------------- |
| `id`               | `string`                                              |
| `changelog`        | `Changelog`                                           |
| `options`          | { `format`: `"md"` \| `"mdx"`; `version`: `string`; } |
| `options.format`?  | `"md"` \| `"mdx"`                                     |
| `options.version`? | `string`                                              |

### Returns[​](#returns-1 "Direct link to Returns")

`Promise`<`void`>

## Example[​](#example "Direct link to 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' });
```
