# @eventcatalog/exporters 中文文档

规范地址：https://npmcn.com/package/%40eventcatalog/exporters/

版本：0\.1\.5
npm 元数据更新时间：2026-11-10T13:25:49.239Z
中文译文更新时间：2026-11-14T01:05:59.772Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40eventcatalog/exporters
原文对照：https://npmcn.com/package/%40eventcatalog/exporters/?lang=original
项目主页：https://github.com/event-catalog/eventcatalog#readme
源码仓库：https://github.com/event-catalog/eventcatalog

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：1.3 MB，9 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：4 个
- 首次发布：2026-10-15T12:57:28.269Z
- 最新版本发布：2026-11-10T13:25:48.272Z
- 近 30 天下载量：6758（2026-10-14 至 2026-11-12，npm 官方下载统计）
- 已发布版本数：10（近 12 个月 10 个）

## 中文简介

导出一个事件Catalog 到其它格式, 如单文件 HTML 架构引用

## 安装

```sh
npm install @eventcatalog/exporters
```

也可以使用：`pnpm add @eventcatalog/exporters`、`yarn add @eventcatalog/exporters`、`bun add @eventcatalog/exporters`

## README

# @ eventcatalog/ 输出者

导出 a [事件目录](https://www.eventcatalog.dev/) 改为其他格式.

它输出 **结构参考**: 您的完整目录作为一个自成一体的 HTML 文件, 您可以在任何地方共享、 附加或主机 。 每个域,系统,服务,消息,信道,数据存储,流量,实体和团队都会获得自己的部分,与它相关的一切相关联,并带有来自您计划(JSON Schema, Avro and Protobuf)的信息属性,实例有效载荷,TypeScript类型以及您的规格.

## 你可能不需要这个包裹

-   **`eventcatalog build`** 写入 `architecture.html` 输入每个建筑的建材输出。 关掉 `eventcatalog.config.js`数字 :
    
    ```js
    export default {
      exports: {
        html: { enabled: false },
      },
    };
    ```
    
-   **国家行动倡议** 按需导出并在浏览器中打开:
    
    ```bash
    npx @eventcatalog/cli export --format html --output architecture.html
    ```
    

## 自定义导出: 团队外人员的目录部分

自定义导出是您为合伙人、 公众或监管者选择的目录的一部分, 作为文件写入其中 `exports/`它的前题是它里面的东西; 它的身体是介绍读者先看的.

```mdx
---
# 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` 每个自定义导出到 `exports/<id>.html` 在构建输出中( 带有认证, 仅在 `exports.custom.enabled` 实值 `true`) (中文(简体) ). 有问题的文件会被警告跳过,其他文件仍然被写入.
-   `npx @eventcatalog/cli export partner-payments` 写入; 添加 `--check` 列出里面的东西 被遗漏的东西和原因 而不写. `--check` 当导出名称不在目录中时失败, CI 通知重命名 .
-   `exports.custom` 内 `eventcatalog.config.js` 套装 `defaults` (单位:千美元)`hide`, (中文(简体) ), `references`每一次自定义出口, `only` 来建造其中的一部分, `dir` 用于文件夹,以及 `neverExport` 用于任何自定义的输出,无论它包括什么.

选择者命名一个资源( S)`service: checkout-api`,带有可选 `version`)或匹配自定义属性(`x-public: true`) (中文(简体) ). 在属性选择器中 `x-` 字段必须匹配; 当资源值是给定的值之一时, 字段匹配( 作为文本比较, 所以) `true` 匹配 `"true"`),并在资源前题中的列表中与其任何项目匹配。 一个匹配的域或系统带来了里面的东西,就像一个由id命名的. 自定义属性本身从不输出.

资源被取出 `exclude` 或者说 `neverExport` 从未命名 : 投放指针, 并在 docs 中将其链接改为“ 另一种服务 ”.

## 使用软件包

```ts
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));
```

## 许可证

麻省理工学院

## 常见问题

### @eventcatalog/exporters 是什么？

导出一个事件Catalog 到其它格式, 如单文件 HTML 架构引用

### 如何安装 @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 和提交记录判断。

