File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed
Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff 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 {
You can’t perform that action at this time.
0 commit comments