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:
parent
3d257402cc
commit
aecdcb1c50
6 changed files with 100 additions and 26 deletions
|
|
@ -16,7 +16,7 @@ const PLAIN: Record<string, [() => Promise<Plain>, string]> = {
|
||||||
};
|
};
|
||||||
const COMMANDS: Record<string, [() => Promise<Mod>, string]> = {
|
const COMMANDS: Record<string, [() => Promise<Mod>, string]> = {
|
||||||
'check': [() => import('./check'), 'validate config, copy files, data safety answers and products (offline); --aso keyword audit'],
|
'check': [() => import('./check'), 'validate config, copy files, data safety answers and products (offline); --aso keyword audit'],
|
||||||
'validate': [() => import('./validate'), 'read-only store readiness report with ordered blockers (--apple / --play); exit 1 on blockers'],
|
'validate': [() => import('./validate'), 'read-only store readiness report with ordered blockers (--apple / --play), plus local renders checks (--no-local skips); exit 1 on blockers'],
|
||||||
'whats-new': [() => import('./whats-new'), 'draft player-facing release notes from git log into the listing files (--since <tag>)'],
|
'whats-new': [() => import('./whats-new'), 'draft player-facing release notes from git log into the listing files (--since <tag>)'],
|
||||||
'play products': [() => import('./play/products'), 'one-time products: create / update, regional prices, activate'],
|
'play products': [() => import('./play/products'), 'one-time products: create / update, regional prices, activate'],
|
||||||
'play listing': [() => import('./play/listing'), 'app details + title / short / full description per language'],
|
'play listing': [() => import('./play/listing'), 'app details + title / short / full description per language'],
|
||||||
|
|
@ -42,7 +42,7 @@ const COMMANDS: Record<string, [() => Promise<Mod>, string]> = {
|
||||||
'shots fonts': [() => import('./shots/fonts'), 'download font subsets for the copy (CJK / Arabic / Cyrillic ...)'],
|
'shots fonts': [() => import('./shots/fonts'), 'download font subsets for the copy (CJK / Arabic / Cyrillic ...)'],
|
||||||
'shots render': [() => import('./shots/render'), 'store screenshots + feature graphic in every size and language'],
|
'shots render': [() => import('./shots/render'), 'store screenshots + feature graphic in every size and language'],
|
||||||
'shots jpeg': [() => import('./shots/jpeg'), 'JPEG q92 copies of the Play renders (4x faster uploads)'],
|
'shots jpeg': [() => import('./shots/jpeg'), 'JPEG q92 copies of the Play renders (4x faster uploads)'],
|
||||||
'shots check': [() => import('./shots/check'), 'local store checks of the renders (size, alpha, counts, overflow) and folder frames; --json'],
|
'shots check': [() => import('./shots/check'), 'local store checks of the renders (size, alpha, counts, overflow) and folder frames; --variants, --json'],
|
||||||
};
|
};
|
||||||
|
|
||||||
function help(): void {
|
function help(): void {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,31 @@ export interface Finding { store: 'apple' | 'play'; level: Level; code: string;
|
||||||
|
|
||||||
export interface UrlCheck { url: string; status: number | null; error?: string; body?: string }
|
export interface UrlCheck { url: string; status: number | null; error?: string; body?: string }
|
||||||
|
|
||||||
|
/** One problem `shots check` found in the local renders folder (cli/shots/spec.ts rules), tagged with its file / set. */
|
||||||
|
export interface LocalIssue { where: string; level: 'error' | 'warn'; code: string; msg: string }
|
||||||
|
/** Local renders checked before upload: how many images were looked at and what is wrong with them. */
|
||||||
|
export interface RendersCheck { dir: string; images: number; issues: LocalIssue[] }
|
||||||
|
|
||||||
|
const RENDER_FIX: Record<string, string> = {
|
||||||
|
size: 'storebound shots render (writes the exact store sizes), or re-export the image at a listed size',
|
||||||
|
alpha: 'storebound shots render writes 24-bit RGB; for your own images flatten to RGB (ffmpeg -i in.png -pix_fmt rgb24 out.png)',
|
||||||
|
format: 'JPEG or 24-bit PNG: storebound shots jpeg, or ffmpeg -pix_fmt rgb24',
|
||||||
|
bytes: 'storebound shots jpeg (q92 JPEG copies are about 4x smaller)',
|
||||||
|
count: 'add or remove scenes (shots.scenes), then storebound shots render',
|
||||||
|
overflow: 'shorten the copy in shots.copy, then storebound shots render and look at the contact sheet',
|
||||||
|
video: 'storebound shots video',
|
||||||
|
};
|
||||||
|
|
||||||
|
/** Local renders -> findings: store errors are blockers (the upload would fail or the store would reject the set),
|
||||||
|
* text overflow flags and other warnings stay warnings. */
|
||||||
|
export function rendersFindings(store: 'apple' | 'play', r: RendersCheck | undefined): Finding[] {
|
||||||
|
if (!r) return [];
|
||||||
|
const f: Finding[] = r.issues.map(i => ({ store, level: i.level === 'error' ? 'blocker' : 'warn', code: `renders-${i.code}`,
|
||||||
|
msg: `${i.where}: ${i.msg}`, fix: RENDER_FIX[i.code] }));
|
||||||
|
if (!f.length && r.images) f.push({ store, level: 'ok', code: 'renders', msg: `${r.images} local store images pass the size / alpha / count checks (${r.dir})` });
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
export interface AppleSnapshot {
|
export interface AppleSnapshot {
|
||||||
version: { versionString: string; state: string } | null;
|
version: { versionString: string; state: string } | null;
|
||||||
build: { number: string; processingState: string; usesNonExemptEncryption: boolean | null; declarationState: string | null } | null;
|
build: { number: string; processingState: string; usesNonExemptEncryption: boolean | null; declarationState: string | null } | null;
|
||||||
|
|
@ -21,6 +46,8 @@ export interface AppleSnapshot {
|
||||||
iaps: { productId: string; state: string; reviewScreenshot: boolean }[];
|
iaps: { productId: string; state: string; reviewScreenshot: boolean }[];
|
||||||
expectedProducts: string[];
|
expectedProducts: string[];
|
||||||
privacyUrl: UrlCheck;
|
privacyUrl: UrlCheck;
|
||||||
|
/** Local renders (Apple sizes only), checked before upload. Optional: validate fills it when a renders dir exists. */
|
||||||
|
renders?: RendersCheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PlaySnapshot {
|
export interface PlaySnapshot {
|
||||||
|
|
@ -35,6 +62,8 @@ export interface PlaySnapshot {
|
||||||
tracks: { track: string; releases: { status: string; versionCodes: string[]; userFraction?: number }[] }[];
|
tracks: { track: string; releases: { status: string; versionCodes: string[]; userFraction?: number }[] }[];
|
||||||
products: { productId: string; states: string[] }[];
|
products: { productId: string; states: string[] }[];
|
||||||
expectedProducts: string[];
|
expectedProducts: string[];
|
||||||
|
/** Local renders (Play sizes only), checked before upload. */
|
||||||
|
renders?: RendersCheck;
|
||||||
}
|
}
|
||||||
|
|
||||||
const EDITABLE = ['PREPARE_FOR_SUBMISSION', 'DEVELOPER_REJECTED', 'REJECTED', 'METADATA_REJECTED', 'INVALID_BINARY'];
|
const EDITABLE = ['PREPARE_FOR_SUBMISSION', 'DEVELOPER_REJECTED', 'REJECTED', 'METADATA_REJECTED', 'INVALID_BINARY'];
|
||||||
|
|
@ -104,6 +133,7 @@ export function appleRules(s: AppleSnapshot): Finding[] {
|
||||||
if (s.iaps.length && !f.some(x => x.code === 'iap')) add('ok', 'iap', `${s.iaps.length} in-app purchases ready`);
|
if (s.iaps.length && !f.some(x => x.code === 'iap')) add('ok', 'iap', `${s.iaps.length} in-app purchases ready`);
|
||||||
|
|
||||||
add(urlOk(s.privacyUrl) ? 'ok' : 'blocker', 'privacy-url', `privacy policy ${s.privacyUrl.url}: ${urlMsg(s.privacyUrl)}`, 'privacy-policy skill');
|
add(urlOk(s.privacyUrl) ? 'ok' : 'blocker', 'privacy-url', `privacy policy ${s.privacyUrl.url}: ${urlMsg(s.privacyUrl)}`, 'privacy-policy skill');
|
||||||
|
f.push(...rendersFindings('apple', s.renders));
|
||||||
return sortFindings(f);
|
return sortFindings(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -153,6 +183,7 @@ export function playRules(s: PlaySnapshot): Finding[] {
|
||||||
else if (!p.states.includes('ACTIVE')) add('blocker', 'products', `${id}: purchase option ${p.states.join(',') || 'no state'}`, 'storebound play products');
|
else if (!p.states.includes('ACTIVE')) add('blocker', 'products', `${id}: purchase option ${p.states.join(',') || 'no state'}`, 'storebound play products');
|
||||||
}
|
}
|
||||||
if (s.expectedProducts.length && !f.some(x => x.code === 'products')) add('ok', 'products', `${s.expectedProducts.length} products active`);
|
if (s.expectedProducts.length && !f.some(x => x.code === 'products')) add('ok', 'products', `${s.expectedProducts.length} products active`);
|
||||||
|
f.push(...rendersFindings('play', s.renders));
|
||||||
return sortFindings(f);
|
return sortFindings(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
// Local store checks of the renders folder, before any upload:
|
// Local store checks of the renders folder, before any upload:
|
||||||
// storebound shots check [--lang en,tr] [--variants] [--json]
|
// storebound shots check [--lang en,tr] [--variants] [--json]
|
||||||
// Per image: exact pixel size for its store type, no alpha (both stores), Play: no palette PNG, 8 MB per screenshot.
|
// Per image: pixel size for its store type (Apple: a listed size, portrait or landscape; Play screenshots: 320-3840 px,
|
||||||
|
// at most 2:1; feature graphic exactly 1024x500), no alpha (both stores), Play: JPEG or 24-bit PNG, 8 MB per screenshot.
|
||||||
|
// --variants also checks the A/B variant folders (<renders>/<variant>/<lang>/...).
|
||||||
// Per set: Play 2-8 phone screenshots, Apple 1-10 per display type, 13" iPad set when apple.ipad, feature graphic.
|
// Per set: Play 2-8 phone screenshots, Apple 1-10 per display type, 13" iPad set when apple.ipad, feature graphic.
|
||||||
// Per app preview: 886x1920 / 1200x1600, H.264, <= 30 fps, 15-30 s, stereo AAC track, <= 500 MB, <= 3 per set.
|
// Per app preview: 886x1920 / 1200x1600, H.264, <= 30 fps, 15-30 s, stereo AAC track, <= 500 MB, <= 3 per set.
|
||||||
// Text overflow flags come from the last `shots render` (report.json). Frames: with capture.source "folder" every frame
|
// Text overflow flags come from the last `shots render` (report.json). Frames: with capture.source "folder" every frame
|
||||||
|
|
@ -11,8 +13,9 @@ import type { ShipConfig } from '../lib/config';
|
||||||
import type { Ctx } from '../lib/ctx';
|
import type { Ctx } from '../lib/ctx';
|
||||||
import { log } from '../lib/log';
|
import { log } from '../lib/log';
|
||||||
import { checkFrames, type FrameIssue } from './devices';
|
import { checkFrames, type FrameIssue } from './devices';
|
||||||
import { DEFAULT_PHONE, DEFAULT_TABLET, defaultSizes, SIZES } from './lib';
|
import { defaultSizes, frameDims, SIZES } from './lib';
|
||||||
import { allIssues, requiredSets, type RendersScan, scanRenders } from './report';
|
import type { LocalIssue, RendersCheck } from '../lib/validate-rules';
|
||||||
|
import { allIssues, requiredSets, type RendersScan, scanRenders, storeOf } from './report';
|
||||||
import { imageInfo } from './spec';
|
import { imageInfo } from './spec';
|
||||||
|
|
||||||
/** Frame files the scenes (and the feature graphic) use, per language and device class. */
|
/** Frame files the scenes (and the feature graphic) use, per language and device class. */
|
||||||
|
|
@ -32,15 +35,26 @@ export function checkFrameFolder(config: ShipConfig, dir: string, langs: string[
|
||||||
if (!existsSync(d)) continue;
|
if (!existsSync(d)) continue;
|
||||||
for (const f of readdirSync(d).filter(x => /\.png$/i.test(x))) { const i = imageInfo(readFileSync(join(d, f))); found.set(`${lang}/${device}/${f}`, i); }
|
for (const f of readdirSync(d).filter(x => /\.png$/i.test(x))) { const i = imageInfo(readFileSync(join(d, f))); found.set(`${lang}/${device}/${f}`, i); }
|
||||||
}
|
}
|
||||||
const s = config.shots!;
|
return checkFrames(found, framesNeeded(config, langs), frameDims(config));
|
||||||
return checkFrames(found, framesNeeded(config, langs), { phone: { ...DEFAULT_PHONE, ...s.phone }, tablet: { ...DEFAULT_TABLET, ...s.tablet } });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function scanProject(ctx: Ctx): RendersScan {
|
export function scanProject(ctx: Ctx): RendersScan {
|
||||||
const { config, resolve } = ctx.loaded;
|
const { config, resolve } = ctx.loaded;
|
||||||
const langs = ctx.args.list('lang').length ? ctx.args.list('lang') : config.languages.map(l => l.id);
|
const langs = ctx.args.list('lang').length ? ctx.args.list('lang') : config.languages.map(l => l.id);
|
||||||
const dir = resolve(ctx.args.get('src') ?? config.renders ?? config.shots?.out ?? 'store/renders');
|
const dir = resolve(ctx.args.get('src') ?? config.renders ?? config.shots?.out ?? 'store/renders');
|
||||||
return scanRenders(dir, { langs, variants: Object.keys(config.shots?.variants ?? {}), required: requiredSets(config) });
|
return scanRenders(dir, { langs, variants: ctx.args.has('variants') ? Object.keys(config.shots?.variants ?? {}) : [], required: lang => requiredSets(config, lang) });
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Local renders check split per store, for `validate` (base renders only, no variants). null = no renders folder. */
|
||||||
|
export function rendersCheck(config: ShipConfig, dir: string): Record<'apple' | 'play', RendersCheck> | null {
|
||||||
|
if (!existsSync(dir)) return null;
|
||||||
|
const langs = config.languages.map(l => l.id);
|
||||||
|
const scan = scanRenders(dir, { langs, required: lang => requiredSets(config, lang) });
|
||||||
|
const out = { apple: { dir, images: 0, issues: [] as LocalIssue[] }, play: { dir, images: 0, issues: [] as LocalIssue[] } };
|
||||||
|
for (const img of scan.images) out[storeOf(img.rel)].images++;
|
||||||
|
for (const v of scan.videos) out[storeOf(v.rel)].images++;
|
||||||
|
for (const { where, issue } of allIssues(scan)) out[storeOf(where)].issues.push({ where, level: issue.level, code: issue.code, msg: issue.msg });
|
||||||
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function run(ctx: Ctx): Promise<void> {
|
export async function run(ctx: Ctx): Promise<void> {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,8 @@ export interface RendersScan { images: ImageEntry[]; videos: VideoEntry[]; sets:
|
||||||
/** Every NN.png|jpg of every size, plus preview/<target>/*.mp4|mov, for the given languages (and variants). Reads files;
|
/** Every NN.png|jpg of every size, plus preview/<target>/*.mp4|mov, for the given languages (and variants). Reads files;
|
||||||
* `probe` is injectable so tests do not need ffprobe. JPEG copies next to PNGs are checked as their own files but
|
* `probe` is injectable so tests do not need ffprobe. JPEG copies next to PNGs are checked as their own files but
|
||||||
* counted once per number. */
|
* counted once per number. */
|
||||||
export function scanRenders(dir: string, o: { langs: string[]; variants?: string[]; required?: Record<string, boolean>; sizes?: string[];
|
export function scanRenders(dir: string, o: { langs: string[]; variants?: string[];
|
||||||
|
required?: Record<string, boolean> | ((lang: string) => Record<string, boolean>); sizes?: string[];
|
||||||
probe?: (file: string) => ProbeInfo | null }): RendersScan {
|
probe?: (file: string) => ProbeInfo | null }): RendersScan {
|
||||||
const report = readReport(dir);
|
const report = readReport(dir);
|
||||||
const out: RendersScan = { images: [], videos: [], sets: [], variants: [], langs: o.langs };
|
const out: RendersScan = { images: [], videos: [], sets: [], variants: [], langs: o.langs };
|
||||||
|
|
@ -38,6 +39,7 @@ export function scanRenders(dir: string, o: { langs: string[]; variants?: string
|
||||||
if (variant) out.variants.push(variant);
|
if (variant) out.variants.push(variant);
|
||||||
for (const lang of o.langs) {
|
for (const lang of o.langs) {
|
||||||
const ldir = join(vdir, lang);
|
const ldir = join(vdir, lang);
|
||||||
|
const req = typeof o.required === 'function' ? o.required(lang) : o.required ?? {};
|
||||||
for (const size of o.sizes ?? Object.keys(SIZES)) {
|
for (const size of o.sizes ?? Object.keys(SIZES)) {
|
||||||
const sdir = join(ldir, size);
|
const sdir = join(ldir, size);
|
||||||
const files = existsSync(sdir) ? readdirSync(sdir).filter(f => (size === 'feature' ? /^1024x500\.(png|jpe?g)$/i : /^\d+\.(png|jpe?g)$/i).test(f)).sort() : [];
|
const files = existsSync(sdir) ? readdirSync(sdir).filter(f => (size === 'feature' ? /^1024x500\.(png|jpe?g)$/i : /^\d+\.(png|jpe?g)$/i).test(f)).sort() : [];
|
||||||
|
|
@ -50,7 +52,7 @@ export function scanRenders(dir: string, o: { langs: string[]; variants?: string
|
||||||
for (const msg of report[rel.replace(/\.jpe?g$/i, '.png')]?.overflow ?? []) issues.push({ level: 'warn', code: 'overflow', msg });
|
for (const msg of report[rel.replace(/\.jpe?g$/i, '.png')]?.overflow ?? []) issues.push({ level: 'warn', code: 'overflow', msg });
|
||||||
out.images.push({ rel, lang, variant, size, file, info, issues });
|
out.images.push({ rel, lang, variant, size, file, info, issues });
|
||||||
}
|
}
|
||||||
const required = o.required?.[size] ?? false;
|
const required = req[size] ?? false;
|
||||||
if (!files.length && !required) continue;
|
if (!files.length && !required) continue;
|
||||||
out.sets.push({ lang, variant, size, count: numbers.size, issues: checkCount(numbers.size, size, required) });
|
out.sets.push({ lang, variant, size, count: numbers.size, issues: checkCount(numbers.size, size, required) });
|
||||||
}
|
}
|
||||||
|
|
@ -78,9 +80,14 @@ export function ffprobe(file: string): ProbeInfo | null {
|
||||||
return parseProbe(r.stdout.toString(), statSync(file).size);
|
return parseProbe(r.stdout.toString(), statSync(file).size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Which sets the stores require for this config (missing ones are errors, others only checked when present). */
|
/** Which sets the stores require for this config (missing ones are errors, others only checked when present). With a
|
||||||
export function requiredSets(c: { apple?: { ipad?: boolean } | undefined; play?: unknown }): Record<string, boolean> {
|
* language id: Apple sets only when that language has an App Store locale, Play sets only when it has a Play code. */
|
||||||
return { ios69: !!c.apple, ipad13: !!c.apple?.ipad, play: !!c.play, feature: !!c.play };
|
export function requiredSets(c: { apple?: { ipad?: boolean } | undefined; play?: unknown; languages?: { id: string; apple?: string; play?: string | string[] }[] },
|
||||||
|
lang?: string): Record<string, boolean> {
|
||||||
|
const l = lang === undefined ? undefined : c.languages?.find(x => x.id === lang);
|
||||||
|
const apple = !!c.apple && (!l || !!l.apple);
|
||||||
|
const play = !!c.play && (!l || (Array.isArray(l.play) ? l.play.length > 0 : !!l.play));
|
||||||
|
return { ios69: apple, ipad13: apple && !!c.apple?.ipad, play, feature: play };
|
||||||
}
|
}
|
||||||
|
|
||||||
export const allIssues = (s: RendersScan): { where: string; issue: Issue }[] => [
|
export const allIssues = (s: RendersScan): { where: string; issue: Issue }[] => [
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,10 @@
|
||||||
// Sources (checked October 2026):
|
// Sources (checked October 2026):
|
||||||
// Apple screenshots: App Store Connect Help > Reference > Screenshot specifications
|
// Apple screenshots: App Store Connect Help > Reference > Screenshot specifications
|
||||||
// https://developer.apple.com/help/app-store-connect/reference/app-information/screenshot-specifications
|
// https://developer.apple.com/help/app-store-connect/reference/app-information/screenshot-specifications
|
||||||
|
// (13" iPad: 2064 x 2752 or 2048 x 2732 portrait, landscape too, "Required if app runs on iPad"; 1-10 per size;
|
||||||
|
// .jpeg / .jpg / .png, no alpha channels or transparency)
|
||||||
|
// ASC API enum ScreenshotDisplayType (no 13" value; the 13" set is APP_IPAD_PRO_3GEN_129):
|
||||||
|
// https://developer.apple.com/documentation/appstoreconnectapi/screenshotdisplaytype
|
||||||
// Apple app previews: App Store Connect Help > Reference > App preview specifications
|
// Apple app previews: App Store Connect Help > Reference > App preview specifications
|
||||||
// https://developer.apple.com/help/app-store-connect/reference/app-information/app-preview-specifications
|
// https://developer.apple.com/help/app-store-connect/reference/app-information/app-preview-specifications
|
||||||
// Google Play graphics: Play Console Help "Add preview assets to showcase your app" (answer 9866151)
|
// Google Play graphics: Play Console Help "Add preview assets to showcase your app" (answer 9866151)
|
||||||
|
|
@ -47,14 +51,15 @@ export function playScreenshotOk(w: number, h: number): boolean {
|
||||||
return lo >= 320 && hi <= 3840 && hi <= 2 * lo;
|
return lo >= 320 && hi <= 3840 && hi <= 2 * lo;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ImageInfo { format: 'png' | 'jpeg' | 'unknown'; w: number; h: number; alpha: boolean; palette: boolean; bytes: number }
|
/** depth = bits per channel (PNG IHDR bit depth; 8 for JPEG). */
|
||||||
|
export interface ImageInfo { format: 'png' | 'jpeg' | 'unknown'; w: number; h: number; alpha: boolean; palette: boolean; bytes: number; depth: number }
|
||||||
|
|
||||||
/** Width / height / alpha from the PNG IHDR (+ tRNS) or the JPEG SOF marker. Pure, reads only the buffer. */
|
/** Width / height / alpha from the PNG IHDR (+ tRNS) or the JPEG SOF marker. Pure, reads only the buffer. */
|
||||||
export function imageInfo(b: Uint8Array): ImageInfo {
|
export function imageInfo(b: Uint8Array): ImageInfo {
|
||||||
const bytes = b.length;
|
const bytes = b.length;
|
||||||
const dv = new DataView(b.buffer, b.byteOffset, b.byteLength);
|
const dv = new DataView(b.buffer, b.byteOffset, b.byteLength);
|
||||||
if (bytes > 24 && b[0] === 0x89 && b[1] === 0x50 && b[2] === 0x4e && b[3] === 0x47) {
|
if (bytes > 24 && b[0] === 0x89 && b[1] === 0x50 && b[2] === 0x4e && b[3] === 0x47) {
|
||||||
const w = dv.getUint32(16), h = dv.getUint32(20), colorType = b[25]!;
|
const w = dv.getUint32(16), h = dv.getUint32(20), depth = b[24]!, colorType = b[25]!;
|
||||||
let trns = false;
|
let trns = false;
|
||||||
for (let p = 8; p + 8 <= bytes;) {
|
for (let p = 8; p + 8 <= bytes;) {
|
||||||
const len = dv.getUint32(p), type = String.fromCharCode(b[p + 4]!, b[p + 5]!, b[p + 6]!, b[p + 7]!);
|
const len = dv.getUint32(p), type = String.fromCharCode(b[p + 4]!, b[p + 5]!, b[p + 6]!, b[p + 7]!);
|
||||||
|
|
@ -62,7 +67,7 @@ export function imageInfo(b: Uint8Array): ImageInfo {
|
||||||
if (type === 'IDAT' || type === 'IEND') break;
|
if (type === 'IDAT' || type === 'IEND') break;
|
||||||
p += 12 + len;
|
p += 12 + len;
|
||||||
}
|
}
|
||||||
return { format: 'png', w, h, alpha: colorType === 4 || colorType === 6 || trns, palette: colorType === 3, bytes };
|
return { format: 'png', w, h, alpha: colorType === 4 || colorType === 6 || trns, palette: colorType === 3, bytes, depth };
|
||||||
}
|
}
|
||||||
if (bytes > 4 && b[0] === 0xff && b[1] === 0xd8) {
|
if (bytes > 4 && b[0] === 0xff && b[1] === 0xd8) {
|
||||||
for (let p = 2; p + 9 < bytes;) {
|
for (let p = 2; p + 9 < bytes;) {
|
||||||
|
|
@ -71,11 +76,11 @@ export function imageInfo(b: Uint8Array): ImageInfo {
|
||||||
if (m === 0xd8 || m === 0x01 || (m >= 0xd0 && m <= 0xd7)) { p += 2; continue; }
|
if (m === 0xd8 || m === 0x01 || (m >= 0xd0 && m <= 0xd7)) { p += 2; continue; }
|
||||||
const len = dv.getUint16(p + 2);
|
const len = dv.getUint16(p + 2);
|
||||||
if (m >= 0xc0 && m <= 0xcf && m !== 0xc4 && m !== 0xc8 && m !== 0xcc)
|
if (m >= 0xc0 && m <= 0xcf && m !== 0xc4 && m !== 0xc8 && m !== 0xcc)
|
||||||
return { format: 'jpeg', w: dv.getUint16(p + 7), h: dv.getUint16(p + 5), alpha: false, palette: false, bytes };
|
return { format: 'jpeg', w: dv.getUint16(p + 7), h: dv.getUint16(p + 5), alpha: false, palette: false, bytes, depth: 8 };
|
||||||
p += 2 + len;
|
p += 2 + len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { format: 'unknown', w: 0, h: 0, alpha: false, palette: false, bytes };
|
return { format: 'unknown', w: 0, h: 0, alpha: false, palette: false, bytes, depth: 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
export type IssueLevel = 'error' | 'warn';
|
export type IssueLevel = 'error' | 'warn';
|
||||||
|
|
@ -87,10 +92,18 @@ export function checkImage(info: ImageInfo, sizeKey: string): Issue[] {
|
||||||
if (!s) return [{ level: 'error', code: 'size', msg: `unknown size key ${sizeKey}` }];
|
if (!s) return [{ level: 'error', code: 'size', msg: `unknown size key ${sizeKey}` }];
|
||||||
const out: Issue[] = [];
|
const out: Issue[] = [];
|
||||||
if (info.format === 'unknown') return [{ level: 'error', code: 'format', msg: 'not a PNG or JPEG' }];
|
if (info.format === 'unknown') return [{ level: 'error', code: 'format', msg: 'not a PNG or JPEG' }];
|
||||||
if (!s.sizes.some(([w, h]) => w === info.w && h === info.h))
|
// Apple: one of the listed sizes, portrait or landscape. Play screenshots: any size Play accepts (the listed one is
|
||||||
out.push({ level: 'error', code: 'size', msg: `${info.w}x${info.h}, ${s.label} wants ${s.sizes.map(([w, h]) => `${w}x${h}`).join(' or ')}` });
|
// what `shots render` writes). Feature graphic: exactly 1024 x 500.
|
||||||
|
const exact = s.sizes.some(([w, h]) => (w === info.w && h === info.h) || (s.store === 'apple' && w === info.h && h === info.w));
|
||||||
|
const playShot = s.store === 'play' && s.type !== 'featureGraphic';
|
||||||
|
if (!exact && !(playShot && playScreenshotOk(info.w, info.h))) {
|
||||||
|
const want = playShot ? `${s.sizes.map(([w, h]) => `${w}x${h}`).join(' or ')} (any 320-3840 px per side, long side at most 2x the short)`
|
||||||
|
: s.sizes.map(([w, h]) => `${w}x${h}`).join(' or ') + (s.store === 'apple' ? ' (or landscape)' : '');
|
||||||
|
out.push({ level: 'error', code: 'size', msg: `${info.w}x${info.h}, ${s.label} wants ${want}` });
|
||||||
|
}
|
||||||
if (info.alpha) out.push({ level: 'error', code: 'alpha', msg: 'has an alpha channel / transparency (both stores reject it): re-render or flatten to RGB' });
|
if (info.alpha) out.push({ level: 'error', code: 'alpha', msg: 'has an alpha channel / transparency (both stores reject it): re-render or flatten to RGB' });
|
||||||
if (info.palette && s.store === 'play') out.push({ level: 'error', code: 'format', msg: 'palette PNG: Play wants JPEG or 24-bit PNG' });
|
if (info.palette && s.store === 'play') out.push({ level: 'error', code: 'format', msg: 'palette PNG: Play wants JPEG or 24-bit PNG' });
|
||||||
|
else if (info.format === 'png' && info.depth !== 8 && s.store === 'play') out.push({ level: 'error', code: 'format', msg: `${info.depth}-bit per channel PNG: Play wants JPEG or 24-bit PNG (8 bits per channel)` });
|
||||||
if (s.maxBytes !== null && info.bytes > s.maxBytes)
|
if (s.maxBytes !== null && info.bytes > s.maxBytes)
|
||||||
out.push({ level: 'error', code: 'bytes', msg: `${(info.bytes / 1024 / 1024).toFixed(1)} MB > ${s.maxBytes / 1024 / 1024} MB` });
|
out.push({ level: 'error', code: 'bytes', msg: `${(info.bytes / 1024 / 1024).toFixed(1)} MB > ${s.maxBytes / 1024 / 1024} MB` });
|
||||||
return out;
|
return out;
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,18 @@
|
||||||
// Store readiness report (read-only on both stores): what still blocks a submission, in the order to fix it.
|
// 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.
|
// 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
|
// 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 { ascClient, type J } from './apple/asc';
|
||||||
|
import { requiredDisplayTypes } from './apple/screenshots';
|
||||||
import { playCodes } from './lib/config';
|
import { playCodes } from './lib/config';
|
||||||
import type { Ctx } from './lib/ctx';
|
import type { Ctx } from './lib/ctx';
|
||||||
import { checkUrl } from './lib/http';
|
import { checkUrl } from './lib/http';
|
||||||
import { log, warn } from './lib/log';
|
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 { playClient } from './play/client';
|
||||||
import { listOneTimeProducts } from './play/products';
|
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,
|
version: v ? { versionString: v.attributes.versionString, state: v.attributes.appVersionState ?? v.attributes.appStoreState } : null,
|
||||||
build, locales, reviewDetail, ageRating,
|
build, locales, reviewDetail, ageRating,
|
||||||
expectedLocales: config.languages.map(l => l.apple).filter((x): x is string => !!x),
|
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'),
|
priceSchedule: !!sched?.included?.some((x: J) => x.type === 'appPrices'),
|
||||||
availability: !!avail?.data,
|
availability: !!avail?.data,
|
||||||
iaps, expectedProducts: (config.products ?? []).map(p => p.id),
|
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 a = ctx.args;
|
||||||
const both = !a.has('apple') && !a.has('play');
|
const both = !a.has('apple') && !a.has('play');
|
||||||
const findings: Finding[] = [];
|
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) {
|
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');
|
} else if (a.has('apple')) warn('validate', 'no apple section in the config');
|
||||||
if ((both || a.has('play')) && config.play) {
|
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');
|
} else if (a.has('play')) warn('validate', 'no play section in the config');
|
||||||
const blockers = findings.filter(f => f.level === 'blocker').length;
|
const blockers = findings.filter(f => f.level === 'blocker').length;
|
||||||
if (a.has('json')) console.log(JSON.stringify({ blockers, findings }, null, 2));
|
if (a.has('json')) console.log(JSON.stringify({ blockers, findings }, null, 2));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue