- validate: read-only App Store Connect + Play report with ordered blockers (exit 1) - apple release --phased on|pause|resume|complete and --manual-release (asks first) - apple status --wait-review (exit 0 approved, 1 rejected, 7 timeout), apple next-build, apple encryption - play rollout --fraction|--halt|--resume|--complete, play next-version-code - check --aso, whats-new --since <tag>, privacy-manifest --ios <path>, version - Apple IAP description limit is 45 characters (App Store Connect Help), not 55 - config: apple.usesNonExemptEncryption, apple.screenshotTypes, ads.appAdsTxt
70 lines
4.8 KiB
TypeScript
70 lines
4.8 KiB
TypeScript
// Offline sanity check of everything the store commands read: config, both listing files, the screenshot copy, data
|
|
// safety answers, product texts vs store limits, and the files the config points at. No network, no credentials.
|
|
// storebound check everything above
|
|
// storebound check --aso keyword audit of both listing files (App Store keyword field, Play stuffing); exit 1 on errors
|
|
import { existsSync, readFileSync } from 'node:fs';
|
|
import { type AsoFinding, auditAso } from './lib/aso';
|
|
import { playCodes } from './lib/config';
|
|
import { APPLE_IAP_LIMITS, len, parseAppStoreListing, parsePlayListing } from './lib/copy';
|
|
import type { Ctx } from './lib/ctx';
|
|
import { dataSafetyRows } from './lib/data-safety';
|
|
import { log, warn } from './lib/log';
|
|
import { type CopyFile, validateCopy } from './shots/lib';
|
|
|
|
function aso(ctx: Ctx): void {
|
|
const { config, resolve } = ctx.loaded;
|
|
const apple = config.apple ? parseAppStoreListing(readFileSync(resolve(config.apple.listing ?? 'store/appstore.md'), 'utf8')) : undefined;
|
|
const play = config.play ? parsePlayListing(readFileSync(resolve(config.play.listing ?? 'store/listing.md'), 'utf8'), config.app.name) : undefined;
|
|
const f: AsoFinding[] = auditAso({ apple, play, appName: config.app.name, storefront: ctx.args.get('storefront') ?? 'US' });
|
|
const tag = { error: 'ERROR', warn: 'warn ', info: 'info ' } as const;
|
|
for (const x of f) console.log(`${tag[x.level]} [${x.where}] ${x.msg}`);
|
|
const errors = f.filter(x => x.level === 'error').length;
|
|
log('aso', `${errors} errors, ${f.filter(x => x.level === 'warn').length} warnings, ${f.filter(x => x.level === 'info').length} hints`);
|
|
if (errors) process.exitCode = 1;
|
|
}
|
|
|
|
export async function run(ctx: Ctx): Promise<void> {
|
|
if (ctx.args.has('aso')) return aso(ctx);
|
|
const { config, resolve, path } = ctx.loaded;
|
|
log('check', `config ok: ${path}`);
|
|
const problems: string[] = [];
|
|
const tryDo = (what: string, fn: () => string): void => { try { log('check', `${what}: ${fn()}`); } catch (e) { problems.push(`${what}: ${(e as Error).message}`); } };
|
|
|
|
if (config.play) tryDo('play listing', () => {
|
|
const f = resolve(config.play!.listing ?? 'store/listing.md');
|
|
const copy = parsePlayListing(readFileSync(f, 'utf8'), config.app.name);
|
|
const want = config.languages.flatMap(playCodes);
|
|
const missing = want.filter(c => !copy.some(x => x.lang === c));
|
|
if (missing.length) warn('check', `play listing has no section for ${missing.join(', ')}`);
|
|
const def = copy.find(x => x.lang === (config.play!.defaultLanguage ?? 'en-US'));
|
|
const same = copy.filter(x => def && x !== def && x.whatsNew && x.whatsNew === def.whatsNew && x.lang.slice(0, 2) !== def.lang.slice(0, 2));
|
|
if (same.length) warn('check', `what's new of ${same.map(x => x.lang).join(', ')} is the same text as ${def!.lang}: translate it`);
|
|
return `${copy.length} languages`;
|
|
});
|
|
if (config.apple) tryDo('appstore listing', () => {
|
|
const f = resolve(config.apple!.listing ?? 'store/appstore.md');
|
|
const copy = parseAppStoreListing(readFileSync(f, 'utf8'));
|
|
const missing = config.languages.filter(l => l.apple && !copy[l.apple]).map(l => l.apple);
|
|
if (missing.length) warn('check', `appstore listing has no section for ${missing.join(', ')}`);
|
|
return `${Object.keys(copy).length} locales`;
|
|
});
|
|
if (config.dataSafety) tryDo('data safety', () => `${dataSafetyRows(config.dataSafety!).length - 1} CSV rows`);
|
|
for (const p of config.products ?? []) for (const [lang, l] of Object.entries(p.listings)) {
|
|
if (config.apple && len(l.description) > APPLE_IAP_LIMITS.description) problems.push(`product ${p.id} ${lang}: description ${len(l.description)} > ${APPLE_IAP_LIMITS.description} (App Store limit)`);
|
|
if (len(l.description) > 200) problems.push(`product ${p.id} ${lang}: description ${len(l.description)} > 200 (Play limit)`);
|
|
}
|
|
if (config.shots) tryDo('shots copy', () => {
|
|
const copy = JSON.parse(readFileSync(resolve(config.shots!.copy), 'utf8')) as CopyFile;
|
|
const e = validateCopy(copy, config.shots!, config.languages.map(l => l.id));
|
|
if (e.length) throw new Error(e.join('; '));
|
|
return `${Object.keys(copy).length} languages x ${config.shots!.scenes.length} scenes`;
|
|
});
|
|
const files = [config.icons?.composite, config.icons?.foreground, config.icons?.background, config.shots?.logo,
|
|
...(config.products ?? []).map(p => p.reviewScreenshot)].filter((f): f is string => !!f);
|
|
for (const f of new Set(files)) if (!existsSync(resolve(f))) problems.push(`missing file: ${f}`);
|
|
if (existsSync(resolve('.gitignore')) && !/^\/?\.storebound\/?$/m.test(readFileSync(resolve('.gitignore'), 'utf8')))
|
|
problems.push('.gitignore does not ignore .storebound/ (credentials live there)');
|
|
|
|
if (problems.length) { for (const p of problems) console.error(` - ${p}`); throw new Error(`${problems.length} problems`); }
|
|
log('check', 'all good');
|
|
}
|