Skip to content

Commit 43232f1

Browse files
committed
chore(repo): fix codegen script
1 parent 6a4b145 commit 43232f1

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

scripts/sync-common-types.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,21 @@ function syncFile(fileName) {
5252
}
5353

5454
const sourceContent = fs.readFileSync(sourcePath, 'utf8')
55-
const sourceHash = crypto.createHash('md5').update(sourceContent).digest('hex')
55+
const expectedContent = HEADER_COMMENT + sourceContent
5656

57-
// Check if destination exists and compare content (excluding header)
57+
// Check if destination exists and compare with what we would generate
5858
let needsUpdate = true
5959
if (fs.existsSync(destPath)) {
6060
const destContent = fs.readFileSync(destPath, 'utf8')
61-
const destContentStripped = stripGeneratedHeader(destContent)
62-
const destHash = crypto.createHash('md5').update(destContentStripped).digest('hex')
6361

64-
if (sourceHash === destHash) {
62+
// Compare the full expected output with the current file
63+
if (destContent === expectedContent) {
6564
needsUpdate = false
6665
}
6766
}
6867

6968
if (needsUpdate) {
70-
const contentWithHeader = HEADER_COMMENT + sourceContent
71-
fs.writeFileSync(destPath, contentWithHeader, 'utf8')
69+
fs.writeFileSync(destPath, expectedContent, 'utf8')
7270
console.log(`✅ Synced: ${fileName}`)
7371
return true
7472
} else {

0 commit comments

Comments
 (0)