Sfoglia il codice sorgente

chore(docs): report the first stale catalog line

Hypatia May 1 mese fa
parent
commit
33c4d5a164
1 ha cambiato i file con 10 aggiunte e 0 eliminazioni
  1. 10 0
      scripts/gen-tool-catalog.ts

+ 10 - 0
scripts/gen-tool-catalog.ts

@@ -655,6 +655,16 @@ async function main(): Promise<void> {
       process.exit(0)
       process.exit(0)
     }
     }
     console.error(`gen-tool-catalog: ${OUT} is stale. Run \`pnpm run gen-tool-catalog\` and commit ${OUT}.`)
     console.error(`gen-tool-catalog: ${OUT} is stale. Run \`pnpm run gen-tool-catalog\` and commit ${OUT}.`)
+    const committedLines = committed?.split('\n') ?? []
+    const generatedLines = content.split('\n')
+    const lineCount = Math.max(committedLines.length, generatedLines.length)
+    for (let index = 0; index < lineCount; index += 1) {
+      if (committedLines[index] === generatedLines[index]) continue
+      console.error(`gen-tool-catalog: first difference at line ${index + 1}`)
+      console.error(`  committed: ${JSON.stringify(committedLines[index])}`)
+      console.error(`  generated: ${JSON.stringify(generatedLines[index])}`)
+      break
+    }
     process.exit(1)
     process.exit(1)
   }
   }