@sprid/release 1.2.2 → 1.4.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 +24 -0
- package/README.md +86 -0
- package/package.json +1 -1
- package/src/annotate.ts +4 -1
- package/src/asc/client.ts +16 -4
- package/src/asc/creative.ts +248 -0
- package/src/asc/index.ts +8 -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/cli.ts +75 -5
- package/src/config.ts +75 -0
- package/src/copy.ts +11 -0
- package/src/play/metadata.ts +2 -1
package/src/cli.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { loadReleaseConfig, listingLocaleMap, releasePath, type AppReleaseConfig } from './config.ts';
|
|
5
5
|
import { pushAscMetadata } from './asc/metadata.ts';
|
|
6
6
|
import { pushAscScreenshots } from './asc/screenshots.ts';
|
|
7
|
+
import { pushAscCreative } from './asc/creative.ts';
|
|
7
8
|
import { pushPlayMetadata } from './play/metadata.ts';
|
|
8
9
|
import { pushPlayScreenshots } from './play/screenshots.ts';
|
|
9
10
|
import { pushPlayGraphics } from './play/graphics.ts';
|
|
@@ -14,6 +15,8 @@ import { uploadIpa } from './asc/upload.ts';
|
|
|
14
15
|
import { submitForReview } from './asc/submit.ts';
|
|
15
16
|
import { uploadAab } from './play/upload.ts';
|
|
16
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';
|
|
17
20
|
|
|
18
21
|
const has = (...names: string[]) => names.some((n) => process.argv.includes(`--${n}`));
|
|
19
22
|
const value = (name: string) => {
|
|
@@ -36,12 +39,18 @@ const COMMANDS: Record<string, { usage: string; bool: string[]; values?: string[
|
|
|
36
39
|
metadata: { usage: 'metadata [--execute] [--asc|--play]', bool: ['execute', 'asc', 'play'] },
|
|
37
40
|
screenshots: { usage: 'screenshots [--execute] [--asc|--play]', bool: ['execute', 'asc', 'play'] },
|
|
38
41
|
graphics: { usage: 'graphics [--execute]', bool: ['execute'] },
|
|
42
|
+
creative: { usage: 'creative [--execute]', bool: ['execute'] },
|
|
39
43
|
'asc-metadata': { usage: 'asc-metadata [--execute]', bool: ['execute'] },
|
|
40
44
|
'play-metadata': { usage: 'play-metadata [--execute]', bool: ['execute'] },
|
|
41
45
|
'asc-screenshots': { usage: 'asc-screenshots [--execute]', bool: ['execute'] },
|
|
46
|
+
'asc-creative': { usage: 'asc-creative [--execute]', bool: ['execute'] },
|
|
42
47
|
'play-screenshots': { usage: 'play-screenshots [--execute]', bool: ['execute'] },
|
|
43
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'] },
|
|
44
52
|
};
|
|
53
|
+
for (const name of ['pages', 'page-test', 'page-results']) COMMANDS[`asc-${name}`] = COMMANDS[name];
|
|
45
54
|
|
|
46
55
|
function printUsage(command?: string): void {
|
|
47
56
|
const spec = command ? COMMANDS[command] : undefined;
|
|
@@ -51,9 +60,10 @@ function printUsage(command?: string): void {
|
|
|
51
60
|
}
|
|
52
61
|
console.log('Usage: sprid release <command> [flags]\n');
|
|
53
62
|
console.log('Commands:');
|
|
54
|
-
for (const name of ['ship', 'bump', 'credentials-pull', 'credentials-push', 'asc-upload', 'play-upload', 'asc-submit', 'metadata', 'screenshots', 'graphics']) 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}`);
|
|
55
64
|
console.log('\nWithout --execute every command is a dry run: it prints what it would send.');
|
|
56
|
-
console.log('Per-store names also work: asc-metadata, play-metadata, asc-screenshots, play-screenshots, play-graphics.');
|
|
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.');
|
|
57
67
|
console.log('\n--config <file> accepts TS, JS, MJS or JSON. Paths resolve beside that file.');
|
|
58
68
|
console.log('--locale <locale,...> selects store locale codes. --annotate records executed changes in Sprid (opt-in).');
|
|
59
69
|
console.log('\nCredentials (never read into an agent conversation):');
|
|
@@ -112,7 +122,9 @@ async function main() {
|
|
|
112
122
|
return Object.fromEntries(selectedLocales.map(locale => [locale, map[locale]]));
|
|
113
123
|
};
|
|
114
124
|
const execute = has('execute');
|
|
115
|
-
|
|
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');
|
|
116
128
|
|
|
117
129
|
const requireValue = (name: string) => { const v = value(name); if (!v) throw new Error(`--${name} is required.`); return v; };
|
|
118
130
|
const bumpKinds = (['patch', 'minor', 'major'] as const).filter(k => has(k));
|
|
@@ -144,6 +156,12 @@ async function main() {
|
|
|
144
156
|
return;
|
|
145
157
|
}
|
|
146
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
|
+
|
|
147
165
|
const needCopy = () => {
|
|
148
166
|
if (!config.storeCopy) throw new Error('release.config.ts needs `storeCopy` for metadata commands.');
|
|
149
167
|
return config.storeCopy;
|
|
@@ -151,6 +169,7 @@ async function main() {
|
|
|
151
169
|
const asc = {
|
|
152
170
|
metadata: (send = execute) => pushAscMetadata({ config, copy: needCopy(), localeMap: localeMap('apple'), execute: send }),
|
|
153
171
|
screenshots: (send = execute) => pushAscScreenshots({ config, execute: send, localeMap: localeMap('apple') }),
|
|
172
|
+
creative: (send = execute) => pushAscCreative({ config, execute: send, localeMap: localeMap('apple') }),
|
|
154
173
|
};
|
|
155
174
|
const play = {
|
|
156
175
|
metadata: (send = execute) => pushPlayMetadata({ config, copy: needCopy(), contact: config.contact, localeMap: localeMap('play'), execute: send }),
|
|
@@ -161,7 +180,7 @@ async function main() {
|
|
|
161
180
|
// What was pushed, for the annotation after a real push.
|
|
162
181
|
const touched: string[] = [];
|
|
163
182
|
const s = stores(config);
|
|
164
|
-
const appleSelected = command.startsWith('asc-') || (['metadata', 'screenshots'].includes(command) && s.asc);
|
|
183
|
+
const appleSelected = command.startsWith('asc-') || command === 'creative' || (['metadata', 'screenshots'].includes(command) && s.asc);
|
|
165
184
|
const playSelected = command.startsWith('play-') || command === 'graphics' || (['metadata', 'screenshots'].includes(command) && s.play);
|
|
166
185
|
if (!appleSelected && !playSelected) throw new Error('Configure appId/ascAppId or play.packageName.');
|
|
167
186
|
if (appleSelected && !config.appId && !config.ascAppId) throw new Error('Set appId or ascAppId for App Store commands.');
|
|
@@ -196,6 +215,10 @@ async function main() {
|
|
|
196
215
|
case 'asc-screenshots':
|
|
197
216
|
await asc.screenshots(); touched.push('App Store screenshots');
|
|
198
217
|
break;
|
|
218
|
+
case 'creative':
|
|
219
|
+
case 'asc-creative':
|
|
220
|
+
await asc.creative(); touched.push('App Store header and search assets');
|
|
221
|
+
break;
|
|
199
222
|
case 'play-screenshots':
|
|
200
223
|
await play.screenshots(); touched.push('Play screenshots');
|
|
201
224
|
break;
|
|
@@ -204,12 +227,59 @@ async function main() {
|
|
|
204
227
|
// Annotate the push in Sprid (best effort, only when logged in), so the
|
|
205
228
|
// Monday mail shows "App Store listing changed (Thu)" next to the numbers.
|
|
206
229
|
if (execute && has('annotate') && touched.length > 0) {
|
|
207
|
-
const kind = /screenshots|graphics/.test(touched.join(' ')) ? 'screenshots' : 'listing';
|
|
230
|
+
const kind = /screenshots|graphics|assets/.test(touched.join(' ')) ? 'screenshots' : 'listing';
|
|
208
231
|
const ok = await annotate({ kind, label: `${touched.join(' + ')} changed`, app: appSlugFromRepo(releasePath(config, '.')), meta: { command } });
|
|
209
232
|
if (ok) console.log('\nAnnotated in Sprid: the Monday mail will show this change next to the numbers.');
|
|
210
233
|
}
|
|
211
234
|
}
|
|
212
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
|
+
|
|
213
283
|
main().catch((err) => {
|
|
214
284
|
console.error(err instanceof Error ? err.message : err);
|
|
215
285
|
process.exit(1);
|
package/src/config.ts
CHANGED
|
@@ -263,6 +263,75 @@ export interface AscScreenshotsConfig {
|
|
|
263
263
|
deprecatedTypes?: string[];
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
+
/** App Store creative assets (for the `asc-creative` command). Paths may contain `{lang}`. */
|
|
267
|
+
export interface AscCreativeConfig {
|
|
268
|
+
/** Product page header: 3840×1646 PNG or video (21:9), or a 5244×2950 universal PNG (16:9). */
|
|
269
|
+
header?: string;
|
|
270
|
+
/** Search results: 3:2 image or video, 1920×1280 to 3840×2560, or the universal PNG. */
|
|
271
|
+
search?: string;
|
|
272
|
+
/** App previews in display order, at most three: 886×1920 portrait or 1920×886 landscape, 15-30 s, with an audio track. */
|
|
273
|
+
previews?: string[];
|
|
274
|
+
/** Device profile the previews fill. Default `IPHONE_DYNAMIC_ISLAND_LARGE_PROFILE` (6.9", scaled for smaller iPhones). */
|
|
275
|
+
previewProfile?: string;
|
|
276
|
+
/** Poster frame of every video, `HH:MM:SS:FF`. App Store Connect defaults to 5 s. */
|
|
277
|
+
posterFrame?: string;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/** One ordered screenshot set for a page or a test treatment. The glob may contain `{lang}`. */
|
|
281
|
+
export interface AscPageScreenshots {
|
|
282
|
+
/** Base dir, relative to the config. */
|
|
283
|
+
dir: string;
|
|
284
|
+
/** Glob under `dir` whose last segment has one `*`, e.g. `{lang}/focus_*.png`. Sorted by name. */
|
|
285
|
+
glob: string;
|
|
286
|
+
/** Device profile (Asset Library placement group). Default `IPHONE_DYNAMIC_ISLAND_LARGE_PROFILE`. */
|
|
287
|
+
profile?: string;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* A custom product page (for the `pages` command): its own screenshots, promotional
|
|
292
|
+
* text, optional deep link and search keywords, reached at its own URL (`?ppid=`).
|
|
293
|
+
*/
|
|
294
|
+
export interface AscCustomProductPage {
|
|
295
|
+
/**
|
|
296
|
+
* Name in App Store Connect, unique within the app. Apple's analytics reports
|
|
297
|
+
* identify the page by this name, so renaming it splits its history.
|
|
298
|
+
*/
|
|
299
|
+
name: string;
|
|
300
|
+
/** One set per device profile, e.g. iPhone and iPad. */
|
|
301
|
+
screenshots: AscPageScreenshots | AscPageScreenshots[];
|
|
302
|
+
/** Promotional text by copy-locale key, at most 170 characters. Default: the locale's `storeCopy.promotionalText`. */
|
|
303
|
+
promotionalText?: Record<string, string>;
|
|
304
|
+
/** Where the app opens from this page (iOS 18 and later; reviewed with the page). */
|
|
305
|
+
deepLink?: string;
|
|
306
|
+
/**
|
|
307
|
+
* Search keywords by copy-locale key that lead to this page instead of the
|
|
308
|
+
* default one. Each must already be a keyword of the live App Store version.
|
|
309
|
+
*/
|
|
310
|
+
keywords?: Record<string, string[]>;
|
|
311
|
+
/** Whether the page is reachable once approved. Default true. */
|
|
312
|
+
visible?: boolean;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/** One treatment of a product page optimization test. */
|
|
316
|
+
export interface AscTestTreatment {
|
|
317
|
+
/** Name in App Store Connect and in the results. */
|
|
318
|
+
name: string;
|
|
319
|
+
/** An alternate app icon compiled into the live binary. */
|
|
320
|
+
appIconName?: string;
|
|
321
|
+
/** Screenshots shown to this treatment's share of visitors. */
|
|
322
|
+
screenshots?: AscPageScreenshots | AscPageScreenshots[];
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/** A product page optimization test (for the `page-test` command). One runs at a time. */
|
|
326
|
+
export interface AscProductPageTest {
|
|
327
|
+
/** Name in App Store Connect. A finished test cannot restart, so a new test needs a new name. */
|
|
328
|
+
name: string;
|
|
329
|
+
/** Percent of App Store visitors who see a treatment instead of the original (1-100), split evenly between treatments. */
|
|
330
|
+
trafficProportion: number;
|
|
331
|
+
/** One to three treatments. */
|
|
332
|
+
treatments: AscTestTreatment[];
|
|
333
|
+
}
|
|
334
|
+
|
|
266
335
|
/** Play feature-graphic + icon source (for the `play-graphics` command). */
|
|
267
336
|
export interface PlayGraphicsConfig {
|
|
268
337
|
/** Feature graphic PNG (1024×500); may contain `{lang}`. */
|
|
@@ -334,6 +403,12 @@ export interface AppReleaseConfig {
|
|
|
334
403
|
ascScreenshots?: AscScreenshotsConfig;
|
|
335
404
|
/** Source for `play-graphics` (feature graphic + icon upload). */
|
|
336
405
|
playGraphics?: PlayGraphicsConfig;
|
|
406
|
+
/** Source for `asc-creative` (product page header, search results asset, app previews). */
|
|
407
|
+
ascCreative?: AscCreativeConfig;
|
|
408
|
+
/** Custom product pages, for the `pages` command. */
|
|
409
|
+
ascCustomProductPages?: AscCustomProductPage[];
|
|
410
|
+
/** The product page optimization test, for the `page-test` command. */
|
|
411
|
+
ascProductPageTest?: AscProductPageTest;
|
|
337
412
|
/**
|
|
338
413
|
* Listing-locale maps for the metadata pushes (which locales the *listings*
|
|
339
414
|
* ship in — may be narrower than `locales`, which also drives release notes).
|
package/src/copy.ts
CHANGED
|
@@ -27,6 +27,12 @@ export interface StoreCopy {
|
|
|
27
27
|
supportUrl?: string;
|
|
28
28
|
/** Marketing URL (Apple). */
|
|
29
29
|
marketingUrl?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Play preview video: a public or unlisted YouTube URL with ads off and no age
|
|
32
|
+
* restriction. Shown before the screenshots, autoplays muted where Play allows,
|
|
33
|
+
* full screen when portrait. An empty string removes it. (Play only)
|
|
34
|
+
*/
|
|
35
|
+
playVideo?: string;
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
/** Contact / default-language details for a Play listing. */
|
|
@@ -46,6 +52,8 @@ export const LIMITS = {
|
|
|
46
52
|
description: 4000,
|
|
47
53
|
} as const;
|
|
48
54
|
|
|
55
|
+
const YOUTUBE_VIDEO = /^https:\/\/(www\.youtube\.com\/watch\?v=|youtu\.be\/)[\w-]{11}([?&#].*)?$/;
|
|
56
|
+
|
|
49
57
|
/**
|
|
50
58
|
* Fail loudly on anything a store would reject: over-limit fields, keyword
|
|
51
59
|
* or empty required strings. Only selected store fields are validated when a store is provided.
|
|
@@ -74,6 +82,9 @@ export function validateStoreCopy(copy: Record<string, StoreCopy>, store?: 'appl
|
|
|
74
82
|
errors.push(`[${locale}] ${field} is ${value.length}/${LIMITS[field]} chars (over by ${value.length - LIMITS[field]})`);
|
|
75
83
|
}
|
|
76
84
|
}
|
|
85
|
+
if (store !== 'apple' && c.playVideo && !YOUTUBE_VIDEO.test(c.playVideo)) {
|
|
86
|
+
errors.push(`[${locale}] playVideo must be a YouTube video URL (youtube.com/watch?v=… or youtu.be/…)`);
|
|
87
|
+
}
|
|
77
88
|
|
|
78
89
|
}
|
|
79
90
|
if (errors.length) {
|
package/src/play/metadata.ts
CHANGED
|
@@ -14,7 +14,8 @@ export interface PushPlayMetadataOptions {
|
|
|
14
14
|
export async function pushPlayMetadata({ config, copy, contact, localeMap, execute = false }: PushPlayMetadataOptions): Promise<void> {
|
|
15
15
|
const listings = selectedCopy(copy, listingLocaleMap(config, 'play', localeMap), 'play');
|
|
16
16
|
const plan = listings.map(([language, c]) => ({ language, title: c.name,
|
|
17
|
-
shortDescription: c.shortDescription, fullDescription: c.description
|
|
17
|
+
shortDescription: c.shortDescription, fullDescription: c.description,
|
|
18
|
+
...(c.playVideo === undefined ? {} : { video: c.playVideo }) }));
|
|
18
19
|
console.log(JSON.stringify({ store: 'play', packageName: config.play?.packageName, listings: plan, contact }, null, 2));
|
|
19
20
|
if (!execute) return;
|
|
20
21
|
const client = createPlayClient(config);
|