Skip to content

Commit

Permalink
Add Logging to Error Compression
Browse files Browse the repository at this point in the history
  • Loading branch information
smell-of-curry committed Aug 24, 2024
1 parent ff9afed commit fd7b473
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ async function addPathToArchive(
if (ext === "json") {
// Compress JSON file
try {
const fileContents = fsExtra.readFileSync(pathToAdd, "utf-8");
const fileContents = await fsExtra.readFile(pathToAdd, "utf-8");
const commentsRemoved = removeComments(fileContents);
const parsedJson = JSON.parse(commentsRemoved);
Expand All @@ -53,7 +52,7 @@ async function addPathToArchive(
// Add the compressed JSON content as a temporary file
archive.append(compressedContents, { name: pathToAdd });
} catch (error) {
console.error(`Error compressing ${pathToAdd}:`, error);
console.error(`Error compressing JSON: ${pathToAdd}:`, error);
}
} else if (ext === "png") {
// Compress PNG file
Expand All @@ -69,7 +68,7 @@ async function addPathToArchive(
// Add the compressed PNG content as a temporary file in memory
archive.append(compressedBuffer, { name: pathToAdd });
} catch (error) {
console.error(`Error compressing ${pathToAdd}:`, error);
console.error(`Error compressing PNG: ${pathToAdd}:`, error);
}
} else {
archive.file(pathToAdd, { name: pathToAdd });
Expand Down

0 comments on commit fd7b473

Please sign in to comment.