(report, source)
| 235 | } |
| 236 | |
| 237 | function appendSyncLog(report, source) { |
| 238 | if (!report.added.length && !report.changed.length && !report.removed.length) return; |
| 239 | |
| 240 | const date = new Date().toISOString().slice(0, 10); |
| 241 | const parts = []; |
| 242 | if (report.added.length) parts.push(`新增 ${report.added.map(itemLabel).join("、")}`); |
| 243 | if (report.changed.length) parts.push(`更新 ${report.changed.map(itemLabel).join("、")}`); |
| 244 | if (report.removed.length) parts.push(`移除 ${report.removed.map(itemLabel).join("、")}`); |
| 245 | const row = `| ${date} | 网站索引同步 | ${parts.join(";")}。来源:\`${path.relative(ROOT, source)}\` |\n`; |
| 246 | const current = readText(FILES.syncLog) || syncLogHeader(); |
| 247 | const header = syncLogHeader(); |
| 248 | const body = current.startsWith(header) ? current.slice(header.length) : current; |
| 249 | writeText(FILES.syncLog, `${header}${row}${body}`); |
| 250 | } |
| 251 | |
| 252 | const previousManifest = readJsonFile(FILES.manifest, []); |
| 253 | const manifest = renderOnly ? previousManifest : buildManifest(); |
no test coverage detected