Skip to content

Commit

Permalink
chore: log modified files by patcher
Browse files Browse the repository at this point in the history
  • Loading branch information
jamezrin committed Jun 5, 2024
1 parent 619d3b1 commit 0be5238
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion forge.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@ async function patchFile(enhancerPatcher, buildPath, file) {
const filePath = path.join(buildPath, file)
const contents = await fs.readFile(filePath, 'utf-8')
const patchedContents = enhancerPatcher.patch(file, contents)

if (contents === patchedContents) {
return false
}

await fs.writeFile(filePath, patchedContents)

return true
}

async function patchAllFiles() {
Expand All @@ -67,7 +74,12 @@ async function patchAllFiles() {
})

await Promise.all(
files.map((file) => patchFile(enhancerPatcher, buildPath, file)),
files.map(async (file) => {
const fileModified = await patchFile(enhancerPatcher, buildPath, file)
if (fileModified) {
console.log('Patcher modified file:', file)
}
}),
)
}

Expand Down

0 comments on commit 0be5238

Please sign in to comment.