shots render --dry: plan per language and variant

This commit is contained in:
CRTkafa 2026-10-10 22:24:58 +08:00
parent e6f1a08bae
commit 5b4902496d

View file

@ -1,6 +1,6 @@
// Store screenshots + Play feature graphic at exact pixel sizes, from raw game frames and per-language copy. // Store screenshots + Play feature graphic at exact pixel sizes, from raw game frames and per-language copy.
// storebound shots render [--lang en,tr] [--size ios69,play,feature] [--scenes 1,3] [--variant b | --variants] // storebound shots render [--lang en,tr] [--size ios69,play,feature] [--scenes 1,3] [--variant b | --variants]
// [--no-sheet] [--port 8792] // [--no-sheet] [--port 8792] [--dry]
// Out: <shots.out>/<lang>/<size>/NN.png (24-bit RGB: Play rejects alpha / palette PNGs), <lang>/feature/1024x500.png, // Out: <shots.out>/<lang>/<size>/NN.png (24-bit RGB: Play rejects alpha / palette PNGs), <lang>/feature/1024x500.png,
// <lang>/sheet.png (contact sheet of every size packed into a grid, for a quick review) and <shots.out>/report.json (text overflow flags // <lang>/sheet.png (contact sheet of every size packed into a grid, for a quick review) and <shots.out>/report.json (text overflow flags
// per image, read by `shots check` and `shots gallery`). Variants go to <shots.out>/<variant>/<lang>/... // per image, read by `shots check` and `shots gallery`). Variants go to <shots.out>/<variant>/<lang>/...
@ -37,6 +37,16 @@ export async function run(ctx: Ctx): Promise<void> {
jobs.set(v ?? '', { scenes, copy }); jobs.set(v ?? '', { scenes, copy });
} }
const framesDir = resolve(shots.frames), outDir = resolve(shots.out); const framesDir = resolve(shots.frames), outDir = resolve(shots.out);
if (a.has('dry')) {
let n = 0;
for (const [v, job] of jobs) for (const lang of langs) {
const scenes = a.list('scenes').length ? a.list('scenes') : job.scenes.map(s => s.id);
const files = sizes.reduce((t, s) => t + (SIZES[s]!.feature ? 1 : scenes.length), 0);
n += files;
log('shots', `would render ${renderDir(outDir, lang, v || undefined)}: ${files} images (${sizes.join(', ')}; scenes ${scenes.join(', ')})`);
}
return done('shots', `render planned (dry run): ${n} images`);
}
const fontsDir = join(root, '.storebound', 'fonts'); const fontsDir = join(root, '.storebound', 'fonts');
if (!existsSync(join(fontsDir, 'fonts.css'))) warn('shots', 'no .storebound/fonts/fonts.css: run `storebound shots fonts` first (falling back to system fonts)'); if (!existsSync(join(fontsDir, 'fonts.css'))) warn('shots', 'no .storebound/fonts/fonts.css: run `storebound shots fonts` first (falling back to system fonts)');
const { phone, tablet } = frameDims(config); const { phone, tablet } = frameDims(config);