@fern-api/replay

中文文档
0.19.3发布于 2026/09/24MITTypeScriptESM + CJS近 30 天下载 4.4万

Automatically preserves SDK customizations across Fern regenerations

原始使用文档
文档目录8 节
  1. What it does
  2. The replay loop
  3. Vocabulary
  4. Documentation
  5. Install
  6. Development
  7. Local Development with Fern CLI
  8. License

@fern-api/replay

Automatically preserves SDK customizations across Fern regenerations.

What it does

Fern Replay detects your edits to generated SDK code, stores them as patches in .fern/replay.lock, and re-applies them after each regeneration using 3-way merge. Your customizations survive fern generate without manual intervention.

The replay loop

Three phases. The generator runs between detect and apply, overwriting everything in the SDK directory.

  1. Detect — find new customizations in the customer's git history since the last generation
  2. Apply — put them back onto the freshly generated code via 3-way merge
  3. Commit — record the result as a [fern-replay] commit on top of the [fern-generated] one

Vocabulary

The team's canonical vocabulary — customization, patch, generation, the three merge sides, the patch lifecycle verbs — lives in CONTEXT.md.

Documentation

Install

npm install @fern-api/replay

Development

npm install
npm run build
npm test

Local Development with Fern CLI

To use a local version of @fern-api/replay with the Fern CLI monorepo:

# From the fern-replay directory
cd /path/to/fern-replay
pnpm link --global

# From the fern monorepo root
cd /path/to/fern
pnpm link --global @fern-api/replay

Verify the link is working:

ls -la node_modules/@fern-api/replay
# Should show a symlink pointing to your local fern-replay directory

Any changes you make in fern-replay will be picked up immediately without reinstalling.

To unlink and restore the published npm version:

pnpm unlink @fern-api/replay
pnpm install

License

MIT

版本与发布记录

@fern-api/replay 共发布 35 个版本,首次发布于 2026/02/17;过去 12 个月发布了 35 个版本。

版本发布日期距今
0.19.3latest2026/09/241 个月前
0.19.22026/07/173 个月前
0.19.12026/07/163 个月前
0.19.02026/06/254 个月前
0.18.02026/06/105 个月前
0.17.42026/06/105 个月前

关于 @fern-api/replay 的常见问题

@fern-api/replay 是什么?

Automatically preserves SDK customizations across Fern regenerations

如何安装 @fern-api/replay?

在项目目录运行 npm install @fern-api/replay,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 fern-replay,可以用 npx fern-replay 直接运行。

@fern-api/replay 支持 TypeScript 吗?

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

@fern-api/replay 支持 ESM 还是 CommonJS?

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

@fern-api/replay 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@fern-api/replay 可以商用吗?

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

@fern-api/replay 的下载量有多少?

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

@fern-api/replay 还在维护吗?

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