@sprid/release 1.5.0 → 1.5.2
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 +12 -0
- package/package.json +3 -3
- package/src/asc/client.ts +4 -1
- package/src/asc/creative.ts +39 -2
- package/src/asc/product-pages.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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.5.2 - 2026-11-02
|
|
7
|
+
|
|
8
|
+
- Custom product page pushes reuse images already in the app's Asset Library
|
|
9
|
+
instead of uploading byte-identical copies again, so a rerun after a failure
|
|
10
|
+
no longer adds another set. App Store Connect writes wait up to 180 s, reads
|
|
11
|
+
30 s. `SPRID_ASC_TRACE=1` logs each request with its duration.
|
|
12
|
+
|
|
13
|
+
## 1.5.1 - 2026-11-01
|
|
14
|
+
|
|
15
|
+
- Updated dependencies: googleapis 189 and jose 6. Commands and output are
|
|
16
|
+
unchanged.
|
|
17
|
+
|
|
6
18
|
## 1.5.0 - 2026-10-31
|
|
7
19
|
|
|
8
20
|
- `asc-submit` applies `ageRating` from the release config to the editable app
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sprid/release",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
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",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"bun": ">=1.1"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"googleapis": "^
|
|
60
|
-
"jose": "^
|
|
59
|
+
"googleapis": "^189.0.0",
|
|
60
|
+
"jose": "^6.2.14"
|
|
61
61
|
},
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|
package/src/asc/client.ts
CHANGED
|
@@ -61,12 +61,15 @@ export function createAscClient(config: AppReleaseConfig): AscClient {
|
|
|
61
61
|
// resource creation or review submission automatically after an ambiguous 5xx.
|
|
62
62
|
const repeatable = method === 'GET' || (method === 'PATCH' && /^\/(appScreenshots|appAssetLibraryImages|appAssetLibraryVideos)\/[^/]+$/.test(path));
|
|
63
63
|
for (let attempt = 0; ; attempt++) {
|
|
64
|
+
// Asset Library writes (reserve, commit, place, reorder) can take well over 30 s at Apple.
|
|
65
|
+
const started = Date.now();
|
|
64
66
|
const res = await fetch(ascUrl(path), {
|
|
65
67
|
...init,
|
|
66
68
|
redirect: 'error',
|
|
67
|
-
signal: init.signal ?? AbortSignal.timeout(30000),
|
|
69
|
+
signal: init.signal ?? AbortSignal.timeout(method === 'GET' ? 30000 : 180000),
|
|
68
70
|
headers: { Authorization: `Bearer ${await getToken()}`, 'Content-Type': 'application/json', ...(init.headers || {}) },
|
|
69
71
|
});
|
|
72
|
+
if (process.env.SPRID_ASC_TRACE) console.log(` ASC ${method} ${path} → ${res.status} in ${Date.now() - started} ms`);
|
|
70
73
|
if (res.ok) return res.status === 204 ? null : res.json();
|
|
71
74
|
const body = await res.text();
|
|
72
75
|
if (repeatable && attempt < 3 && [429, 500, 502, 503, 504].includes(res.status)) {
|
package/src/asc/creative.ts
CHANGED
|
@@ -143,11 +143,48 @@ function check(items: Planned[]): void {
|
|
|
143
143
|
|
|
144
144
|
const SETTLED = new Set(['COMPLETE', 'PREPARE_FOR_SUBMISSION', 'READY_FOR_REVIEW', 'WAITING_FOR_REVIEW', 'IN_REVIEW', 'ACCEPTED', 'APPROVED']);
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
const libraryImages = new Map<string, Promise<any[]>>();
|
|
147
|
+
|
|
148
|
+
/** Every image already in the library, read once per run. */
|
|
149
|
+
function listLibraryImages(client: AscClient, libraryId: string): Promise<any[]> {
|
|
150
|
+
let list = libraryImages.get(libraryId);
|
|
151
|
+
if (!list) {
|
|
152
|
+
list = (async () => {
|
|
153
|
+
const out: any[] = [];
|
|
154
|
+
for (let next: string | undefined = `/appAssetLibraries/${libraryId}/images?limit=200`, pages = 0; next && pages < 50; pages++) {
|
|
155
|
+
const res = await client.api(next);
|
|
156
|
+
out.push(...(res?.data ?? []));
|
|
157
|
+
next = res?.links?.next;
|
|
158
|
+
}
|
|
159
|
+
return out;
|
|
160
|
+
})();
|
|
161
|
+
libraryImages.set(libraryId, list);
|
|
162
|
+
}
|
|
163
|
+
return list;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** A processed library image with the same byte size and pixel dimensions, preferring the same file name.
|
|
167
|
+
* The library has no checksum; size plus dimensions identifies a byte-identical copy of a store shot. */
|
|
168
|
+
export function matchLibraryImage(images: any[], file: string, bytes: Buffer): { type: string; id: string } | undefined {
|
|
169
|
+
let info: MediaInfo;
|
|
170
|
+
try { info = imageInfo(bytes); } catch { return undefined; }
|
|
171
|
+
const same = images.filter(i => SETTLED.has(i.attributes?.state) && i.attributes?.fileSize === bytes.length
|
|
172
|
+
&& i.attributes?.imageAsset?.width === info.width && i.attributes?.imageAsset?.height === info.height);
|
|
173
|
+
const hit = same.find(i => i.attributes.fileName === basename(file)) ?? same[0];
|
|
174
|
+
return hit ? { type: 'appAssetLibraryImages', id: hit.id } : undefined;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** Upload one file into the app's Asset Library and wait until App Store Connect has processed it.
|
|
178
|
+
* An image already in the library (same size and dimensions) is reused instead of uploaded again, so a
|
|
179
|
+
* rerun after a timeout, or a page built from the listing's own shots, adds nothing to the library. */
|
|
147
180
|
export async function uploadLibraryAsset(client: AscClient, libraryId: string, file: string,
|
|
148
181
|
opts: { category: 'CREATIVE_ASSETS' | 'APP_SCREENSHOTS_AND_PREVIEWS'; posterFrame?: string; timeoutMs?: number }): Promise<{ type: string; id: string }> {
|
|
149
182
|
const bytes = readFileSync(file);
|
|
150
183
|
const type = VIDEO_EXT.has(extname(file).toLowerCase()) ? 'appAssetLibraryVideos' : 'appAssetLibraryImages';
|
|
184
|
+
if (type === 'appAssetLibraryImages') {
|
|
185
|
+
const existing = matchLibraryImage(await listLibraryImages(client, libraryId), file, bytes);
|
|
186
|
+
if (existing) { console.log(` reused ${basename(file)} (already in the Asset Library)`); return existing; }
|
|
187
|
+
}
|
|
151
188
|
const attributes: Record<string, unknown> = { category: opts.category, fileName: basename(file), fileSize: bytes.length };
|
|
152
189
|
if (type === 'appAssetLibraryVideos' && opts.posterFrame) attributes.previewFrameTimeCode = opts.posterFrame;
|
|
153
190
|
const reserved = await client.api(`/${type}`, { method: 'POST', body: JSON.stringify({ data: { type, attributes,
|
|
@@ -204,7 +241,7 @@ export async function pushAscCreative({ config, localeMap, execute = false }: Pu
|
|
|
204
241
|
if (uploaded.has(item.file)) continue;
|
|
205
242
|
const category = item.slot === 'preview' ? 'APP_SCREENSHOTS_AND_PREVIEWS' : 'CREATIVE_ASSETS';
|
|
206
243
|
uploaded.set(item.file, await uploadLibraryAsset(client, library.id, item.file, { category, posterFrame: config.ascCreative?.posterFrame }));
|
|
207
|
-
console.log(`
|
|
244
|
+
console.log(` ready ${basename(item.file)}`);
|
|
208
245
|
}
|
|
209
246
|
|
|
210
247
|
for (const locale of new Set(items.map(i => i.locale))) {
|
package/src/asc/product-pages.ts
CHANGED
|
@@ -177,7 +177,7 @@ async function uploadAll(client: AscClient, appId: string, files: string[]): Pro
|
|
|
177
177
|
const { data: library } = await client.api(`/apps/${appId}/assetLibrary`);
|
|
178
178
|
for (const file of new Set(files)) {
|
|
179
179
|
uploaded.set(file, await uploadLibraryAsset(client, library.id, file, { category: 'APP_SCREENSHOTS_AND_PREVIEWS' }));
|
|
180
|
-
console.log(`
|
|
180
|
+
console.log(` ready ${basename(file)}`);
|
|
181
181
|
}
|
|
182
182
|
return uploaded;
|
|
183
183
|
}
|