@eventcatalog/exporters

中文文档
0.1.5发布于 2026/11/10MITTypeScriptESM + CJS构建来源已验证近 30 天下载 6758

Export an EventCatalog to other formats, such as a single-file HTML architecture reference

原始使用文档
文档目录4 节
  1. You probably don't need this package directly
  2. Custom exports: parts of the catalog for people outside the…
  3. Using the package
  4. License

@eventcatalog/exporters

Export an EventCatalog to other formats.

It exports the architecture reference: your whole catalog as one self-contained HTML file you can share, attach or host anywhere. Every domain, system, service, message, channel, data store, flow, entity and team gets its own section, linked to everything it relates to, with message attributes from your schemas (JSON Schema, Avro and Protobuf), example payloads, TypeScript types and your specifications.

You probably don't need this package directly

  • eventcatalog build writes architecture.html into your build output on every build. Turn it off in eventcatalog.config.js:

    export default {
      exports: {
        html: { enabled: false },
      },
    };
    
  • The CLI exports it on demand and opens it in your browser:

    npx @eventcatalog/cli export --format html --output architecture.html
    

Custom exports: parts of the catalog for people outside the team

A custom export is part of your catalog chosen for partners, the public or a regulator, written as a file in exports/. Its frontmatter says what's in it; its body is the introduction readers see first.

---
# exports/partner-payments.mdx
title: Payments for partners
summary: How partners take payment for orders.
audience: Partners integrating with Acme Checkout
version: 2026.10
include:
  - system: payment-processing-system # a domain or system brings what's in it
  - service: checkout-api
    version: 1.x
  - event: payment-succeeded
  - x-public: true # every resource with this custom property (x- in its frontmatter)
    kind: [service, event] # optional: only these kinds
exclude:
  - service: payment-worker # wins over include, and brings nothing with it
  - x-data-classification: [confidential, restricted] # any of these values
references: omit # pointers at anything not in the export: omit, name-only or include (one level)
hide: [owners, repository, contacts, docs] # the default
---

Welcome! This guide covers everything you need to take payment for an Acme order.
  • eventcatalog build writes each custom export to exports/<id>.html in the build output (with auth on, only when exports.custom.enabled is true). A file with problems is skipped with a warning, and the others are still written.
  • npx @eventcatalog/cli export partner-payments writes one; add --check to list what's in it, what was left out and why, without writing it. --check fails when something the export names isn't in the catalog, so CI notices renames.
  • exports.custom in eventcatalog.config.js sets defaults (hide, references) for every custom export, only to build some of them, dir for the folder, and neverExport for resources no custom export may show, whatever it includes.

Selectors name one resource (service: checkout-api, with an optional version) or match custom properties (x-public: true). In a property selector every x- field must match; a field matches when the resource's value is one of those given (compared as text, so true matches "true"), and a list in the resource's frontmatter matches when any of its items does. A matched domain or system brings what's in it, as one named by id does. The custom properties themselves never go out in an export.

A resource taken out by exclude or neverExport is never named: pointers at it are dropped, and links to it in docs read "another service".

Using the package

import { renderHtml, writeHtml, loadCatalog, renderCustomExports, formatCustomExportReport } from '@eventcatalog/exporters';

// Render the reference as a string
const { html } = await renderHtml('/path/to/catalog');

// Or write it to a file
const { path, bytes, durationMs } = await writeHtml({ dir: '/path/to/catalog', outputPath: 'architecture.html' });

// Or load the catalog into one resolved model (relationships, schemas, owners) to build your own export
const model = await loadCatalog('/path/to/catalog');

// The custom exports in exports/: rendered, with a report of what's in each and what was left out.
// Each stands alone: one that can't be exported is in `failed`, with its error, and the rest are still rendered.
const { rendered, failed } = await renderCustomExports('/path/to/catalog');
console.log(formatCustomExportReport(rendered[0].report));

License

MIT

版本与发布记录

@eventcatalog/exporters 共发布 10 个版本,首次发布于 2026/10/15;过去 12 个月发布了 10 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.1.5latest2026/11/103 天前
0.1.42026/10/2618 天前
0.1.32026/10/2321 天前
0.1.22026/10/1925 天前
0.1.12026/10/1628 天前
0.1.02026/10/1628 天前

关于 @eventcatalog/exporters 的常见问题

@eventcatalog/exporters 是什么?

Export an EventCatalog to other formats, such as a single-file HTML architecture reference

如何安装 @eventcatalog/exporters?

在项目目录运行 npm install @eventcatalog/exporters,或使用 pnpm add / yarn add / bun add。

@eventcatalog/exporters 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@eventcatalog/exporters 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@eventcatalog/exporters 可以商用吗?

@eventcatalog/exporters 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@eventcatalog/exporters 的下载量有多少?

根据 npm 官方下载统计,@eventcatalog/exporters 在 2026/10/14 – 2026/11/12 这 30 天内被下载 6,758 次,日均约 225 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@eventcatalog/exporters 还在维护吗?

最新版本 0.1.5 发布于 2026/11/10(3 天前);至今共发布 10 个版本,其中过去 12 个月发布了 10 个;首次发布于 2026/10/15。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。