feat: process municipal images through media pipeline
Deploy / validate-dispatch (push) Successful in 0s
Deploy / scheduled-rebuild-dev (push) Skipped
Deploy / scheduled-rebuild-master (push) Skipped
Deploy / rollback-dev (push) Skipped
Deploy / rollback-master (push) Skipped
Deploy / changes (push) Successful in 4s
Deploy / app-quality (push) Successful in 3m7s
Deploy / secret-scan (push) Successful in 5s
Deploy / security-deps (push) Successful in 6s
Deploy / context (push) Successful in 1s
Deploy / app-image (push) Successful in 55s
Deploy / deploy-master (push) Skipped
Deploy / deploy-dev (push) Successful in 12s

This commit is contained in:
Per Hoener
2026-09-19 16:52:07 +02:00
parent 775178f3f2
commit b50a172c1c
31 changed files with 43 additions and 29 deletions
+6 -2
View File
@@ -16,7 +16,7 @@ const CACHED_ORIGINALS_ROOT = IMAGE_CACHE_ROOT
const CACHED_OUTPUTS_ROOT = IMAGE_CACHE_ROOT
? path.resolve(IMAGE_CACHE_ROOT, 'optimized')
: null;
const IMAGE_PIPELINE_VERSION = 1;
const IMAGE_PIPELINE_VERSION = 2;
const PUBLIC_IMAGES_ROOT = path.join(ROOT, 'public/images');
const DEFAULT_MEDIA_ROOT = path.join(ROOT, '.media-source');
const LEGACY_MEDIA_ROOT = path.join(ROOT, 'assets');
@@ -61,6 +61,7 @@ const pipelines = [
{ suffix: '-md', width: 1000, height: 750 },
],
formats: ['original', 'webp', 'avif'],
alwaysGenerateModernFormats: true,
deleteOriginal: false,
generateJson: false,
},
@@ -76,6 +77,7 @@ const pipelines = [
{ suffix: '', width: 1920, height: 1440 },
],
formats: ['jpg', 'webp', 'avif'],
alwaysGenerateModernFormats: true,
deleteOriginal: false,
generateJson: true,
jsonFileName: 'slider-images.json',
@@ -92,6 +94,7 @@ const pipelines = [
{ suffix: '', width: 1920, height: 1440 },
],
formats: ['jpg', 'webp', 'avif'],
alwaysGenerateModernFormats: true,
deleteOriginal: false,
generateJson: true,
jsonFileName: 'slider-images.json',
@@ -107,6 +110,7 @@ const pipelines = [
{ suffix: '-mobile', width: 1024, height: 768 },
],
formats: ['jpg', 'webp', 'avif'],
alwaysGenerateModernFormats: true,
deleteOriginal: false,
generateJson: false,
},
@@ -565,7 +569,7 @@ async function runPipeline(config) {
const existingSize = fs.existsSync(outputPath) ? fs.statSync(outputPath).size : null;
const isDerivedVariant = format === 'webp' || format === 'avif';
if (isDerivedVariant && Number.isFinite(fallbackVariantSize) && candidateSize >= fallbackVariantSize) {
if (isDerivedVariant && !config.alwaysGenerateModernFormats && Number.isFinite(fallbackVariantSize) && candidateSize >= fallbackVariantSize) {
fs.rmSync(tempPath);
if (existingSize !== null && existingSize < fallbackVariantSize) {
totalVariantSize += existingSize;