@sprid/release 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +67 -0
- package/package.json +1 -1
- package/src/annotate.ts +4 -1
- package/src/asc/age-rating.ts +86 -0
- package/src/asc/client.ts +14 -2
- package/src/asc/index.ts +6 -0
- package/src/asc/page-results.ts +218 -0
- package/src/asc/product-pages.ts +513 -0
- package/src/asc/submissions.ts +64 -0
- package/src/asc/submit.ts +6 -1
- package/src/cli.ts +65 -3
- package/src/config.ts +71 -0
package/src/cli.ts
CHANGED
|
@@ -15,6 +15,8 @@ import { uploadIpa } from './asc/upload.ts';
|
|
|
15
15
|
import { submitForReview } from './asc/submit.ts';
|
|
16
16
|
import { uploadAab } from './play/upload.ts';
|
|
17
17
|
import { annotate, appSlugFromRepo } from './annotate.ts';
|
|
18
|
+
import { pushCustomProductPages, pushProductPageTest, readProductPageTest } from './asc/product-pages.ts';
|
|
19
|
+
import { printPageResults, readPageResults, resultsLabel } from './asc/page-results.ts';
|
|
18
20
|
|
|
19
21
|
const has = (...names: string[]) => names.some((n) => process.argv.includes(`--${n}`));
|
|
20
22
|
const value = (name: string) => {
|
|
@@ -44,7 +46,11 @@ const COMMANDS: Record<string, { usage: string; bool: string[]; values?: string[
|
|
|
44
46
|
'asc-creative': { usage: 'asc-creative [--execute]', bool: ['execute'] },
|
|
45
47
|
'play-screenshots': { usage: 'play-screenshots [--execute]', bool: ['execute'] },
|
|
46
48
|
'play-graphics': { usage: 'play-graphics [--execute]', bool: ['execute'] },
|
|
49
|
+
pages: { usage: 'pages [--execute] [--submit]', bool: ['execute', 'submit'] },
|
|
50
|
+
'page-test': { usage: 'page-test [--execute] [--start|--stop] | page-test --result <text> --annotate', bool: ['execute', 'start', 'stop'], values: ['result'] },
|
|
51
|
+
'page-results': { usage: 'page-results [--days <n>] [--request-reports --execute]', bool: ['execute', 'request-reports'], values: ['days'] },
|
|
47
52
|
};
|
|
53
|
+
for (const name of ['pages', 'page-test', 'page-results']) COMMANDS[`asc-${name}`] = COMMANDS[name];
|
|
48
54
|
|
|
49
55
|
function printUsage(command?: string): void {
|
|
50
56
|
const spec = command ? COMMANDS[command] : undefined;
|
|
@@ -54,9 +60,10 @@ function printUsage(command?: string): void {
|
|
|
54
60
|
}
|
|
55
61
|
console.log('Usage: sprid release <command> [flags]\n');
|
|
56
62
|
console.log('Commands:');
|
|
57
|
-
for (const name of ['ship', 'bump', 'credentials-pull', 'credentials-push', 'asc-upload', 'play-upload', 'asc-submit', 'metadata', 'screenshots', 'graphics', 'creative']) console.log(` ${COMMANDS[name].usage}`);
|
|
63
|
+
for (const name of ['ship', 'bump', 'credentials-pull', 'credentials-push', 'asc-upload', 'play-upload', 'asc-submit', 'metadata', 'screenshots', 'graphics', 'creative', 'pages', 'page-test', 'page-results']) console.log(` ${COMMANDS[name].usage}`);
|
|
58
64
|
console.log('\nWithout --execute every command is a dry run: it prints what it would send.');
|
|
59
|
-
console.log('Per-store names also work: asc-metadata, play-metadata, asc-screenshots, play-screenshots, play-graphics, asc-creative.');
|
|
65
|
+
console.log('Per-store names also work: asc-metadata, play-metadata, asc-screenshots, play-screenshots, play-graphics, asc-creative, asc-pages, asc-page-test, asc-page-results.');
|
|
66
|
+
console.log('page-results only reads; it needs no --execute except to create the report request.');
|
|
60
67
|
console.log('\n--config <file> accepts TS, JS, MJS or JSON. Paths resolve beside that file.');
|
|
61
68
|
console.log('--locale <locale,...> selects store locale codes. --annotate records executed changes in Sprid (opt-in).');
|
|
62
69
|
console.log('\nCredentials (never read into an agent conversation):');
|
|
@@ -115,7 +122,9 @@ async function main() {
|
|
|
115
122
|
return Object.fromEntries(selectedLocales.map(locale => [locale, map[locale]]));
|
|
116
123
|
};
|
|
117
124
|
const execute = has('execute');
|
|
118
|
-
|
|
125
|
+
const pageCommand = command.replace(/^asc-/, '');
|
|
126
|
+
const readOnly = pageCommand === 'page-results' || (pageCommand === 'page-test' && value('result') !== undefined);
|
|
127
|
+
if (!execute && !readOnly) console.log('Dry run. Nothing is sent without --execute.\n');
|
|
119
128
|
|
|
120
129
|
const requireValue = (name: string) => { const v = value(name); if (!v) throw new Error(`--${name} is required.`); return v; };
|
|
121
130
|
const bumpKinds = (['patch', 'minor', 'major'] as const).filter(k => has(k));
|
|
@@ -147,6 +156,12 @@ async function main() {
|
|
|
147
156
|
return;
|
|
148
157
|
}
|
|
149
158
|
|
|
159
|
+
if (['pages', 'page-test', 'page-results'].includes(pageCommand)) {
|
|
160
|
+
if (!config.appId && !config.ascAppId) throw new Error('Set appId or ascAppId for App Store commands.');
|
|
161
|
+
await pageCommands(config, pageCommand, command, execute, () => localeMap('apple'));
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
|
|
150
165
|
const needCopy = () => {
|
|
151
166
|
if (!config.storeCopy) throw new Error('release.config.ts needs `storeCopy` for metadata commands.');
|
|
152
167
|
return config.storeCopy;
|
|
@@ -218,6 +233,53 @@ async function main() {
|
|
|
218
233
|
}
|
|
219
234
|
}
|
|
220
235
|
|
|
236
|
+
const fit = (label: string) => (label.length > 200 ? `${label.slice(0, 199)}…` : label);
|
|
237
|
+
const annotated = (ok: boolean) => console.log(ok ? '\nRecorded in Sprid.' : '\nNot recorded in Sprid: sign in with `sprid login` or set SPRID_PAT.');
|
|
238
|
+
|
|
239
|
+
/** Custom product pages, the product page test and their results. */
|
|
240
|
+
async function pageCommands(config: AppReleaseConfig, name: string, command: string, execute: boolean, locales: () => Record<string, string>): Promise<void> {
|
|
241
|
+
const app = appSlugFromRepo(releasePath(config, '.'));
|
|
242
|
+
if (name === 'pages') {
|
|
243
|
+
const submit = has('submit');
|
|
244
|
+
if (submit && !execute) console.log('--submit sends the pages to App Review together with --execute.');
|
|
245
|
+
const pushed = await pushCustomProductPages({ config, localeMap: locales(), execute, submit });
|
|
246
|
+
if (execute && has('annotate') && pushed.length) {
|
|
247
|
+
annotated(await annotate({ kind: 'screenshots', app, areas: ['store'], meta: { command, customProductPages: pushed },
|
|
248
|
+
label: fit(`Custom product pages ${submit ? 'sent to review' : 'updated'}: ${pushed.map(p => p.name).join(', ')}`) }));
|
|
249
|
+
}
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
if (name === 'page-test') {
|
|
253
|
+
const result = value('result');
|
|
254
|
+
if (result !== undefined) {
|
|
255
|
+
if (!has('annotate')) throw new Error('--result records what Apple shows for the test in Sprid; add --annotate.');
|
|
256
|
+
if (execute || has('start') || has('stop')) throw new Error('--result only records a reading; run it without --execute, --start or --stop.');
|
|
257
|
+
const status = await readProductPageTest(config);
|
|
258
|
+
if (!status) throw new Error(`App Store Connect has no product page test named "${config.ascProductPageTest?.name}".`);
|
|
259
|
+
annotated(await annotate({ kind: 'note', app, areas: ['store'], meta: { command, result, productPageTest: status },
|
|
260
|
+
label: fit(`Product page test "${status.name}": ${result}`) }));
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
const start = has('start'), stop = has('stop');
|
|
264
|
+
const status = await pushProductPageTest({ config, localeMap: stop ? undefined : locales(), execute, start, stop });
|
|
265
|
+
if (execute && has('annotate') && status && (start || stop)) {
|
|
266
|
+
const label = stop ? `Product page test "${status.name}" stopped`
|
|
267
|
+
: `Product page test "${status.name}" started: ${status.treatments.length} treatment${status.treatments.length === 1 ? '' : 's'}, ${status.trafficProportion}% of visitors`;
|
|
268
|
+
annotated(await annotate({ kind: stop ? 'note' : 'screenshots', app, areas: ['store'], meta: { command, productPageTest: status }, label: fit(label) }));
|
|
269
|
+
}
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
const days = value('days') === undefined ? 28 : Number(value('days'));
|
|
273
|
+
const results = await readPageResults({ config, days, requestReports: has('request-reports'), execute });
|
|
274
|
+
printPageResults(results);
|
|
275
|
+
if (has('annotate') && results.status === 'ok') {
|
|
276
|
+
const urls = new Map(results.pages.map(p => [p.name, p]));
|
|
277
|
+
const pages = results.rows.filter(r => urls.has(r.title) || /default/i.test(r.title)).map(r => ({ ...r, id: urls.get(r.title)?.id, url: urls.get(r.title)?.url }));
|
|
278
|
+
annotated(await annotate({ kind: 'note', app, areas: ['store'], label: resultsLabel(results),
|
|
279
|
+
meta: { command, window: results.window, coverage: results.coverage, pages, productPageTest: results.test } }));
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
221
283
|
main().catch((err) => {
|
|
222
284
|
console.error(err instanceof Error ? err.message : err);
|
|
223
285
|
process.exit(1);
|
package/src/config.ts
CHANGED
|
@@ -101,6 +101,13 @@ export interface ReviewContact {
|
|
|
101
101
|
notes?: string;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
/**
|
|
105
|
+
* App Store age rating answers (`ageRatingDeclarations` attributes), e.g.
|
|
106
|
+
* `{ socialMedia: false }`. Only the keys given are written; the rest keep
|
|
107
|
+
* what App Store Connect holds.
|
|
108
|
+
*/
|
|
109
|
+
export type AgeRatingAnswers = Record<string, string | boolean | null>;
|
|
110
|
+
|
|
104
111
|
/** Everything the local build + sign mechanics need to drive `ship`. */
|
|
105
112
|
export interface BuildConfig {
|
|
106
113
|
/** Explicitly enable Expo native generation. Native projects skip prebuild. */
|
|
@@ -277,6 +284,61 @@ export interface AscCreativeConfig {
|
|
|
277
284
|
posterFrame?: string;
|
|
278
285
|
}
|
|
279
286
|
|
|
287
|
+
/** One ordered screenshot set for a page or a test treatment. The glob may contain `{lang}`. */
|
|
288
|
+
export interface AscPageScreenshots {
|
|
289
|
+
/** Base dir, relative to the config. */
|
|
290
|
+
dir: string;
|
|
291
|
+
/** Glob under `dir` whose last segment has one `*`, e.g. `{lang}/focus_*.png`. Sorted by name. */
|
|
292
|
+
glob: string;
|
|
293
|
+
/** Device profile (Asset Library placement group). Default `IPHONE_DYNAMIC_ISLAND_LARGE_PROFILE`. */
|
|
294
|
+
profile?: string;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* A custom product page (for the `pages` command): its own screenshots, promotional
|
|
299
|
+
* text, optional deep link and search keywords, reached at its own URL (`?ppid=`).
|
|
300
|
+
*/
|
|
301
|
+
export interface AscCustomProductPage {
|
|
302
|
+
/**
|
|
303
|
+
* Name in App Store Connect, unique within the app. Apple's analytics reports
|
|
304
|
+
* identify the page by this name, so renaming it splits its history.
|
|
305
|
+
*/
|
|
306
|
+
name: string;
|
|
307
|
+
/** One set per device profile, e.g. iPhone and iPad. */
|
|
308
|
+
screenshots: AscPageScreenshots | AscPageScreenshots[];
|
|
309
|
+
/** Promotional text by copy-locale key, at most 170 characters. Default: the locale's `storeCopy.promotionalText`. */
|
|
310
|
+
promotionalText?: Record<string, string>;
|
|
311
|
+
/** Where the app opens from this page (iOS 18 and later; reviewed with the page). */
|
|
312
|
+
deepLink?: string;
|
|
313
|
+
/**
|
|
314
|
+
* Search keywords by copy-locale key that lead to this page instead of the
|
|
315
|
+
* default one. Each must already be a keyword of the live App Store version.
|
|
316
|
+
*/
|
|
317
|
+
keywords?: Record<string, string[]>;
|
|
318
|
+
/** Whether the page is reachable once approved. Default true. */
|
|
319
|
+
visible?: boolean;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/** One treatment of a product page optimization test. */
|
|
323
|
+
export interface AscTestTreatment {
|
|
324
|
+
/** Name in App Store Connect and in the results. */
|
|
325
|
+
name: string;
|
|
326
|
+
/** An alternate app icon compiled into the live binary. */
|
|
327
|
+
appIconName?: string;
|
|
328
|
+
/** Screenshots shown to this treatment's share of visitors. */
|
|
329
|
+
screenshots?: AscPageScreenshots | AscPageScreenshots[];
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/** A product page optimization test (for the `page-test` command). One runs at a time. */
|
|
333
|
+
export interface AscProductPageTest {
|
|
334
|
+
/** Name in App Store Connect. A finished test cannot restart, so a new test needs a new name. */
|
|
335
|
+
name: string;
|
|
336
|
+
/** Percent of App Store visitors who see a treatment instead of the original (1-100), split evenly between treatments. */
|
|
337
|
+
trafficProportion: number;
|
|
338
|
+
/** One to three treatments. */
|
|
339
|
+
treatments: AscTestTreatment[];
|
|
340
|
+
}
|
|
341
|
+
|
|
280
342
|
/** Play feature-graphic + icon source (for the `play-graphics` command). */
|
|
281
343
|
export interface PlayGraphicsConfig {
|
|
282
344
|
/** Feature graphic PNG (1024×500); may contain `{lang}`. */
|
|
@@ -300,6 +362,11 @@ export interface AppReleaseConfig {
|
|
|
300
362
|
* version is nothing, and the submission 409s.
|
|
301
363
|
*/
|
|
302
364
|
reviewContact?: ReviewContact;
|
|
365
|
+
/**
|
|
366
|
+
* Age rating answers written before each review submission. Apple adds
|
|
367
|
+
* required questions without notice, and a null one makes the submission 409.
|
|
368
|
+
*/
|
|
369
|
+
ageRating?: AgeRatingAnswers;
|
|
303
370
|
/** iOS bundle id. Independent of the Android package name. */
|
|
304
371
|
appId?: string;
|
|
305
372
|
/** App Store app id (numeric). May be used instead of the bundle id. */
|
|
@@ -350,6 +417,10 @@ export interface AppReleaseConfig {
|
|
|
350
417
|
playGraphics?: PlayGraphicsConfig;
|
|
351
418
|
/** Source for `asc-creative` (product page header, search results asset, app previews). */
|
|
352
419
|
ascCreative?: AscCreativeConfig;
|
|
420
|
+
/** Custom product pages, for the `pages` command. */
|
|
421
|
+
ascCustomProductPages?: AscCustomProductPage[];
|
|
422
|
+
/** The product page optimization test, for the `page-test` command. */
|
|
423
|
+
ascProductPageTest?: AscProductPageTest;
|
|
353
424
|
/**
|
|
354
425
|
* Listing-locale maps for the metadata pushes (which locales the *listings*
|
|
355
426
|
* ship in — may be narrower than `locales`, which also drives release notes).
|