Files
folio/scripts/check-metadata.mjs
T
Mateusz PstruchaandClaude Opus 5.5 3e18ceeb67 Single-page photo profile with justified grid
Astro site: profile header, Flickr-style justified rows that keep each
photo's aspect ratio, and a detail page per photo (date from EXIF or a
YAML sidecar, optional location) that opens in a dialog from the grid.

Originals are dropped from the build and CI fails if a published image
still carries EXIF location or capture time. Tags release folio-<ver>.tgz
and deploy it with ygg/static-server to ig.mtps.pl.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 20:06:20 +02:00

18 lines
894 B
JavaScript

// Fails if any image in dist/ still carries EXIF location or capture time.
// Runs after the build in CI, so a leaking original never gets released.
import { existsSync, readdirSync, readFileSync } from 'node:fs';
import exifr from 'exifr';
const dir = new URL('../dist/_astro/', import.meta.url);
const leaking = [];
for (const file of (existsSync(dir) ? readdirSync(dir) : []).filter((f) => /\.(jpe?g|png|webp|avif)$/i.test(f))) {
// exifr chokes on file paths under Node 26, a buffer works
const exif = await exifr.parse(readFileSync(new URL(file, dir)), true).catch(() => undefined);
if (exif?.latitude !== undefined || exif?.GPSLatitude || exif?.DateTimeOriginal) leaking.push(file);
}
if (leaking.length) {
console.error(`images with EXIF location/time in dist/_astro:\n ${leaking.join('\n ')}`);
process.exit(1);
}
console.log('no EXIF location/time in published images');