- Deno 2.x or the current Deno stable channel.
- Network access to JSR for the first dependency resolution, or a populated Deno cache.
deno task fmt
deno task lint
deno task check
deno task testAll four commands must pass before a change is considered complete. deno task test includes real Torrent and Tracker fixtures plus deterministic generated round-trip cases.
- Use Deno's formatter as the source of truth.
- Keep public exports in
mod.tsonly. - Prefer explicit types over
any. - Keep protocol parsing byte-oriented; do not use locale-dependent string ordering.
- Use
BencodeEncodeErrorandBencodeDecodeErrorfor library-level failures. - Keep changes focused and add a regression test for every behavior change.
- State the problem and compatibility impact before editing.
- Update or add the smallest relevant test first when practical.
- Implement the focused change.
- Run format, lint, type-check, and the complete test suite.
- Update API docs and migration notes for public behavior changes.
- Review
git diffandgit status; do not commit or push without explicit approval.
- Update
deno.jsonversion and lockfile. - Confirm README and
docs/API.mddescribe the released API. - Run all quality commands.
- Verify CI uses the intended Deno release channel.
- Create release notes describing breaking changes.
The repository publishes to JSR only when a GitHub Release is published. The release workflow checks that the release tag (for example, v2.0.0) exactly matches the version in deno.json, runs all quality gates, performs deno publish --dry-run, and then publishes through GitHub Actions OIDC. The JSR package must remain linked to this GitHub repository.
For maintainers:
- Merge a release PR that updates
deno.jsonandCHANGELOG.md. - Create a GitHub Release using the matching tag, such as
v2.0.0. - Wait for
Publish JSRto complete. Do not reuse a published version.
- Deno 2.x 或当前 Deno stable channel。
- 首次解析依赖时需要访问 JSR,或者提前准备好 Deno 缓存。
deno task fmt
deno task lint
deno task check
deno task test以上四条命令必须全部通过。deno task test 包含真实 Torrent、Tracker 样本以及确定性的生成式往返用例。
- 以 Deno formatter 作为唯一格式化标准。
- 公共导出集中在
mod.ts。 - 使用明确类型,避免
any。 - 协议解析保持字节导向,禁止使用依赖 locale 的字符串排序。
- 库级失败使用
BencodeEncodeError和BencodeDecodeError。 - 每个行为变更都应增加回归测试。
- 修改前说明问题和兼容性影响。
- 优先先增加或更新最小相关测试。
- 实施范围明确的修改。
- 执行格式、lint、类型检查和完整测试。
- 公共行为变化时同步更新 API 文档和迁移说明。
- 检查
git diff与git status;没有明确批准时不得 commit 或 push。
- 更新
deno.json版本和锁文件。 - 确认 README、
docs/API.md与发布 API 一致。 - 执行全部质量命令。
- 确认 CI 使用预期的 Deno 发布通道。
- 创建包含 breaking changes 的发布说明。
本仓库仅在 GitHub Release 发布时向 JSR 发布。发布工作流会检查 Release Tag(例如 v2.0.0)是否与 deno.json 中的 version 完全一致,执行全部质量门禁和 deno publish --dry-run,然后通过 GitHub Actions OIDC 正式发布。JSR 后台需要保持与本 GitHub 仓库的绑定。
维护者只需要:
- 合并更新
deno.json和CHANGELOG.md的版本发布 PR。 - 使用匹配的 Tag 创建 GitHub Release,例如
v2.0.0。 - 等待
Publish JSR完成;不要重复使用已经发布过的版本号。