"Incremental build equals clean build" is claimed but never tested

未关闭 适合新手
#265 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃

调研方向

先查看 site/build.mjs 中 writeOut 和 pruneDist 附近的代码,然后阅读 site/lib/lib.test.mjs 以及入门部分的测试命令。建议的改动是将这些函数移到 site/lib/dist-writer.mjs,使 dist 目录可通过参数指定,并在临时目录中测试它们。完成的标准是,测试覆盖所列出的字节比较、重写、删除过期文件和清理目录。

由索引模型根据 Issue 内容生成。

描述

priority: low tests

Summary

build.mjs says the incremental result is byte-identical to a clean build, but writeOut, pruneDist and the produced-file set are not tested, and CI always builds from a fresh checkout, so the incremental path never runs there.

Where

  • site/build.mjs:272-275 (claim)
  • site/build.mjs:288-299 (writeOut)
  • site/build.mjs:323-335 (pruneDist)
  • site/build.mjs:526-531, :638, :745

Impact

A stale file left in local dist, or a needed file pruned, would only show locally.

Suggested fix

Move writeOut and pruneDist into site/lib/dist-writer.mjs with the dist directory as a parameter and test them in a temp directory.

Acceptance criteria

  • Same bytes written twice: 0 writes the second time
  • Same-size file with different bytes is rewritten
  • Stale old/x.html removed and its empty directory pruned
  • Directory holding a produced file is kept
  • Optional: hashes of build and build --clean match in a temp copy

Getting started

  • Relevant files: site/build.mjs, site/lib/lib.test.mjs
  • Run the tests: npm test; the full local gate is npm run check (Node 22+, no install step)
  • Related docs: CONTRIBUTING.md, site/README.md

Related: #85


Filed by repo-audit/full-audit at 4adb944. Severity: low. Effort: S. audit-key: testing|site/build.mjs|writeOut

主要语言
JavaScript
星标
58
派生
15
平均合并
1 天 15 小时
30 天内合并 PR
12

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TMHSDigital/Free-Game-Dev-Assets 的其他 Issue

查看 TMHSDigital/Free-Game-Dev-Assets 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。