()
| 66 | } |
| 67 | |
| 68 | function compare() { |
| 69 | const current = loadCurrentManifest().map((item) => ({ |
| 70 | leetcodeId: item.leetcodeId, |
| 71 | sourcePid: item.sourcePid, |
| 72 | slug: item.slug, |
| 73 | titleZh: item.titleZh, |
| 74 | difficulty: item.difficulty, |
| 75 | categoryZh: item.categoryZh, |
| 76 | })); |
| 77 | const next = readProblems(sourceFile) |
| 78 | .filter((item) => /^lc\d+$/.test(item.pid) && Number.isInteger(item.num)) |
| 79 | .map(normalize) |
| 80 | .sort((a, b) => a.leetcodeId - b.leetcodeId); |
| 81 | |
| 82 | const currentById = new Map(current.map((item) => [item.leetcodeId, item])); |
| 83 | const nextById = new Map(next.map((item) => [item.leetcodeId, item])); |
| 84 | const added = next.filter((item) => !currentById.has(item.leetcodeId)); |
| 85 | const removed = current.filter((item) => !nextById.has(item.leetcodeId)); |
| 86 | const changed = next.filter((item) => currentById.has(item.leetcodeId) && JSON.stringify(currentById.get(item.leetcodeId)) !== JSON.stringify(item)); |
| 87 | return { added, removed, changed, nextCount: next.length }; |
| 88 | } |
| 89 | |
| 90 | function siteStatus() { |
| 91 | const output = sh("git", [ |
no test coverage detected