apple: no app info on App Store Connect is a clear error (it crashed apple listing / appinfo with "undefined is not an object (evaluating 'info.id')"); asset uploads use basename (a Windows path sent the whole C:\... path as fileName), reviews send --only and previews names split both separators; tests/matrix-bugs.test.ts

This commit is contained in:
CRTkafa 2026-10-14 08:29:26 +08:00
parent f58e192001
commit 2c14e5318a
5 changed files with 60 additions and 11 deletions

View file

@ -22,7 +22,8 @@ import { appleName } from '../lib/config';
import type { Ctx } from '../lib/ctx';
import { confirm, need } from '../lib/ctx';
import { done, log, printJson, warn } from '../lib/log';
import { ascClient, EDITABLE, type J } from './asc';
import { ascClient, EDITABLE, type J, noAppInfo } from './asc';
import { stdinIsTTY } from '../lib/tty';
export function readAppleCopy(ctx: Ctx) {
const { config, resolve } = ctx.loaded;
@ -48,6 +49,7 @@ async function pull(ctx: Ctx): Promise<void> {
const info = ['READY_FOR_DISTRIBUTION', 'READY_FOR_SALE'].includes(live)
? infos.find((i: J) => ['READY_FOR_DISTRIBUTION', 'READY_FOR_SALE'].includes(i.attributes.state ?? i.attributes.appStoreState)) ?? infos[0]
: await c.editableAppInfo();
if (!info) throw new Error(noAppInfo(appId));
const remote: Record<string, AppleCopy> = {};
for (const l of await c.all(`/v1/appInfos/${info.id}/appInfoLocalizations?limit=200`)) remote[l.attributes.locale] = { name: l.attributes.name ?? undefined, subtitle: l.attributes.subtitle ?? undefined };
for (const l of await c.all(`/v1/appStoreVersions/${v.id}/appStoreVersionLocalizations?limit=200`)) {
@ -191,7 +193,7 @@ export async function run(ctx: Ctx): Promise<void> {
if (refused.length) { if (dry) { process.exitCode = 1; warn('apple', `dry run: would refuse: ${refused.join('; ')}`); return; } throw new Error(refused.join('; ')); }
if (dry) { done('apple', `dry run: ${p.changes ? `${p.changes} change(s)` : 'nothing to change'}; read-only, nothing written`); return; }
if (!p.changes) { done('apple', 'listing already up to date'); return; }
if (process.stdin.isTTY && !(await confirm(ctx, `Apply these ${p.changes} change(s) to App Store Connect?`))) { warn('apple', 'nothing written'); return; }
if (stdinIsTTY() && !(await confirm(ctx, `Apply these ${p.changes} change(s) to App Store Connect?`))) { warn('apple', 'nothing written'); return; }
const vp = p.versionPlan;
let versionId = vp.id;