@sprid/release 1.1.0 → 1.2.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 CHANGED
@@ -3,6 +3,13 @@
3
3
  @sprid/release follows semver: a breaking change to a command's arguments, its
4
4
  output shape or its exit codes is a major release.
5
5
 
6
+ ## 1.2.0 - 2026-10-07
7
+
8
+ - `playScreenshots.tablet {glob, dir?, slots?}` uploads a tablet set alongside the
9
+ phone set. One capture fills both of Play's tablet slots (`sevenInch`, `tenInch`)
10
+ unless `slots` narrows it, because Play shows each slot only on tablets of that
11
+ size. Every file is resolved before any slot is emptied.
12
+
6
13
  ## 1.1.0 - 2026-10-05
7
14
 
8
15
  - `build.iosSigning: 'cloud'` signs the App Store build with Apple's cloud-managed
package/README.md CHANGED
@@ -48,9 +48,16 @@ export default defineReleaseConfig({
48
48
  },
49
49
  contact: { contactEmail: "support@example.com", contactWebsite: "https://example.com", defaultLanguage: "en-US" },
50
50
  playGraphics: { icon: './store/icon-512.png', featureGraphic: './store/{lang}/feature-1024x500.png' },
51
+ playScreenshots: {
52
+ dir: './shots', glob: '{lang}/phone_*.jpg',
53
+ tablet: { glob: '{lang}/tablet_*.jpg' }, // one set fills the 7" and 10" slots; `slots: ['tenInch']` narrows it
54
+ },
51
55
  });
