feat: add responsive CHRNX podcast atmosphere

This commit is contained in:
chrnx committed 2026-08-13 01:01:08 -05:00
1 parent 3840b7c168
commit 6443a46126
13 files changed
+190 -18

No files matched your search

+35 -10
View File
@@ -166,7 +166,7 @@ test( 'lower home sections preserve editorial order and define layered panel tre
}
} );
test( 'all approved portraits rebuild byte-identically within payload bounds', () => {
test( 'all approved responsive media rebuild byte-identically within payload bounds', () => {
const readme = read( 'README.md' );
const documentedCommand = 'mktemp -d "${TMPDIR:-/tmp}/chrnx-responsive.XXXXXX"';
assert.ok( readme.includes( documentedCommand ) );
@@ -182,7 +182,7 @@ test( 'all approved portraits rebuild byte-identically within payload bounds', (
assert.deepEqual( readdirSync( external ), [ 'sentinel' ] );
execFileSync( './scripts/build-responsive-images.sh', [ output ], { cwd: new URL( '../..', import.meta.url ) } );
const names = readdirSync( output ).sort();
assert.equal( names.length, 45 );
assert.equal( names.length, 52 );
for ( const name of [
'alter-ego-gaming-half-body-384.avif',
'alter-ego-gaming-half-body-384.webp',
@@ -194,19 +194,37 @@ test( 'all approved portraits rebuild byte-identically within payload bounds', (
'the-no-names-collage-768.avif',
'the-no-names-collage-768.webp',
'the-no-names-collage.json',
'podcast-frequency-grunge-384.avif',
'podcast-frequency-grunge-384.webp',
'podcast-frequency-grunge-768.avif',
'podcast-frequency-grunge-768.webp',
'podcast-frequency-grunge-1536.avif',
'podcast-frequency-grunge-1536.webp',
'podcast-frequency-grunge.json',
] ) {
assert.ok( names.includes( name ), `missing ${ name }` );
}
assert.deepEqual(
JSON.parse( readFileSync( join( output, 'podcast-frequency-grunge.json' ), 'utf8' ) ),
{
source: 'podcast-frequency-grunge.png',
formats: [ 'avif', 'webp' ],
widths: [ 384, 768, 1536 ],
},
);
let total = 0;
let collageTotal = 0;
let gamingHalfBodyTotal = 0;
let podcastTotal = 0;
for ( const name of names ) {
const generated = readFileSync( join( output, name ) );
const committed = readFileSync( new URL( `../../assets/images/generated/${ name }`, import.meta.url ) );
assert.deepEqual( generated, committed, `${ name } must rebuild byte-identically` );
if ( /\.(?:avif|webp)$/.test( name ) ) {
assert.ok( statSync( join( output, name ) ).size <= 160 * 1024, `${ name } exceeds 160 KiB` );
const expectedWidth = Number( name.match( /-(384|768)\.(?:avif|webp)$/ )[ 1 ] );
const binarySize = statSync( join( output, name ) ).size;
const expectedWidth = Number( name.match( /-(384|768|1536)\.(?:avif|webp)$/ )[ 1 ] );
const binaryLimit = expectedWidth === 1536 ? 260 * 1024 : 160 * 1024;
assert.ok( binarySize <= binaryLimit, `${ name } exceeds ${ binaryLimit } bytes: ${ binarySize } bytes` );
const dimensions = execFileSync( 'sips', [ '-g', 'pixelWidth', '-g', 'pixelHeight', join( output, name ) ], { encoding: 'utf8' } );
assert.match( dimensions, new RegExp( `pixelWidth: ${ expectedWidth }` ) );
assert.match( dimensions, /pixelHeight: [1-9][0-9]*/ );
@@ -223,14 +241,21 @@ test( 'all approved portraits rebuild byte-identically within payload bounds', (
if ( name.startsWith( 'alter-ego-gaming-half-body-' ) ) {
gamingHalfBodyTotal += generated.length;
}
if ( name.startsWith( 'podcast-frequency-grunge-' ) ) {
podcastTotal += generated.length;
}
}
}
assert.ok( collageTotal <= 400 * 1024, `collage derivatives exceed 400 KiB: ${ collageTotal }` );
assert.ok( collageTotal <= 400 * 1024, `collage family exceeds 400 KiB: ${ collageTotal } total bytes` );
assert.ok(
gamingHalfBodyTotal <= 340 * 1024,
`gaming half-body derivatives exceed 340 KiB: ${ gamingHalfBodyTotal }`,
`gaming half-body family exceeds 340 KiB: ${ gamingHalfBodyTotal } total bytes`,
);
assert.ok( total <= 2.4 * 1024 * 1024, `derivatives exceed 2.4 MiB: ${ total }` );
assert.ok(
podcastTotal <= 620 * 1024,
`podcast-frequency-grunge family exceeds 620 KiB: ${ podcastTotal } total bytes`,
);
assert.ok( total <= 2.75 * 1024 * 1024, `generated binary payload exceeds 2.75 MiB: ${ total } total bytes` );
} finally {
rmSync( output, { recursive: true, force: true } );
rmSync( external, { recursive: true, force: true } );
@@ -243,14 +268,14 @@ test( 'post-card CSS fallbacks never reuse approved section portraits', () => {
assert.doesNotMatch( components, /url\([^)]*(?:alter-ego-|the-no-names-musician-cutout)/ );
} );
test( 'podcast background source stays separate from portrait and card fallbacks', () => {
test( 'podcast background source uses fixed art and stays separate from card fallbacks', () => {
assert.ok(
existsSync( new URL( `../../${ PODCAST_BACKGROUND_SOURCE }`, import.meta.url ) ),
`missing ${ PODCAST_BACKGROUND_SOURCE }`,
);
const portraitAllowlist = read( 'inc/queries.php' );
assert.doesNotMatch( portraitAllowlist, /podcast-frequency-grunge\.png/ );
const artAllowlist = read( 'inc/queries.php' );
assert.match( artAllowlist, /'podcast-frequency'\s*=>\s*'podcast-frequency-grunge\.png'/ );
for ( const path of [
'assets/css/components.css',