apple.name: the App Store name when the plain name is taken; console fill, apple listing, pull, check (30-char error, same-name hint), scan use it
This commit is contained in:
parent
d43b892ab4
commit
ebd5f1abec
22 changed files with 157 additions and 25 deletions
|
|
@ -12,6 +12,7 @@ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|||
import { type AppleCopy, parseAppStoreListing } from '../lib/copy';
|
||||
import { compactDiff } from '../lib/diff';
|
||||
import { mergeAppleListing, overLimits } from '../lib/listing-pull';
|
||||
import { appleName } from '../lib/config';
|
||||
import type { Ctx } from '../lib/ctx';
|
||||
import { need } from '../lib/ctx';
|
||||
import { done, log, printJson, warn } from '../lib/log';
|
||||
|
|
@ -65,7 +66,7 @@ async function pull(ctx: Ctx): Promise<void> {
|
|||
}
|
||||
const file = resolve(config.apple?.listing ?? 'store/appstore.md');
|
||||
const before = existsSync(file) ? readFileSync(file, 'utf8') : '# App Store listing copy\n\nPulled from App Store Connect by `storebound apple listing pull`.\n';
|
||||
const r = mergeAppleListing(before, remote);
|
||||
const r = mergeAppleListing(before, remote, appleName(config));
|
||||
const over = overLimits(r.changes, 'apple');
|
||||
const diff = compactDiff(before, r.md);
|
||||
if (a.has('json')) printJson({ version: v.attributes.versionString, state: live, file, write: a.has('write') && !a.has('dry'), changes: r.changes, added: r.added, overLimits: over, diff });
|
||||
|
|
@ -117,7 +118,7 @@ export async function run(ctx: Ctx): Promise<void> {
|
|||
|
||||
const info = await c.editableAppInfo();
|
||||
await upsertLocs(c, `/v1/appInfos/${info.id}/appInfoLocalizations`, 'appInfoLocalizations', 'appInfo', 'appInfos', info.id,
|
||||
Object.fromEntries(Object.entries(listing).map(([l, f]) => [l, { name: f.name ?? app.name, subtitle: f.subtitle, privacyPolicyUrl: app.privacyPolicyUrl }])));
|
||||
Object.fromEntries(Object.entries(listing).map(([l, f]) => [l, { name: f.name ?? appleName(config), subtitle: f.subtitle, privacyPolicyUrl: app.privacyPolicyUrl }])));
|
||||
await upsertLocs(c, `/v1/appStoreVersions/${v.id}/appStoreVersionLocalizations`, 'appStoreVersionLocalizations', 'appStoreVersion', 'appStoreVersions', v.id,
|
||||
Object.fromEntries(Object.entries(listing).map(([l, f]) => [l, { description: f.description, keywords: f.keywords, promotionalText: f.promotionalText,
|
||||
whatsNew: f.whatsNew, supportUrl: app.supportUrl, marketingUrl: app.marketingUrl ?? app.website }])));
|
||||
|
|
|
|||
14
cli/check.ts
14
cli/check.ts
|
|
@ -3,12 +3,12 @@
|
|||
// subscriptions + terms URL) and the files the config points at. No network; credentials are only checked for presence.
|
||||
// storebound check everything above
|
||||
// storebound check --aso keyword audit of both listing files (App Store keyword field, Play stuffing); exit 1 on errors
|
||||
// --json structured result ({ ok, items, warnings, problems } or { findings, errors }), exit 1 on problems
|
||||
// --json structured result ({ ok, items, warnings, hints, problems } or { findings, errors }), exit 1 on problems
|
||||
import { existsSync, readFileSync } from 'node:fs';
|
||||
import { relative } from 'node:path';
|
||||
import { type AsoFinding, auditAso } from './lib/aso';
|
||||
import { playCodes } from './lib/config';
|
||||
import { APPLE_IAP_LIMITS, len, parseAppStoreListing, parsePlayListing } from './lib/copy';
|
||||
import { appleName, playCodes } from './lib/config';
|
||||
import { APPLE_IAP_LIMITS, appleNameIssues, len, parseAppStoreListing, parsePlayListing } from './lib/copy';
|
||||
import type { Ctx } from './lib/ctx';
|
||||
import { dataSafetyRows } from './lib/data-safety';
|
||||
import { reviewDemoAccount } from './lib/credentials';
|
||||
|
|
@ -21,7 +21,7 @@ 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 f: AsoFinding[] = auditAso({ apple, play, appName: appleName(config), storefront: ctx.args.get('storefront') ?? 'US' });
|
||||
if (ctx.args.has('json')) { const errors = f.filter(x => x.level === 'error').length; printJson({ findings: f, errors }); if (errors) process.exitCode = 1; return; }
|
||||
const tag = { error: 'ERROR', warn: 'warn ', info: 'info ' } as const;
|
||||
for (const x of f) console.log(`${tag[x.level]} [${x.where}] ${x.msg}`);
|
||||
|
|
@ -37,6 +37,7 @@ export async function run(ctx: Ctx): Promise<void> {
|
|||
const problems: string[] = [];
|
||||
const items: { what: string; detail: string }[] = [];
|
||||
const warnings: string[] = [];
|
||||
const hints: string[] = [];
|
||||
const note = (msg: string): void => { warnings.push(msg); warn('check', msg); };
|
||||
const tryDo = (what: string, fn: () => string): void => {
|
||||
try { const detail = fn(); items.push({ what, detail }); log('check', `${what}: ${detail}`); } catch (e) {
|
||||
|
|
@ -63,6 +64,9 @@ export async function run(ctx: Ctx): Promise<void> {
|
|||
const copy = parseAppStoreListing(readFileSync(f, 'utf8'));
|
||||
const missing = config.languages.filter(l => l.apple && !copy[l.apple]).map(l => l.apple);
|
||||
if (missing.length) note(`appstore listing has no section for ${missing.join(', ')}`);
|
||||
for (const i of appleNameIssues(copy, config.languages.flatMap(l => l.apple ? [l.apple] : []), appleName(config), config.app.name)) {
|
||||
if (i.level === 'error') problems.push(i.msg); else { hints.push(i.msg); log('check', `hint: ${i.msg}`); }
|
||||
}
|
||||
return `${Object.keys(copy).length} locales`;
|
||||
});
|
||||
// listing translation drafts (storebound listing translate): fine to keep working on, not to push unreviewed
|
||||
|
|
@ -95,7 +99,7 @@ export async function run(ctx: Ctx): Promise<void> {
|
|||
if (existsSync(resolve('.gitignore')) && !/^\/?\.storebound\/?$/m.test(readFileSync(resolve('.gitignore'), 'utf8')))
|
||||
problems.push('.gitignore does not ignore .storebound/ (credentials live there)');
|
||||
|
||||
if (ctx.args.has('json')) { printJson({ config: path, ok: !problems.length, items, warnings, problems }); if (problems.length) process.exitCode = 1; return; }
|
||||
if (ctx.args.has('json')) { printJson({ config: path, ok: !problems.length, items, warnings, hints, problems }); if (problems.length) process.exitCode = 1; return; }
|
||||
if (problems.length) { for (const p of problems) console.error(` - ${p}`); throw new Error(`${problems.length} problems`); }
|
||||
log('check', 'all good');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -490,6 +490,10 @@ export interface ShipConfig {
|
|||
};
|
||||
apple?: {
|
||||
bundleId: string; appId?: string; primaryLocale?: string; listing?: string; info?: AppleAppInfo; reviewShots?: string;
|
||||
/** App Store name in the primary locale (at most 30 characters) when it differs from app.name, e.g. because the plain
|
||||
* name is taken on the App Store ("STAR DASH: Stone Age to 2100"). Default app.name. A `### name` block in the
|
||||
* App Store listing file wins for its locale. app.name stays the Play / on-device name. */
|
||||
name?: string;
|
||||
/** Apple Developer Team ID (10 characters, Membership details). apple-app-site-association and ad-hoc export use it. */
|
||||
teamId?: string;
|
||||
/** Ad-hoc / release-testing export (`storebound apple adhoc`). */
|
||||
|
|
@ -681,6 +685,12 @@ function validateConsole(c: ConsoleConfig): string[] {
|
|||
}
|
||||
|
||||
/** Platforms of the app (app identity): app.platforms, else from the store sections. */
|
||||
/** App Store name limit (characters). */
|
||||
export const APPLE_NAME_MAX = 30;
|
||||
|
||||
/** The App Store name in the primary locale: apple.name, else app.name. Per-locale `### name` blocks win over it. */
|
||||
export const appleName = (c: Pick<ShipConfig, 'app' | 'apple'>): string => c.apple?.name?.trim() || c.app.name;
|
||||
|
||||
export const platformsOf = (c: Pick<ShipConfig, 'app' | 'apple' | 'play'>): Platform[] =>
|
||||
c.app.platforms ?? [...(c.apple ? ['ios' as const] : []), ...(c.play ? ['android' as const] : [])];
|
||||
|
||||
|
|
@ -754,6 +764,9 @@ export function validateConfig(c: unknown): string[] {
|
|||
e.push(`play.billingPrograms: a list of ${PLAY_BILLING_PROGRAMS.join(' | ')}`);
|
||||
if (cfg.apple) {
|
||||
if (!ID_RE.test(cfg.apple.bundleId ?? '')) e.push('apple.bundleId: not a bundle id (com.example.game)');
|
||||
const an = cfg.apple.name;
|
||||
if (an !== undefined && (typeof an !== 'string' || !an.trim())) e.push('apple.name: the App Store name (text), or leave it out to use app.name');
|
||||
else if (an !== undefined && [...an].length > APPLE_NAME_MAX) e.push(`apple.name: ${[...an].length} characters > ${APPLE_NAME_MAX} (App Store limit)`);
|
||||
if (cfg.apple.appId && !/^\d+$/.test(cfg.apple.appId)) e.push('apple.appId: numeric Apple ID of the app (App Store Connect > App Information)');
|
||||
const enc = cfg.apple.usesNonExemptEncryption;
|
||||
if (enc !== undefined && typeof enc !== 'boolean') e.push('apple.usesNonExemptEncryption: true | false');
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
// https://support.google.com/googleplay/android-developer/answer/9859655 (content ratings)
|
||||
// https://support.google.com/googleplay/android-developer/answer/9867159 (target audience and content)
|
||||
import { AGE_RATING_NONE } from '../apple/appinfo';
|
||||
import { type AgeGroup, AGE_GROUPS, IARC_QUESTIONS, type IarcQuestion, profileOf, type ShipConfig } from './config';
|
||||
import { type AgeGroup, AGE_GROUPS, appleName, IARC_QUESTIONS, type IarcQuestion, profileOf, type ShipConfig } from './config';
|
||||
import { APPLE_PRIVACY, applePurpose } from './declarations';
|
||||
import { maskUser } from './credentials';
|
||||
|
||||
|
|
@ -86,7 +86,8 @@ function appRecord(config: ShipConfig): Answer[] {
|
|||
const lang = locale ? LANGUAGE_NAMES[locale] : undefined;
|
||||
return [
|
||||
a ? ok('platform:ios', 'Platforms: iOS', true, 'apple section') : ask('platform:ios', 'Platforms: iOS', 'config', 'The config has no apple section.'),
|
||||
ok('name', 'Name', config.app.name, 'app.name', 'Must be unique on the App Store; App Store Connect says so when it is taken.'),
|
||||
ok('name', 'Name', appleName(config), a?.name?.trim() ? 'apple.name' : 'app.name',
|
||||
`Must be unique on the App Store (at most 30 characters); when App Store Connect says it is already being used, set apple.name (e.g. "${config.app.name}: <short tagline>") and fill again.`),
|
||||
lang ? ok('language', 'Primary Language', lang, a?.primaryLocale ? 'apple.primaryLocale' : 'languages[0].apple')
|
||||
: ask('language', 'Primary Language', 'apple.primaryLocale', locale ? `Pick the language of locale "${locale}".` : 'Set apple.primaryLocale (e.g. en-US).'),
|
||||
a?.bundleId ? ok('bundleId', 'Bundle ID', a.bundleId, 'apple.bundleId', 'Register it first if it is not in the list: storebound apple bundle.')
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
// The names are modeled on Apple's and Google's public help pages (sources in console-answers.ts), not recorded from a
|
||||
// signed-in console: the exact App Privacy dialog titles, the IARC question wording and the Play category names could
|
||||
// not be verified without an account, which is why every field has candidates and the engine falls back on a miss.
|
||||
import { AGE_GROUPS, type ShipConfig } from './config';
|
||||
import { AGE_GROUPS, appleName, type ShipConfig } from './config';
|
||||
import { AGE_LABELS, type Answer, APPLE_PURPOSES, type FormId } from './console-answers';
|
||||
|
||||
/** An accessible name: a string matches exactly, a RegExp matches the name. */
|
||||
|
|
@ -188,12 +188,13 @@ const POLICY: Name[] = ['Policy and programs', 'Policy', 'Politika ve programlar
|
|||
|
||||
/**
|
||||
* The steps that open a form after sign-in, built from the config only (apple.appId, apple.bundleId, play.packageName,
|
||||
* app.name). The last step waits for the form itself. Pure.
|
||||
* apple.name / app.name). The last step waits for the form itself. Pure.
|
||||
*/
|
||||
export function navPlan(id: FormId, config: ShipConfig, bases: NavBases = NAV_BASES): NavStep[] {
|
||||
const asc = bases.asc.replace(/\/$/, ''), play = bases.play.replace(/\/$/, '');
|
||||
const name = config.app?.name;
|
||||
const named = name ? { name } : {};
|
||||
const appleNamed = name ? { name: appleName(config) } : {};
|
||||
switch (id) {
|
||||
case 'apple-app-record': return [
|
||||
{ kind: 'goto', label: 'open Apps', url: `${asc}/apps` },
|
||||
|
|
@ -206,7 +207,7 @@ export function navPlan(id: FormId, config: ShipConfig, bases: NavBases = NAV_BA
|
|||
const appId = config.apple?.appId;
|
||||
const open: NavStep[] = appId ? [{ kind: 'goto', label: 'open App Privacy of the app (apple.appId)', url: `${asc}/apps/${encodeURIComponent(appId)}/distribution/privacy` }] : [
|
||||
{ kind: 'goto', label: 'open Apps', url: `${asc}/apps` },
|
||||
{ kind: 'pickApp', label: 'the app in the list', tokens: config.apple?.bundleId ? [config.apple.bundleId] : [], ...named },
|
||||
{ kind: 'pickApp', label: 'the app in the list', tokens: config.apple?.bundleId ? [config.apple.bundleId] : [], ...appleNamed },
|
||||
{ kind: 'click', label: 'App Privacy in the sidebar', roles: ['link', 'tab'], names: ['App Privacy', 'Uygulama Gizliliği', /^app privacy$/i] },
|
||||
];
|
||||
return [...open, { kind: 'wait', label: 'the App Privacy page', roles: ['heading'], names: ['App Privacy', 'Uygulama Gizliliği', /^app privacy$/i] }];
|
||||
|
|
|
|||
|
|
@ -83,3 +83,21 @@ export function parseAppStoreListing(md: string): Record<string, AppleCopy> {
|
|||
if (errors.length) throw new Error('appstore listing: ' + errors.join('; '));
|
||||
return out;
|
||||
}
|
||||
|
||||
export interface NameIssue { level: 'error' | 'info'; msg: string }
|
||||
|
||||
/**
|
||||
* The App Store name per locale (a `### name` block, else `fallback` = apple.name, else app.name) against the 30-char
|
||||
* limit, plus a hint when every locale uses the plain app.name: App Store names are unique, so a taken name stops the
|
||||
* app record ("already being used"). Pure.
|
||||
*/
|
||||
export function appleNameIssues(copy: Record<string, AppleCopy>, locales: string[], fallback: string, appName: string): NameIssue[] {
|
||||
const out: NameIssue[] = [];
|
||||
const all = [...new Set([...locales, ...Object.keys(copy)])];
|
||||
const names = all.map(l => ({ l, name: (copy[l]?.name ?? fallback).trim(), own: !!copy[l]?.name }));
|
||||
for (const n of names) if (len(n.name) > APPLE_LIMITS.name)
|
||||
out.push({ level: 'error', msg: `App Store name of ${n.l} is ${len(n.name)} > ${APPLE_LIMITS.name} characters: "${n.name}" (${n.own ? 'its ### name block' : fallback === appName ? 'app.name; set apple.name' : 'apple.name'})` });
|
||||
if (names.length && names.every(n => n.name === appName))
|
||||
out.push({ level: 'info', msg: `the App Store name is "${appName}" in every locale: App Store names are unique, so if it is taken App Store Connect refuses the record ("already being used"). Then set apple.name with a short suffix, e.g. "${appName}: <tagline>" (30 characters at most); app.name stays the Play and on-device name` });
|
||||
return out;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -471,7 +471,7 @@ export function planImport(scan: FastlaneScan, o: PlanOptions): ImportPlan {
|
|||
const md = `# ${appName} · App Store listing copy
|
||||
|
||||
Imported from fastlane deliver (\`storebound import fastlane\`). Source for \`storebound apple listing\`. One
|
||||
\`## <ASC locale>\` section per locale, one fenced block per \`### <field>\`: \`name\` (optional, defaults to \`app.name\`),
|
||||
\`## <ASC locale>\` section per locale, one fenced block per \`### <field>\`: \`name\` (optional, defaults to \`apple.name\`, else \`app.name\`),
|
||||
\`subtitle\` (30), \`promotionalText\` (170), \`keywords\` (100 bytes, comma separated, no spaces after commas),
|
||||
\`description\` (4000), \`whatsNew\` (optional). Privacy policy, support and marketing URL come from
|
||||
\`storebound.config.ts\`.
|
||||
|
|
|
|||
|
|
@ -29,8 +29,9 @@ function setBlock(sec: string, heading: RegExp, newHeading: string, text: string
|
|||
|
||||
const APPLE_ORDER: AppleField[] = ['name', 'subtitle', 'promotionalText', 'keywords', 'description', 'whatsNew'];
|
||||
|
||||
/** Live App Store texts per locale merged into the App Store listing file. Pure. */
|
||||
export function mergeAppleListing(md: string, remote: Record<string, AppleCopy>): MergeResult {
|
||||
/** Live App Store texts per locale merged into the App Store listing file. A name equal to `defaultName` (apple.name,
|
||||
* else app.name) is only written where the section already has a name block. Pure. */
|
||||
export function mergeAppleListing(md: string, remote: Record<string, AppleCopy>, defaultName?: string): MergeResult {
|
||||
const parts = md.split(/^(?=## )/m);
|
||||
const res: MergeResult = { md: '', changes: [], added: [], conflicts: [] };
|
||||
const seen = new Set<string>();
|
||||
|
|
@ -43,6 +44,7 @@ export function mergeAppleListing(md: string, remote: Record<string, AppleCopy>)
|
|||
for (const f of APPLE_ORDER) {
|
||||
const v = r[f];
|
||||
if (v === undefined || v === null || v === '') continue;
|
||||
if (f === 'name' && v === defaultName && !BLOCK(/name\b/).test(sec)) continue;
|
||||
const { sec: next, from } = setBlock(sec, new RegExp(`${f}\\b`), f, v);
|
||||
if (from !== v.trim()) res.changes.push({ section: loc, field: f, from, to: v });
|
||||
sec = next;
|
||||
|
|
@ -52,7 +54,7 @@ export function mergeAppleListing(md: string, remote: Record<string, AppleCopy>)
|
|||
let text = out.join('');
|
||||
for (const [loc, r] of Object.entries(remote).sort(([a], [b]) => a.localeCompare(b))) {
|
||||
if (seen.has(loc)) continue;
|
||||
const fields = APPLE_ORDER.filter(f => r[f]);
|
||||
const fields = APPLE_ORDER.filter(f => r[f] && !(f === 'name' && r[f] === defaultName));
|
||||
if (!fields.length) continue;
|
||||
res.added.push(loc);
|
||||
text = text.replace(/\s*$/, '') + `\n\n## ${loc}\n\n` + fields.map(f => `### ${f}\n${fence(r[f]!)}`).join('\n\n') + '\n';
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
// line, never an exception, so one bad section does not hide the rest ("unknown, never false").
|
||||
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
||||
import { extname, isAbsolute, join, resolve } from 'node:path';
|
||||
import { type ShipConfig, playCodes } from './config';
|
||||
import { appleName, type ShipConfig, playCodes } from './config';
|
||||
import { APPLE_LIMITS, len, PLAY_LIMITS } from './copy';
|
||||
import type { DraftsResult, IconResult, ListingField, ListingLocale, ListingsResult, ListingText, RenderImage, ReplyDraft } from './desktop-protocol';
|
||||
import { parseFrontMatter, stringifyFrontMatter } from './frontmatter';
|
||||
|
|
@ -136,7 +136,7 @@ export function listingCompleteness(config: ShipConfig, root: string): ListingsR
|
|||
const applePart = config.apple ? {
|
||||
code: ac,
|
||||
fields: tally([
|
||||
field('name', as?.name ?? (as ? config.app.name : undefined), APPLE_LIMITS.name, true),
|
||||
field('name', as?.name ?? (as ? appleName(config) : undefined), APPLE_LIMITS.name, true),
|
||||
field('subtitle', as?.subtitle, APPLE_LIMITS.subtitle, true),
|
||||
field('promotionalText', as?.promotionalText, APPLE_LIMITS.promotionalText, true),
|
||||
field('keywords', as?.keywords, APPLE_LIMITS.keywords, true),
|
||||
|
|
|
|||
|
|
@ -333,6 +333,7 @@ export function scanRules(inp: ScanInput): ScanFinding[] {
|
|||
const BETA = /\b(beta|demo|trial version|test (version|build|app)|testing build|early access|prototype|preview (build|version)|alpha (build|version))\b/i;
|
||||
const betaName: Hit[] = [];
|
||||
if (c?.app?.name && BETA.test(c.app.name)) betaName.push(...cfg(c.app.name, `app.name: ${c.app.name}`));
|
||||
if (c?.apple?.name && c.apple.name !== c.app?.name && BETA.test(c.apple.name)) betaName.push(...cfg(c.apple.name, `apple.name: ${c.apple.name}`));
|
||||
for (const k of ['CFBundleDisplayName', 'CFBundleName']) {
|
||||
const v = plistVal(k);
|
||||
if (typeof v?.value === 'string' && BETA.test(v.value) && !/\$\(/.test(v.value)) betaName.push({ ...v.at, text: `${k}: ${v.value}` });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue