Store image checks in shots check and validate

- Apple sizes accepted portrait or landscape; Play screenshots any accepted size (320-3840 px, at most 2:1);
  Play rejects 16-bit PNGs; feature graphic exactly 1024 x 500
- Required sets per language (Apple only with an App Store locale, Play only with a Play code)
- shots check scans A/B variant folders only with --variants
- validate adds the local renders checks: store errors are blockers, overflow flags warnings (--no-local skips)
This commit is contained in:
CRTkafa 2026-10-10 13:54:47 +00:00
parent b518ef22e2
commit 4043271f1f
6 changed files with 100 additions and 26 deletions

View file

@ -1,14 +1,18 @@
// Store readiness report (read-only on both stores): what still blocks a submission, in the order to fix it.
// storebound validate [--apple] [--play] [--json]
// storebound validate [--apple] [--play] [--json] [--src store/renders] [--no-local]
// Without --apple / --play: every store the config has. Exit code 1 when there is at least one blocker.
// Reads only: GETs on App Store Connect, a Play edit that is opened, read and deleted (never committed), and plain GETs
// of the public privacy policy and app-ads.txt URLs.
// of the public privacy policy and app-ads.txt URLs. Also checks the local renders folder (if there is one) with the
// `shots check` rules: wrong pixel size, alpha, too few / many images, Play 8 MB and feature graphic format are
// blockers (the upload would fail), text overflow flags from the last render are warnings. --no-local skips it.
import { ascClient, type J } from './apple/asc';
import { requiredDisplayTypes } from './apple/screenshots';
import { playCodes } from './lib/config';
import type { Ctx } from './lib/ctx';
import { checkUrl } from './lib/http';
import { log, warn } from './lib/log';
import { type AppleSnapshot, appleRules, type Finding, formatFindings, PLAY_REQUIRED_IMAGES, type PlaySnapshot, playRules } from './lib/validate-rules';
import { type AppleSnapshot, appleRules, type Finding, formatFindings, PLAY_REQUIRED_IMAGES, type PlaySnapshot, playRules, rendersFindings } from './lib/validate-rules';
import { rendersCheck } from './shots/check';
import { playClient } from './play/client';
import { listOneTimeProducts } from './play/products';
@ -54,7 +58,7 @@ export async function collectApple(ctx: Ctx): Promise<AppleSnapshot> {
version: v ? { versionString: v.attributes.versionString, state: v.attributes.appVersionState ?? v.attributes.appStoreState } : null,
build, locales, reviewDetail, ageRating,
expectedLocales: config.languages.map(l => l.apple).filter((x): x is string => !!x),
requiredDisplayTypes: config.apple?.screenshotTypes ?? ['APP_IPHONE_67'],
requiredDisplayTypes: requiredDisplayTypes(config.apple),
priceSchedule: !!sched?.included?.some((x: J) => x.type === 'appPrices'),
availability: !!avail?.data,
iaps, expectedProducts: (config.products ?? []).map(p => p.id),
@ -103,11 +107,16 @@ export async function run(ctx: Ctx): Promise<void> {
const a = ctx.args;
const both = !a.has('apple') && !a.has('play');
const findings: Finding[] = [];
const dir = ctx.loaded.resolve(a.get('src') ?? config.renders ?? config.shots?.out ?? 'store/renders');
const local = a.has('no-local') ? null : rendersCheck(config, dir);
if (local) log('validate', `local renders: ${dir}`);
if ((both || a.has('apple')) && config.apple) {
try { findings.push(...appleRules(await collectApple(ctx))); } catch (e) { findings.push({ store: 'apple', level: 'blocker', code: 'api', msg: (e as Error).message.slice(0, 400) }); }
try { findings.push(...appleRules({ ...(await collectApple(ctx)), renders: local?.apple })); }
catch (e) { findings.push({ store: 'apple', level: 'blocker', code: 'api', msg: (e as Error).message.slice(0, 400) }, ...rendersFindings('apple', local?.apple)); }
} else if (a.has('apple')) warn('validate', 'no apple section in the config');
if ((both || a.has('play')) && config.play) {
try { findings.push(...playRules(await collectPlay(ctx))); } catch (e) { findings.push({ store: 'play', level: 'blocker', code: 'api', msg: (e as Error).message.slice(0, 400) }); }
try { findings.push(...playRules({ ...(await collectPlay(ctx)), renders: local?.play })); }
catch (e) { findings.push({ store: 'play', level: 'blocker', code: 'api', msg: (e as Error).message.slice(0, 400) }, ...rendersFindings('play', local?.play)); }
} else if (a.has('play')) warn('validate', 'no play section in the config');
const blockers = findings.filter(f => f.level === 'blocker').length;
if (a.has('json')) console.log(JSON.stringify({ blockers, findings }, null, 2));