Skip to content

Commit

Permalink
asdfasdfasdf
Browse files Browse the repository at this point in the history
Signed-off-by: ClaytonTDM <[email protected]>
  • Loading branch information
ClaytonTDM committed Oct 9, 2024
1 parent f12ae24 commit 2d252dc
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/gif-to-webp-converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,29 @@ async function convertGifToWebp(inputPath, outputPath) {
}
}

async function replaceInFile(filePath, replacements) {
try {
if (await isTextFile(filePath)) {
let data = await fs.readFile(filePath, "utf8");
let changed = false;
for (const { oldName, newName } of replacements) {
const regex = new RegExp(oldName, "g");
const newData = data.replace(regex, newName);
if (newData !== data) {
data = newData;
changed = true;
}
}
if (changed) {
await fs.writeFile(filePath, data, "utf8");
console.log(`Updated references in ${filePath}`);
}
}
} catch (error) {
console.error(`Error updating ${filePath}: ${error.message}`);
}
}

async function processDirectory(directoryPath, allConvertedFiles = []) {
try {
const entries = await fs.readdir(directoryPath, {
Expand Down

0 comments on commit 2d252dc

Please sign in to comment.