"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 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
javascript, node.js

研究方向

先查看 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 摘要。