config loads without Node's MODULE_TYPELESS_PACKAGE_JSON warning in a CommonJS project; capture sign-in docs use captureAuth and check notes a local capture that signs in with reviewDemoAccount (the App Review account)

This commit is contained in:
CRTkafa 2026-10-20 13:11:10 +07:00
parent 2fdd96e68c
commit 8c1a01d856
5 changed files with 38 additions and 5 deletions

View file

@ -152,6 +152,13 @@ export async function run(ctx: Ctx): Promise<void> {
try { for (const n of (await runScan(ctx.loaded.root, { config: ctx.loaded.path })).report.notes) if (n.startsWith('scan.ignore[')) note(n); } catch (e) { note(`scan.ignore not checked: ${(e as Error).message}`); }
}
if (config.apple && !config.app.copyright?.trim()) problems.push(COPYRIGHT_MISSING);
// the App Review demo account must work on the live backend: a capture sign-in against a local stack that uses it
// means local-only credentials are (or will be) stored where review-details sends them to App Review
{ const cap = (config as { shots?: { capture?: { baseUrl?: string; auth?: { request?: { url?: string } } } } }).shots?.capture;
const authText = JSON.stringify(cap?.auth ?? {});
const local = /\b(localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\]|[a-z0-9-]+\.(localhost|test|local))\b/i;
if (/cred:reviewDemoAccount/.test(authText) && (local.test(cap?.baseUrl ?? '') || local.test(cap?.auth?.request?.url ?? '')))
note('shots.capture.auth signs in to a local stack with reviewDemoAccount, the account App Review gets from apple review-details: put the local demo sign-in in captureAuth in .storebound/credentials.json and use ${cred:<name>}'); }
const duo = iphoneDuoNote({ apple: !!config.apple, duo: !!config.apple?.iphoneDuo, play: !!config.play });
if (duo?.level === 'info') { hints.push(duo.msg); log('check', `hint: ${duo.msg}`); } else if (duo) note(duo.msg);
const creative = creativeNote(config, ctx.loaded.resolve(config.renders ?? config.shots?.out ?? 'store/renders'));

View file

@ -101,7 +101,10 @@ export async function importConfigModule(path: string): Promise<any> {
async function withoutTypeStripWarning<T>(f: () => Promise<T>): Promise<T> {
const emit = process.emitWarning;
process.emitWarning = ((w: string | Error, ...rest: unknown[]) => {
if (/Type Stripping|type stripping/i.test(String(typeof w === 'string' ? w : w.message))) return;
// also Node's MODULE_TYPELESS_PACKAGE_JSON ("Reparsing as ES module") for a .ts config in a CommonJS package:
// the config is ours to load, the app need not add "type": "module"
const text = `${String(typeof w === 'string' ? w : w.message)} ${rest.map(r => (typeof r === 'object' && r ? JSON.stringify(r) : String(r))).join(' ')}`;
if (/Type Stripping|type stripping|Reparsing as ES module|MODULE_TYPELESS_PACKAGE_JSON/i.test(text)) return;
return (emit as (...a: unknown[]) => void).call(process, w, ...rest);
}) as typeof process.emitWarning;
try { return await f(); } finally { process.emitWarning = emit; }