cleaned up

shahanneda/optimze-image-script
Shahan Nedadahandeh 10 months ago
parent be527c382e
commit b6129b3843
Signed by: snedadah
GPG Key ID: 8638C7F917385B01
  1. 5
      .gitignore
  2. BIN
      images/team/AaryanShroff copy.JPG
  3. BIN
      public/images/team/AaryanShroff copy.JPG
  4. 2
      scripts/already-optimized-images.json
  5. 6
      scripts/optimize-images.ts

5
.gitignore vendored

@ -25,7 +25,4 @@ yarn-debug.log*
yarn-error.log*
# Calendar is automatically generated
/public/events.ics
# Images should be optimized
# /public/images
/public/events.ics

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

File diff suppressed because one or more lines are too long

@ -55,6 +55,7 @@ async function getAlreadyOptimizedImageHashesSet(): Promise<Set<string>> {
}
async function writeSaveFile(hashes: Set<string>) {
await fse.remove(ALREADY_OPTIMIZED_SAVE_FILE_PATH);
await fse.writeFile(
ALREADY_OPTIMIZED_SAVE_FILE_PATH,
JSON.stringify({ optimizedImages: Array.from(hashes) })
@ -96,9 +97,9 @@ export async function optimizeImages() {
console.log(`Skipping ${imagePath}`);
return;
} else if (process.env.CI) {
// Need to optimize image on production, not ideal since image wont be cached for later deploys
// In this case need to optimize image on production, not ideal since image wont be cached for later deploys
console.warn(
`New image found to optimize: ${imagePath} Please run npm run build:images locally!`
`-----\nWARNING: New image found to optimize: "${imagePath}" Please run npm run build:images locally!\n-----`
);
}
@ -134,7 +135,6 @@ export async function optimizeImages() {
await fse.outputFile(destinationPath, encodedImage.binary);
alreadyOptimizedImageHashes.add(fileHash);
console.timeEnd(timerName);
await writeSaveFile(alreadyOptimizedImageHashes);
})
);

Loading…
Cancel
Save