52
56
  ```
53
57
 
58
+ Play shows each tablet slot only on tablets of that size, so one tablet capture goes to both
59
+ slots by default. Every screenshot file is resolved before any slot is emptied.
60
+
54
61
  The Play icon is separate from the launcher icon inside the AAB. If `playGraphics.icon`
55
62
  is omitted, execution verifies existing icons (including default-language fallback) before changing graphics.
56
63
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sprid/release",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Build, sign and release mobile apps locally. Store copy, screenshots, binary uploads and review submissions from one app-owned configuration. Dry run by default.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
package/src/config.ts CHANGED
@@ -240,8 +240,17 @@ export interface PlayScreenshotsConfig {
240
240
  * `{lang}` replaced by the copy-locale key (e.g. `{lang}/aso/app_{lang}_play-phone_*.jpg`).
241
241
  */
242
242
  glob: string;
243
+ /**
244
+ * Optional tablet set. Play keeps separate 7" and 10" slots and shows each only
245
+ * on tablets of that size, so one capture is uploaded to every slot in `slots`
246
+ * (default both). `dir` defaults to the phone `dir`.
247
+ */
248
+ tablet?: { dir?: string; glob: string; slots?: PlayTabletSlot[] };
243
249
  }
244
250
 
251
+ /** Play's tablet screenshot slots (`sevenInchScreenshots`, `tenInchScreenshots`). */
252
+ export type PlayTabletSlot = 'sevenInch' | 'tenInch';
253
+
245
254
  /** App Store screenshot upload source (for the `asc-screenshots` command). */
246
255
  export interface AscScreenshotsConfig {
247
256
  /** Base dir, relative to cwd. */
@@ -1,12 +1,13 @@
1
1
  /**
2
- * Upload Play Store phone screenshots: per listing locale, delete the existing `phoneScreenshots`
3
- * then upload the ordered JPEGs matched by `playScreenshots.{dir,glob}`. Commits
4
- * with `changesNotSentForReview` (+ the draft-app retry).
2
+ * Upload Play Store screenshots: per listing locale, delete the existing `phoneScreenshots`
3
+ * then upload the ordered JPEGs matched by `playScreenshots.{dir,glob}`, and the same for
4
+ * each tablet slot when `playScreenshots.tablet` is set. Every file is resolved before
5
+ * anything is deleted. Commits with `changesNotSentForReview` (+ the draft-app retry).
5
6
  */
6
7
 
7
8
  import { createReadStream, readdirSync } from 'node:fs';
8
9
  import { basename, dirname, resolve } from 'node:path';
9
- import { listingLocaleMap, releasePath, type AppReleaseConfig } from '../config.ts';
10
+ import { listingLocaleMap, releasePath, type AppReleaseConfig, type PlayTabletSlot } from '../config.ts';
10
11
  import { createPlayClient } from './client.ts';
11
12
 
12
13
  export interface PushPlayScreenshotsOptions {
@@ -35,6 +36,9 @@ function filesFor(dir: string, glob: string, lang: string): string[] {
35
36
  .map((n) => resolve(folder, n));
36
37
  }
37
38
 
39
+ type ImageType = 'phoneScreenshots' | 'sevenInchScreenshots' | 'tenInchScreenshots';
40
+ const TABLET_TYPES: Record<PlayTabletSlot, ImageType> = { sevenInch: 'sevenInchScreenshots', tenInch: 'tenInchScreenshots' };
41
+
38
42
  export async function pushPlayScreenshots({ config, localeMap, execute = false }: PushPlayScreenshotsOptions): Promise<void> {
39
43
  const sc = config.playScreenshots;
40
44
  if (!sc) throw new Error('release.config.ts needs `playScreenshots {dir, glob}` for play-screenshots.');
@@ -42,56 +46,67 @@ export async function pushPlayScreenshots({ config, localeMap, execute = false }
42
46
 
43
47
  const map = listingLocaleMap(config, 'play', localeMap);
44
48
  const dir = releasePath(config, sc.dir);
49
+ const tablet = sc.tablet;
50
+ const tabletDir = tablet ? releasePath(config, tablet.dir ?? sc.dir) : '';
51
+ const tabletTypes = tablet ? (tablet.slots ?? ['sevenInch', 'tenInch']).map((slot) => TABLET_TYPES[slot]) : [];
52
+ // locale → image type → ordered files. Resolved up front so a missing set fails
53
+ // before any slot is emptied.
45
54
  const sources = new Map(Object.entries(map).map(([locale, lang]) => {
46
- const files = filesFor(dir, sc.glob, lang);
47
- if (!files.length) throw new Error(`No replacement screenshots for ${locale}: ${sc.glob}`);
48
- return [locale, files];
55
+ const sets: Partial<Record<ImageType, string[]>> = {};
56
+ const phone = filesFor(dir, sc.glob, lang);
57
+ if (!phone.length) throw new Error(`No replacement screenshots for ${locale}: ${sc.glob}`);
58
+ sets.phoneScreenshots = phone;
59
+ if (tablet) {
60
+ const files = filesFor(tabletDir, tablet.glob, lang);
61
+ if (!files.length) throw new Error(`No replacement tablet screenshots for ${locale}: ${tablet.glob}`);
62
+ for (const type of tabletTypes) sets[type] = files;
63
+ }
64
+ return [locale, sets];
49
65
  }));
50
66
  console.log(JSON.stringify(Object.fromEntries(sources), null, 2));
51
- if (!execute) return;
67
+ if (!execute) {
68
+ console.log('\n(dry run — pass execute:true to push)');
69
+ return;
70
+ }
52
71
  const { play, packageName } = createPlayClient(config);
53
72
 
54
- const editRes = execute ? await play.edits.insert({ packageName }) : { data: { id: 'dry-run' } };
55
- const editId = editRes.data.id!;
56
- if (execute) console.log(` Edit ID: ${editId}`);
73
+ const editId = (await play.edits.insert({ packageName })).data.id!;
74
+ console.log(` Edit ID: ${editId}`);
57
75
 
58
76
  try {
59
- for (const [locale, lang] of Object.entries(map)) {
60
- const files = sources.get(locale)!;
61
- console.log(` [${locale}] ${files.length} screenshot(s)${files.length ? '' : ' — skipping'}`);
62
- for (const f of files) console.log(` ${f.split('/').pop()}`);
63
- if (!execute || !files.length) continue;
64
-
65
- await play.edits.images
66
- .deleteall({ packageName, editId, language: locale, imageType: 'phoneScreenshots' })
67
- .catch((e: any) => {
68
- if (e.code !== 404) throw e;
69
- });
70
- for (const f of files) {
71
- await play.edits.images.upload({
72
- packageName,
73
- editId,
74
- language: locale,
75
- imageType: 'phoneScreenshots',
76
- media: { mimeType: f.toLowerCase().endsWith('.png') ? 'image/png' : 'image/jpeg', body: createReadStream(f) },
77
- });
77
+ for (const [locale, sets] of sources) {
78
+ for (const [imageType, files] of Object.entries(sets) as [ImageType, string[]][]) {
79
+ console.log(` [${locale}] ${imageType}: ${files.length} screenshot(s)`);
80
+ for (const f of files) console.log(` ${f.split('/').pop()}`);
81
+ await play.edits.images
82
+ .deleteall({ packageName, editId, language: locale, imageType })
83
+ .catch((e: any) => {
84
+ if (e.code !== 404) throw e;
85
+ });
86
+ for (const f of files) {
87
+ await play.edits.images.upload({
88
+ packageName,
89
+ editId,
90
+ language: locale,
91
+ imageType,
92
+ media: { mimeType: f.toLowerCase().endsWith('.png') ? 'image/png' : 'image/jpeg', body: createReadStream(f) },
93
+ });
94
+ }
78
95
  }
79
96
  }
80
97
 
81
- if (execute) {
82
- try {
83
- await play.edits.commit({ packageName, editId, changesNotSentForReview: true });
84
- } catch (e: any) {
85
- if (String(e?.message ?? '').includes('changesNotSentForReview')) {
86
- await play.edits.commit({ packageName, editId });
87
- } else throw e;
88
- }
89
- console.log(' ✓ committed');
98
+ try {
99
+ await play.edits.commit({ packageName, editId, changesNotSentForReview: true });
100
+ } catch (e: any) {
101
+ if (String(e?.message ?? '').includes('changesNotSentForReview')) {
102
+ await play.edits.commit({ packageName, editId });
103
+ } else throw e;
90
104
  }
105
+ console.log(' ✓ committed');
91
106
  } catch (err) {
92
- if (execute) await play.edits.delete({ packageName, editId }).catch(() => {});
107
+ await play.edits.delete({ packageName, editId }).catch(() => {});
93
108
  throw err;
94
109
  }
95
110
 
96
- console.log(`\n${execute ? '✓ Done' : '(dry run — pass execute:true to push)'}`);
111
+ console.log('\n✓ Done');
97
112
  }