@sprid/release 1.4.0 → 1.5.1
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/README.md +6 -0
- package/package.json +3 -3
- package/src/asc/age-rating.ts +86 -0
- package/src/asc/submit.ts +6 -1
- package/src/config.ts +12 -0
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.1 - 2026-11-01
|
|
7
|
+
|
|
8
|
+
- Updated dependencies: googleapis 189 and jose 6. Commands and output are
|
|
9
|
+
unchanged.
|
|
10
|
+
|
|
11
|
+
## 1.5.0 - 2026-10-31
|
|
12
|
+
|
|
13
|
+
- `asc-submit` applies `ageRating` from the release config to the editable app
|
|
14
|
+
info's age rating declaration before submitting, and names questions still
|
|
15
|
+
unanswered. Apple's 409 for a missing answer (`socialMedia`, added October
|
|
16
|
+
2026) now reads as the config key to set.
|
|
17
|
+
|
|
6
18
|
## 1.4.0 - 2026-10-30
|
|
7
19
|
|
|
8
20
|
- `pages` (`asc-pages`) creates and updates App Store custom product pages from
|
package/README.md
CHANGED
|
@@ -230,6 +230,12 @@ beside that file (`credentialsPathBase` overrides). `build.envFile: { path, keys
|
|
|
230
230
|
allowlist without printing values. `requiredProdEnv` rejects missing values and
|
|
231
231
|
local URLs. Gradle memory settings change only with `build.gradleJvmArgs`.
|
|
232
232
|
|
|
233
|
+
`asc-submit` writes `reviewContact` onto the version and `ageRating` onto the
|
|
234
|
+
editable app info before it submits, e.g. `ageRating: { socialMedia: false }`
|
|
235
|
+
with keys from Apple's `ageRatingDeclarations`. Apple adds required age rating
|
|
236
|
+
questions between releases; the submit names any still unanswered, and Apple's
|
|
237
|
+
409 for one comes back as the config key to set.
|
|
238
|
+
|
|
233
239
|
For another toolchain, `build.commands.ios` or `.android` replaces that platform's
|
|
234
240
|
native build and signing steps with `{ command: ['tool', 'arg'], artifact: 'path' }`.
|
|
235
241
|
Commands run in `appDir`; artifact paths resolve beside the release config. The
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sprid/release",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
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"
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/** App Store age rating answers, written onto the editable app info before review. */
|
|
2
|
+
import type { AgeRatingAnswers } from '../config.ts';
|
|
3
|
+
import type { AscClient } from './client.ts';
|
|
4
|
+
|
|
5
|
+
/** App info states whose age rating declaration still accepts edits. */
|
|
6
|
+
const EDITABLE_APP_INFO_STATES = new Set([
|
|
7
|
+
'PREPARE_FOR_SUBMISSION',
|
|
8
|
+
'DEVELOPER_REJECTED',
|
|
9
|
+
'REJECTED',
|
|
10
|
+
'METADATA_REJECTED',
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Attributes Apple leaves null on a complete declaration: kids-category band,
|
|
15
|
+
* Korean classification, an optional info URL, and the overrides. Any other
|
|
16
|
+
* null is a question nobody answered, usually one Apple added since the last
|
|
17
|
+
* release (`socialMedia`, October 2026).
|
|
18
|
+
*/
|
|
19
|
+
const OPTIONAL_ATTRIBUTES = new Set([
|
|
20
|
+
'kidsAgeBand',
|
|
21
|
+
'gracRatingClassificationNumber',
|
|
22
|
+
'developerAgeRatingInfoUrl',
|
|
23
|
+
'ageRatingOverride',
|
|
24
|
+
'ageRatingOverrideV2',
|
|
25
|
+
'koreaAgeRatingOverride',
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
/** Questions Apple asks only after another answer, keyed by that answer. */
|
|
29
|
+
const FOLLOW_UPS: Record<string, string> = { socialMediaAgeRestricted: 'socialMedia' };
|
|
30
|
+
|
|
31
|
+
export function unansweredAgeRatingQuestions(attributes: Record<string, unknown>): string[] {
|
|
32
|
+
return Object.entries(attributes)
|
|
33
|
+
.filter(([key, value]) => value === null && !OPTIONAL_ATTRIBUTES.has(key))
|
|
34
|
+
.filter(([key]) => !FOLLOW_UPS[key] || attributes[FOLLOW_UPS[key]] === true)
|
|
35
|
+
.map(([key]) => key);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Applies `ageRating` from the release config to the editable app info's
|
|
40
|
+
* declaration, then names every question still unanswered. Apple adds
|
|
41
|
+
* required questions without notice and `POST /reviewSubmissionItems` 409s on
|
|
42
|
+
* the first null one, after the build, metadata and screenshots are already up.
|
|
43
|
+
*/
|
|
44
|
+
export async function ensureAgeRating(client: AscClient, appId: string, answers: AgeRatingAnswers | undefined): Promise<void> {
|
|
45
|
+
console.log(`\n→ Age rating`);
|
|
46
|
+
const infos = await client.api(`/apps/${appId}/appInfos?limit=10`);
|
|
47
|
+
const info = (infos.data ?? []).find((i: any) => EDITABLE_APP_INFO_STATES.has(i.attributes?.state ?? i.attributes?.appStoreState));
|
|
48
|
+
if (!info) {
|
|
49
|
+
console.log(' · no editable app info; the live declaration carries forward');
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const declaration = (await client.api(`/appInfos/${info.id}/ageRatingDeclaration`)).data;
|
|
53
|
+
let attributes: Record<string, unknown> = declaration.attributes ?? {};
|
|
54
|
+
|
|
55
|
+
const changes = Object.fromEntries(Object.entries(answers ?? {}).filter(([key, value]) => attributes[key] !== value));
|
|
56
|
+
if (Object.keys(changes).length) {
|
|
57
|
+
const patched = await client.api(`/ageRatingDeclarations/${declaration.id}`, {
|
|
58
|
+
method: 'PATCH',
|
|
59
|
+
body: JSON.stringify({ data: { type: 'ageRatingDeclarations', id: declaration.id, attributes: changes } }),
|
|
60
|
+
});
|
|
61
|
+
attributes = patched?.data?.attributes ?? { ...attributes, ...changes };
|
|
62
|
+
console.log(` ✓ set ${Object.entries(changes).map(([key, value]) => `${key}=${JSON.stringify(value)}`).join(', ')}`);
|
|
63
|
+
} else {
|
|
64
|
+
console.log(' ✓ matches release config');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const unanswered = unansweredAgeRatingQuestions(attributes);
|
|
68
|
+
if (unanswered.length) {
|
|
69
|
+
console.log(` ⚠ unanswered: ${unanswered.join(', ')}. Add them to ageRating in the release config, or review will refuse the version.`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Turns Apple's 409 for a version with unanswered age rating questions into
|
|
75
|
+
* one line naming the config keys. Returns undefined for any other error.
|
|
76
|
+
*/
|
|
77
|
+
export function ageRatingSubmissionError(error: unknown): Error | undefined {
|
|
78
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
79
|
+
if (!message.includes('/ageRatingDeclarations/')) return undefined;
|
|
80
|
+
const missing = [...message.matchAll(/value for the attribute '([^']+)'/g)].map(match => match[1]);
|
|
81
|
+
if (!missing.length) return undefined;
|
|
82
|
+
return new Error(
|
|
83
|
+
`App Store age rating is missing ${[...new Set(missing)].join(', ')}. ` +
|
|
84
|
+
`Answer ${missing.length > 1 ? 'them' : 'it'} in ageRating in the release config and run asc-submit again.`,
|
|
85
|
+
);
|
|
86
|
+
}
|
package/src/asc/submit.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** Local build and store release support. All app settings come from the consuming configuration. */
|
|
2
2
|
import { listingLocaleMap } from '../config.ts';
|
|
3
3
|
import type { AppReleaseConfig } from '../config.ts';
|
|
4
|
+
import { ageRatingSubmissionError, ensureAgeRating } from './age-rating.ts';
|
|
4
5
|
import { createAscClient, type AscClient } from './client.ts';
|
|
5
6
|
import { pushAscMetadata } from './metadata.ts';
|
|
6
7
|
import { stage } from '../progress.ts';
|
|
@@ -152,6 +153,10 @@ export async function submitForReview(config: AppReleaseConfig, opts: SubmitOpti
|
|
|
152
153
|
// submits through the API.
|
|
153
154
|
await ensureReviewContact(client, versionId, config);
|
|
154
155
|
|
|
156
|
+
// 4e. Age rating. It lives on the app info, not the version, and Apple adds
|
|
157
|
+
// required questions between releases (`socialMedia`, October 2026).
|
|
158
|
+
await ensureAgeRating(client, app.id, config.ageRating);
|
|
159
|
+
|
|
155
160
|
if (opts.attachOnly) {
|
|
156
161
|
console.log('\n✓ Build attached + notes set. Stopped before submission (attach-only).');
|
|
157
162
|
return;
|
|
@@ -212,7 +217,7 @@ export async function submitForReview(config: AppReleaseConfig, opts: SubmitOpti
|
|
|
212
217
|
},
|
|
213
218
|
},
|
|
214
219
|
}),
|
|
215
|
-
});
|
|
220
|
+
}).catch((error: unknown) => { throw ageRatingSubmissionError(error) ?? error; });
|
|
216
221
|
console.log(' ✓ added version to submission');
|
|
217
222
|
}
|
|
218
223
|
|
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. */
|
|
@@ -355,6 +362,11 @@ export interface AppReleaseConfig {
|
|
|
355
362
|
* version is nothing, and the submission 409s.
|
|
356
363
|
*/
|
|
357
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;
|
|
358
370
|
/** iOS bundle id. Independent of the Android package name. */
|
|
359
371
|
appId?: string;
|
|
360
372
|
/** App Store app id (numeric). May be used instead of the bundle id. */
|