@crossbind/extension-app-store 2.0.0-beta.78 → 2.0.0-beta.80

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/README.md CHANGED
@@ -2,24 +2,31 @@
2
2
 
3
3
  Uploads an iOS or a macOS app to App Store Connect, for TestFlight and App Review.
4
4
 
5
- An app has it by having `@crossbind/core-app-host`, which lists it as a dependency: there is nothing to install or list.
5
+ It comes with `@crossbind/core-app-host`: there is nothing to install or list.
6
6
 
7
7
  ## Use
8
8
 
9
9
  ```sh
10
10
  npx crossbind app store app-store
11
- npx crossbind app publish app-store -p ios --submit
12
- npx crossbind app publish app-store -p macos --submit
11
+ npx crossbind app store app-store --send
12
+ npx crossbind app upload app-store
13
+ npx crossbind app release app-store -p macos --rollout 10
13
14
  ```
14
15
 
15
- It takes iOS and macOS apps alike, so `-p` names the platform; an iOS publish that names no store comes here.
16
- `crossbind app store` names what Apple alone takes of either. An iOS publish builds the app with the next build number,
17
- archives it and uploads it to App Store Connect, whose TestFlight hands it to testers. A macOS publish builds the app in
18
- the App Sandbox, without its updater and for macOS 13 or later, puts it in an archive as Xcode makes one, and has Xcode
19
- export it to App Store Connect, into the iOS app's record as a universal purchase: Xcode's account or an Admin key signs
20
- the app and its installer package in the cloud, so no certificate is made by hand. `--submit` hands the version to App
21
- Review too, with the listing in `store/app-store`, whose `APP_DESKTOP` screenshots go with the macOS version and the
22
- others with the iOS one, and `--phased` releases what App Review approves in phases over 7 days.
16
+ An upload sends the iOS app, then the macOS one; `-p` sends one alone, and `crossbind app upload -p ios` with no
17
+ store name comes here. `crossbind app store` lists what only Apple's sites take, and `crossbind app store app-store
18
+ --send` sends the listing in `store/app-store` alone, with no build, into the version of `package.json`'s number,
19
+ through the App Store Connect API key.
20
+
21
+ - **iOS:** the upload builds the app with the next build number, archives it and uploads it to App Store Connect,
22
+ whose TestFlight hands it to testers.
23
+ - **macOS:** the upload builds the app in the App Sandbox, without its updater and for macOS 13 or later, and Xcode
24
+ exports it into the iOS app's record, as a universal purchase. Xcode's account or an Admin key signs the app and its
25
+ installer package in the cloud, so you make no certificate by hand.
26
+
27
+ A release hands the version to App Review, with no build, with the newest build of it TestFlight's testers have and the
28
+ listing in `store/app-store`: its `APP_DESKTOP` screenshots go with the macOS version, the others with the iOS one.
29
+ `--rollout` releases what App Review approves in phases over 7 days.
23
30
 
24
31
  ## Platforms
25
32
 
@@ -29,4 +36,4 @@ An iOS app, built on a Mac with Xcode, and a macOS app, built and uploaded on ma
29
36
 
30
37
  An extension named `app-store` with a publisher takes its place, and `app: { without: ['app-store'] }` in `crossbind.config.js` leaves it out. [extensions.md](https://github.com/crossbind/crossbind/blob/main/docs/api/extensions.md#publishers) says what one gives.
31
38
 
32
- [app.md](https://github.com/crossbind/crossbind/blob/main/docs/api/app.md#app-store-connect) has what it needs before the build, and how it asks for what is missing; its [Mac App Store](https://github.com/crossbind/crossbind/blob/main/docs/api/app.md#mac-app-store) section what the App Sandbox changes.
39
+ [app.md](https://github.com/crossbind/crossbind/blob/main/docs/api/app.md#app-store-connect) has what it needs before the build and how it asks for what is missing, and its [Mac App Store](https://github.com/crossbind/crossbind/blob/main/docs/api/app.md#mac-app-store) section what the App Sandbox changes.
@@ -1,6 +1,6 @@
1
1
  import {
2
- APP_STORE_LISTING, appStoreApp, appStoreCaller, appStoreListingProblems, askAppId, assertReviewable, listingOf, newestBuild,
3
- readAppStoreListing, readAppStoreSettings, submitRelease, untilDone, uploadArchive,
2
+ APP_STORE_LISTING, appStoreApp, appStoreCaller, appStoreListingProblems, appStoreState, askAppId, listingOf,
3
+ readAppStoreListing, readAppStoreSettings, releaseVersion, sendListing, untilDone, uploadArchive,
4
4
  } from '@crossbind/core-store-kit';
5
5
  import {
6
6
  addDsyms, archiveIosApp, archivedBinary, archivedPrivacy, archivedTargets, uploadIosArchive,
@@ -17,15 +17,20 @@ const PLATFORMS = {
17
17
  // The Mac App Store takes an Apple silicon app of macOS 13 or later.
18
18
  const MINIMUM_MACOS = '13.0';
19
19
 
20
- const NO_APP_ID = 'crossbind: App Store Connect knows an app by its bundle id, app.id, which crossbind.config.js does not set: set it, as com.example.myapp, before the first publish, as Apple keeps it for good.';
20
+ const NO_APP_ID = 'crossbind: App Store Connect knows an app by its bundle id, app.id, which crossbind.config.js does not set: set it, as com.example.myapp, before the first upload, as Apple keeps it for good.';
21
21
  const NO_TEAM = "crossbind: App Store Connect takes uploads from an Apple Developer Program team, which neither app.team in crossbind.config.js nor this machine's XCODE_DEVELOPMENT_TEAM names: set either to its id, which developer.apple.com/account shows under Membership details.";
22
22
  const NO_CATEGORY = 'crossbind: the Mac App Store takes no app without its category: set app.category in crossbind.config.js.';
23
23
  const NO_ENCRYPTION = 'crossbind: app.encryption is not set, so App Store Connect asks whether this build uses encryption before TestFlight hands it out; set it in crossbind.config.js to answer for every build.';
24
- const NO_ENCRYPTION_TO_SUBMIT = 'crossbind: App Review takes no build without its answer to whether it uses encryption: set app.encryption in crossbind.config.js.';
25
- const NO_KEY_TO_SUBMIT = "crossbind: --submit hands the version to App Review through App Store Connect's API, which takes an API key: set CROSSBIND_APPLE_API_KEY, CROSSBIND_APPLE_API_KEY_ID and CROSSBIND_APPLE_API_ISSUER, as app.md's Publishing says.";
24
+ // Where an App Store Connect API key comes from: this machine's ~/.crossbind/config.json, or the environment, as in CI.
25
+ const KEY_SETTINGS = 'crossbind config set APPLE_API_KEY <its .p8 file> and APPLE_API_ISSUER <its issuer ID>, or CROSSBIND_APPLE_API_KEY, CROSSBIND_APPLE_API_KEY_ID and CROSSBIND_APPLE_API_ISSUER, as in CI';
26
+ const NO_KEY_TO_RELEASE = `crossbind: crossbind app release hands the version to App Review through App Store Connect's API, which takes an API key: set one with ${KEY_SETTINGS}, as app.md's Publishing says.`;
27
+ const NO_KEY_TO_SEND = `crossbind: crossbind app store --send sends the page through App Store Connect's API, which takes an API key: set one with ${KEY_SETTINGS}, as app.md's Publishing says.`;
28
+ const NO_KEY_TO_SEE = `Set an App Store Connect API key with ${KEY_SETTINGS}, to see what App Store Connect has.`;
26
29
  const TEAM_ID = /^[A-Z0-9]{10}$/;
27
30
  const noIcon = (platform) => `crossbind: App Store Connect takes no ${platform} app without an icon: set app.icon in crossbind.config.js to a square PNG, at best 1024 × 1024.`;
28
- const notOnMac = (id) => `crossbind: App Store Connect's app ${id} is not on macOS yet: add the platform there, with the + beside its platform in the sidebar, which makes it a universal purchase, then publish again.`;
31
+ const notOnMac = (id, then = 'upload again, or upload the iOS app alone with -p ios') => `crossbind: App Store Connect's app ${id} is not on macOS yet: add the platform there, with the + beside its platform in the sidebar, which makes it a universal purchase, then ${then}.`;
32
+ const SEND_AGAIN = "send again, or send the iOS app's page alone with -p ios";
33
+ const RELEASE_AGAIN = 'release again, or release the iOS app alone with -p ios';
29
34
 
30
35
  async function pickTeam(api, teams) {
31
36
  if (teams.length === 1) {
@@ -66,8 +71,8 @@ async function askTeam(api) {
66
71
  }
67
72
  }
68
73
  api.settings.set({ XCODE_DEVELOPMENT_TEAM: id });
69
- if (api.app.team !== id) throw new Error(`crossbind: ~/.crossbind.json did not take XCODE_DEVELOPMENT_TEAM: set app.team: '${id}' in crossbind.config.js.`);
70
- api.log(`crossbind: ~/.crossbind.json keeps ${id} as XCODE_DEVELOPMENT_TEAM.`);
74
+ if (api.app.team !== id) throw new Error(`crossbind: ~/.crossbind/config.json did not take XCODE_DEVELOPMENT_TEAM: set app.team: '${id}' in crossbind.config.js.`);
75
+ api.log(`crossbind: ~/.crossbind/config.json keeps ${id} as XCODE_DEVELOPMENT_TEAM.`);
71
76
  }
72
77
 
73
78
  // The minimum macOS release of the store's build: the app's own where it is later.
@@ -82,52 +87,61 @@ async function isOnMac(call, appId) {
82
87
  return data.length > 0;
83
88
  }
84
89
 
85
- // What a publish with --submit hands to App Review through: the API, the app App Store Connect has, and the listing,
86
- // once App Store Connect would take the version to review. A macOS app's record, which a key reads before the build, has
87
- // to be on macOS already.
88
- async function releaseOf(api, key, { shouldSubmit, listings, settings }) {
89
- const isMac = api.platform === 'macos';
90
- if (!key || (!shouldSubmit && !isMac)) return { release: null };
90
+ // What a macOS app's record lacks, which a key reads before the build: the macOS platform, which App Store Connect takes
91
+ // no macOS build of the app without.
92
+ async function macRecordMissing(api, key) {
93
+ if (!key || api.platform !== 'macos') return [];
91
94
  const call = appStoreCaller(key);
92
- const appStoreId = await appStoreApp(call, api.app.id);
93
- if (isMac && !await isOnMac(call, appStoreId)) return { missing: [notOnMac(api.app.id)] };
94
- if (!shouldSubmit) return { release: null };
95
- await assertReviewable(call, appStoreId, api.app.appleVersion, PLATFORMS[api.platform].api);
96
- return {
97
- release: {
98
- call, appStoreId, listings, settings,
99
- },
100
- };
95
+ return await isOnMac(call, await appStoreApp(call, api.app.id)) ? [] : [notOnMac(api.app.id)];
101
96
  }
102
97
 
103
- // Hands the uploaded build to App Review as the app's version of its platform, with the listing and the settings, and
104
- // says how it went.
105
- async function submitToReview(api, {
106
- call, appStoreId, listings, settings,
107
- }, before) {
108
- const platform = PLATFORMS[api.platform];
109
- const isPhased = api.options.phased;
110
- const { build, listed, settled } = await submitRelease(call, {
111
- appId: appStoreId, versionString: api.app.appleVersion, before, buildNumber: api.app.buildNumber, listings, settings, isPhased, platform: platform.api,
112
- });
98
+ // Says what of the page changed on App Store Connect, as the project has it.
99
+ function saySent(api, platform, listings, { listed, settled }) {
113
100
  if (listings.length > 0) {
114
101
  api.log(listed.length > 0
115
102
  ? `crossbind: App Store Connect's ${platform.name} listing changed in ${listed.join(', ')}, as ${APP_STORE_LISTING} has it.`
116
103
  : `crossbind: App Store Connect's ${platform.name} listing is the one ${APP_STORE_LISTING} has already.`);
117
104
  }
118
105
  if (settled.length > 0) api.log(`crossbind: App Store Connect's ${settled.join(', ')} changed, as ${APP_STORE_LISTING} has them.`);
119
- const phases = isPhased ? ', to go out in phases over 7 days once released' : '';
106
+ }
107
+
108
+ // Hands App Review the version of package.json's number on the platform, with the newest build of it App Store Connect
109
+ // has processed, which TestFlight's testers have, and the page store/app-store holds, with no build, to go out in phases
110
+ // over 7 days once approved where --rollout says so; says how it went.
111
+ async function releaseToReview(api) {
112
+ const platform = PLATFORMS[api.platform];
113
+ const root = api.project.root;
114
+ const listings = listingOf(readAppStoreListing(root), platform.api);
115
+ const settings = readAppStoreSettings(root);
116
+ const missing = appStoreListingProblems(root, listings);
117
+ const key = api.apple.key();
118
+ if (!key) missing.push(NO_KEY_TO_RELEASE);
119
+ if (api.config.app.id === undefined) {
120
+ if (api.isGuided) await askAppId(api, 'App Store Connect', 'bundle id');
121
+ else missing.push(NO_APP_ID);
122
+ }
123
+ if (missing.length > 0) return { missing };
124
+ const call = appStoreCaller(key);
125
+ const appStoreId = await appStoreApp(call, api.app.id);
126
+ if (api.platform === 'macos' && !await isOnMac(call, appStoreId)) return { missing: [notOnMac(api.app.id, RELEASE_AGAIN)] };
127
+ const isPhased = api.options.rollout !== null;
128
+ api.log(`crossbind: handing ${api.app.id} ${api.app.appleVersion} for ${platform.name} to App Review, with the newest build of it App Store Connect has processed.`);
129
+ const { build, listed, settled } = await releaseVersion(call, {
130
+ appId: appStoreId, versionString: api.app.appleVersion, listings, settings, isPhased, usesEncryption: api.app.encryption, platform: platform.api,
131
+ });
132
+ saySent(api, platform, listings, { listed, settled });
133
+ const phases = isPhased ? ', to go out in phases over 7 days once approved' : '';
120
134
  api.log(`crossbind: ${api.app.id} ${api.app.appleVersion} (build ${build}) for ${platform.name} went to App Review${phases}; Apple mails as the review goes.`);
135
+ return {};
121
136
  }
122
137
 
123
- // An app extension's reasons are its target's, which its extension gives, so the publish names them and asks for none.
138
+ // An app extension's reasons are its target's, which its extension gives, so the upload names them and asks for none.
124
139
  const unreasonedTargetError = ({ name, unreasoned }) => new Error(`crossbind: App Store Connect refuses an iOS app that calls required reason API without Apple's reasons for it (ITMS-91053), and the app's target ${name} calls ${unreasoned.map(({ category, symbols }) => `${category} (${symbols.join(', ')})`).join(' and ')} with no reason in its privacy manifest. Its extension gives the target Apple's reasons in its privacy, as { fileTimestamp: ['C617.1'] }. Nothing went to App Store Connect.`);
125
140
  const unreasonedError = (unreasoned) => new Error(`crossbind: App Store Connect refuses an iOS app that calls required reason API without Apple's reasons for it (ITMS-91053), and this app calls ${unreasoned.map(({ category, symbols }) => `${category} (${symbols.join(', ')})`).join(' and ')} with no reason in its privacy manifest. Give app.privacy Apple's reasons, as { fileTimestamp: ['C617.1'] }; Apple's "Describing use of required reason API" says what each covers. Nothing went to App Store Connect.`);
126
141
 
127
142
  // What the app lacks that App Store Connect asks for, asked for on a terminal and named at once without one.
128
- async function missingOf(api, { key, shouldSubmit }) {
143
+ async function missingOf(api) {
129
144
  const missing = [];
130
- if (shouldSubmit && !key) missing.push(NO_KEY_TO_SUBMIT);
131
145
  if (api.config.app.id === undefined) {
132
146
  if (api.isGuided) await askAppId(api, 'App Store Connect', 'bundle id');
133
147
  else missing.push(NO_APP_ID);
@@ -141,14 +155,11 @@ async function missingOf(api, { key, shouldSubmit }) {
141
155
  else missing.push(noIcon(PLATFORMS[api.platform].name));
142
156
  }
143
157
  if (api.platform === 'macos' && !api.app.category?.macos) missing.push(NO_CATEGORY);
144
- if (shouldSubmit && !api.isGuided && api.app.encryption === null) missing.push(NO_ENCRYPTION_TO_SUBMIT);
145
158
  return missing;
146
159
  }
147
160
 
148
161
  // Archives the iOS app crossbind built, which shows what required reason API it calls before it goes, and uploads it.
149
- async function uploadIos(api, {
150
- key, dsyms, facts, release,
151
- }, { project }) {
162
+ async function uploadIos(api, { key, dsyms, facts }, { project }) {
152
163
  api.log('crossbind: archiving the app, which takes a few minutes.');
153
164
  const archive = await untilDone(api, () => archiveIosApp(api, project, { facts }));
154
165
  const target = archivedTargets(api, archive).map(({ name, binary, privacy }) => ({ name, unreasoned: api.apple.unreasonedApis(binary, privacy) }))
@@ -164,24 +175,21 @@ async function uploadIos(api, {
164
175
  addDsyms(archive, dsyms);
165
176
  api.log(`crossbind: uploading the app to App Store Connect for team ${facts.team} with ${key ? `the API key ${key.keyId}` : "Xcode's account"}, which signs it.`);
166
177
  const build = api.app.buildNumber;
167
- const before = release ? await newestBuild(release.call, release.appStoreId, api.app.appleVersion) : null;
168
178
  await untilDone(api, () => uploadIosArchive(api, archive, {
169
179
  team: facts.team, key, isBuildManaged: build === null, facts,
170
180
  }));
171
181
  const app = build === null ? `${facts.id} ${api.app.appleVersion}, numbered by Xcode after the builds App Store Connect has of it,` : `${facts.id} ${api.app.appleVersion} (build ${build})`;
172
- api.log(`crossbind: ${app} is on App Store Connect. TestFlight hands it out once Apple has processed it, usually within 5 to 30 minutes, and Apple mails when it has.`);
173
- if (release) await submitToReview(api, release, before);
182
+ api.log(`crossbind: ${app} is on App Store Connect. TestFlight hands it out once Apple has processed it, usually within 5 to 30 minutes, and Apple mails when it has; crossbind app release app-store then hands it to App Review.`);
174
183
  return { published: { appId: facts.id, version: api.app.appleVersion, build } };
175
184
  }
176
185
 
177
186
  // Puts the macOS app crossbind built in an archive Xcode exports to App Store Connect, which signs it and its installer
178
187
  // package in the cloud.
179
- async function uploadMac(api, { key, facts, release }, { apps }) {
188
+ async function uploadMac(api, { key, facts }, { apps }) {
180
189
  const [built] = apps;
181
190
  if (!built) throw new Error('crossbind: the build made no macOS app, so nothing went to App Store Connect.');
182
191
  const archive = writeArchive(api, built, { team: facts.team });
183
192
  const build = api.app.buildNumber;
184
- const before = release ? await newestBuild(release.call, release.appStoreId, api.app.appleVersion, PLATFORMS.macos.api) : null;
185
193
  api.log(`crossbind: uploading the app to App Store Connect for team ${facts.team} with ${key ? `the API key ${key.keyId}` : "Xcode's account"}, which signs it and its installer package.`);
186
194
  await untilDone(api, () => uploadArchive(api, archive, {
187
195
  team: facts.team, key, isBuildManaged: build === null, facts, platform: 'macOS',
@@ -189,14 +197,61 @@ async function uploadMac(api, { key, facts, release }, { apps }) {
189
197
  const app = build === null
190
198
  ? `${facts.id} ${api.app.appleVersion} for macOS, numbered by Xcode after the builds App Store Connect has of it,`
191
199
  : `${facts.id} ${api.app.appleVersion} (build ${build}) for macOS`;
192
- api.log(`crossbind: ${app} is on App Store Connect. TestFlight hands it to Mac testers once Apple has processed it, usually within 5 to 30 minutes, and Apple mails when it has.`);
193
- if (release) await submitToReview(api, release, before);
200
+ api.log(`crossbind: ${app} is on App Store Connect. TestFlight hands it to Mac testers once Apple has processed it, usually within 5 to 30 minutes, and Apple mails when it has; crossbind app release app-store then hands it to App Review.`);
194
201
  return { published: { appId: facts.id, version: api.app.appleVersion, build } };
195
202
  }
196
203
 
197
- // The publisher of an iOS or a macOS app to App Store Connect, whose TestFlight hands it out, for the platform -p names:
198
- // crossbind builds the app, a macOS one sandboxed, the upload archives it, an iOS one after showing what required reason
199
- // API it calls, and Xcode exports the archive to App Store Connect, which signs it in the cloud.
204
+ // Whether the project's settings give App Store Connect anything.
205
+ const hasSettings = ({
206
+ copyright, categories, ageRating, review,
207
+ }) => copyright !== undefined || Object.keys(categories).length > 0 || Boolean(ageRating) || Object.keys(review).length > 0;
208
+
209
+ // Sends the page store/app-store holds of the app on its platform, with no build: its listing, screenshots and settings,
210
+ // through App Store Connect's API, into the version of package.json's number, which shows them once out.
211
+ async function sendPage(api) {
212
+ const platform = PLATFORMS[api.platform];
213
+ const root = api.project.root;
214
+ const listings = listingOf(readAppStoreListing(root), platform.api);
215
+ const settings = readAppStoreSettings(root);
216
+ if (listings.length === 0 && !hasSettings(settings)) {
217
+ api.log(`crossbind: ${APP_STORE_LISTING} holds no page of the app, so nothing went to App Store Connect for ${platform.name}.`);
218
+ return {};
219
+ }
220
+ const problems = appStoreListingProblems(root, listings);
221
+ if (problems.length > 0) return { missing: problems };
222
+ const key = api.apple.key();
223
+ const missing = key ? [] : [NO_KEY_TO_SEND];
224
+ if (api.config.app.id === undefined) {
225
+ if (api.isGuided) await askAppId(api, 'App Store Connect', 'bundle id');
226
+ else missing.push(NO_APP_ID);
227
+ }
228
+ if (missing.length > 0) return { missing };
229
+ const call = appStoreCaller(key);
230
+ const appStoreId = await appStoreApp(call, api.app.id);
231
+ if (api.platform === 'macos' && !await isOnMac(call, appStoreId)) return { missing: [notOnMac(api.app.id, SEND_AGAIN)] };
232
+ api.log(`crossbind: sending the ${platform.name} page ${APP_STORE_LISTING} holds of ${api.app.id} ${api.app.appleVersion} to App Store Connect.`);
233
+ const sent = await sendListing(call, {
234
+ appId: appStoreId, versionString: api.app.appleVersion, listings, settings, platform: platform.api,
235
+ });
236
+ saySent(api, platform, listings, sent);
237
+ return {};
238
+ }
239
+
240
+ // What App Store Connect has of the app on each platform, asking for nothing.
241
+ async function pageState(api) {
242
+ const key = api.apple.key();
243
+ if (!key) return [NO_KEY_TO_SEE];
244
+ if (api.config.app.id === undefined) return ['Set app.id in crossbind.config.js, and App Store Connect tells what it has of the app.'];
245
+ const call = appStoreCaller(key);
246
+ const lines = await appStoreState(call, await appStoreApp(call, api.app.id));
247
+ return lines.length > 0 ? lines : [`no version or build of ${api.app.id} yet`];
248
+ }
249
+
250
+ // The publisher of an app's iOS and macOS builds to App Store Connect, whose TestFlight hands them out, both one after
251
+ // the other or the one -p names: crossbind builds the app, a macOS one sandboxed, the upload archives it, an iOS one
252
+ // after showing what required reason API it calls, and Xcode exports the archive to App Store Connect, which signs it in
253
+ // the cloud. The release hands the build TestFlight's testers have to App Review with the app's page in store/app-store,
254
+ // which also goes alone.
200
255
  export default function appStore() {
201
256
  return {
202
257
  name: 'app-store',
@@ -206,41 +261,28 @@ export default function appStore() {
206
261
  platform: ['ios', 'macos'],
207
262
  isDefault: ['ios'],
208
263
  store: 'App Store Connect',
209
- options: {
210
- submit: { help: "hand the app's version to App Review too, with the build and the listing in store/app-store, through App Store Connect's API" },
211
- phased: { help: 'release the version App Review approves in phases over 7 days, with --submit' },
212
- },
264
+ canStage: true,
213
265
 
214
266
  // The store updates the macOS app it installs from the installer package the upload makes, and takes it
215
267
  // sandboxed.
216
268
  build: (api) => (api.platform === 'macos' ? { app: { updater: null, installers: [], macos: { sandbox: true, minimumVersion: minimumMacos(api) } } } : null),
217
269
 
218
270
  async check(api) {
219
- const { submit: shouldSubmit, phased } = api.options;
220
- if (phased && !shouldSubmit) throw new Error('crossbind: --phased releases the version App Review approves, so it takes --submit.');
221
271
  const platform = PLATFORMS[api.platform];
222
272
  if (process.platform !== 'darwin') throw new Error(`crossbind: ${platform.name} apps build and go to App Store Connect on macOS, with Xcode.`);
223
- const root = api.project.root;
224
273
  const key = api.apple.key();
225
- const listings = shouldSubmit ? listingOf(readAppStoreListing(root), platform.api) : [];
226
- const settings = shouldSubmit ? readAppStoreSettings(root) : {};
227
- const missing = [...appStoreListingProblems(root, listings), ...await missingOf(api, { key, shouldSubmit })];
274
+ const missing = await missingOf(api);
228
275
  if (missing.length > 0) return { missing };
229
276
  if (api.app.encryption === null) {
230
277
  if (api.isGuided) await askEncryption(api);
231
278
  else api.warn(NO_ENCRYPTION);
232
279
  }
233
- const record = await releaseOf(api, key, { shouldSubmit, listings, settings });
234
- if (record.missing) return { missing: record.missing };
235
- const { release } = record;
280
+ const unready = await macRecordMissing(api, key);
281
+ if (unready.length > 0) return { missing: unready };
236
282
  const facts = { id: api.app.id, team: api.app.team };
237
283
  const dsyms = api.platform === 'ios' ? { dsyms: await api.apple.dsyms() } : {};
238
- api.log(`crossbind: publishing ${facts.id} ${api.app.appleVersion} for ${platform.name} to App Store Connect for team ${facts.team}${release ? ' and App Review' : ''}; building the app first.`);
239
- return {
240
- session: {
241
- key, ...dsyms, facts, release,
242
- },
243
- };
284
+ api.log(`crossbind: publishing ${facts.id} ${api.app.appleVersion} for ${platform.name} to App Store Connect for team ${facts.team}; building the app first.`);
285
+ return { session: { key, ...dsyms, facts } };
244
286
  },
245
287
 
246
288
  // Xcode numbers a build without CROSSBIND_APP_BUILD_NUMBER after those App Store Connect has.
@@ -252,6 +294,12 @@ export default function appStore() {
252
294
 
253
295
  upload: (api, session, output) => (api.platform === 'macos' ? uploadMac(api, session, output) : uploadIos(api, session, output)),
254
296
 
297
+ release: (api) => releaseToReview(api),
298
+
299
+ send: (api) => sendPage(api),
300
+
301
+ state: (api) => pageState(api),
302
+
255
303
  guide: (api) => appStoreGuide(api),
256
304
  },
257
305
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossbind/extension-app-store",
3
- "version": "2.0.0-beta.78",
3
+ "version": "2.0.0-beta.80",
4
4
  "description": "crossbind app extension: uploads an iOS or a macOS app to App Store Connect, for TestFlight and App Review.",
5
5
  "homepage": "https://github.com/crossbind/crossbind/tree/main/extensions/app-store#readme",
6
6
  "repository": {
@@ -20,7 +20,7 @@
20
20
  "extension": "./crossbind.extension.js"
21
21
  },
22
22
  "dependencies": {
23
- "@crossbind/core-store-kit": "^2.0.0-beta.78"
23
+ "@crossbind/core-store-kit": "^2.0.0-beta.80"
24
24
  },
25
25
  "keywords": [
26
26
  "crossbind-extension",
package/src/appSetup.js CHANGED
@@ -1,4 +1,4 @@
1
- // What only the project can answer, which a publish asks on a terminal and writes into crossbind.config.js once the
1
+ // What only the project can answer, which an upload asks on a terminal and writes into crossbind.config.js once the
2
2
  // user says yes, through the api.
3
3
 
4
4
  const REASONS_PAGE = 'https://developer.apple.com/documentation/bundleresources/describing-use-of-required-reason-api';
@@ -17,7 +17,8 @@ const TEXTS = {
17
17
  };
18
18
  const file = (name) => path.join(APP_STORE_LISTING, name);
19
19
 
20
- // What a publish with --submit sends of a locale: its texts and its screenshots of each display type.
20
+ // What crossbind app store --send sends of a locale, as a release does: its texts and its screenshots of
21
+ // each display type.
21
22
  function localeLine({
22
23
  locale, info, version, screenshots,
23
24
  }) {
@@ -25,7 +26,7 @@ function localeLine({
25
26
  Object.keys({ ...info, ...version }).map((field) => TEXTS[field]).join(', '),
26
27
  Object.entries(screenshots).map(([type, files]) => `${files.length} ${type} screenshots`).join(', '),
27
28
  ].filter(Boolean);
28
- return `with --submit, ${path.join(APP_STORE_LISTING, locale)}: ${parts.join('; ')}`;
29
+ return `${path.join(APP_STORE_LISTING, locale)}: ${parts.join('; ')}`;
29
30
  }
30
31
 
31
32
  // The project's listing and settings, with what stops reading them as a problem of its own.
@@ -47,7 +48,7 @@ function readAll(root) {
47
48
  return { listings, settings, problems };
48
49
  }
49
50
 
50
- // What a publish with --submit sends of the app's settings.
51
+ // What crossbind app store --send sends of the app's settings, as a release does.
51
52
  function settingsLines({
52
53
  copyright, categories, ageRating, review,
53
54
  }) {
@@ -56,7 +57,7 @@ function settingsLines({
56
57
  Object.keys(categories).length === 0 ? null : `categories: ${Object.values(categories).join(', ')}`,
57
58
  ageRating ? `the age rating's answers in ${file('age_rating.json')}` : null,
58
59
  Object.keys(review).length === 0 ? null : `App Review's contact in ${file('review_information')}`,
59
- ].filter(Boolean).map((line) => `with --submit, ${line}`);
60
+ ].filter(Boolean);
60
61
  }
61
62
 
62
63
  // The steps App Store Connect alone takes of what the project's files leave out.
@@ -75,31 +76,35 @@ function lackedSteps(listings, settings) {
75
76
  ].filter(Boolean).map((text) => ({ text }));
76
77
  }
77
78
 
78
- // What crossbind app store says of App Store Connect, of the iOS app and the macOS one alike: what a publish sends, with
79
- // --submit the listing and settings too, what App Store Connect would refuse of them, and the steps it alone takes.
79
+ // What crossbind app store says of App Store Connect, of the iOS app and the macOS one alike: what an upload sends, what
80
+ // a release puts out, what --send sends, which a release sends too, what App Store Connect would refuse of them, and the
81
+ // steps it alone takes.
80
82
  export function appStoreGuide(api) {
81
83
  const { listings, settings, problems: read } = readAll(api.project.root);
82
84
  const problems = [...read, ...(api.app.category?.macos ? [] : ['crossbind: app.category is not set, and the Mac App Store takes no app without its category.'])];
83
- const sends = [
84
- 'with -p ios, the iOS app, archived and uploaded, which TestFlight hands to testers once Apple has processed it',
85
- 'with -p macos, the macOS app, sandboxed, in an archive Xcode exports to App Store Connect, which signs it and its installer package in the cloud, and whose TestFlight hands it to Mac testers once Apple has processed it',
86
- ...listings.map(localeLine),
87
- ...settingsLines(settings),
85
+ const uploads = [
86
+ 'the iOS app, archived and uploaded, which TestFlight hands to testers once Apple has processed it; -p ios sends it alone',
87
+ 'then the macOS app, sandboxed, in an archive Xcode exports to App Store Connect, which signs it and its installer package in the cloud, and whose TestFlight hands it to Mac testers once Apple has processed it; -p macos sends it alone',
88
+ ];
89
+ const sends = [...listings.map(localeLine), ...settingsLines(settings)];
90
+ const releases = [
91
+ "the newest build of the version TestFlight's testers have, to App Review, which puts it out once approved, in phases over 7 days with --rollout",
92
+ 'with it, the page --send sends',
88
93
  ];
89
94
  const id = api.config.app.id;
90
95
  const steps = [
91
96
  id === undefined
92
- ? { text: 'Set app.id in crossbind.config.js, as com.example.myapp, which App Store Connect keeps for good as the bundle ID; then create the app with it, under Apps, as a new app on iOS and, for -p macos, macOS.', url: APP_STORE_CONNECT }
93
- : { text: `Apps › New App: an app with ${id} as its bundle ID, on iOS and, for -p macos, macOS, with its name, primary language and SKU, as Apple's API makes none; a publish without --submit registers the bundle ID first, so the form lists it. An app on iOS alone takes macOS later with the + beside its platform in the sidebar, as a universal purchase, which stays one once both platforms are approved.`, url: APP_STORE_CONNECT },
97
+ ? { text: 'Set app.id in crossbind.config.js, as com.example.myapp, which App Store Connect keeps for good as the bundle ID; then create the app with it, under Apps, as a new app on iOS and macOS, as an upload without -p sends both.', url: APP_STORE_CONNECT }
98
+ : { text: `Apps › New App: an app with ${id} as its bundle ID, on iOS and macOS, as an upload without -p sends both, with its name, primary language and SKU, as Apple's API makes none; an upload registers the bundle ID first, so the form lists it. An app on iOS alone takes macOS later with the + beside its platform in the sidebar, as a universal purchase, which stays one once both platforms are approved, and uploads with -p ios until then.`, url: APP_STORE_CONNECT },
94
99
  { text: "App Privacy: answer what data the app and the code it carries collect, as Data Not Collected where it collects none; Apple's API takes no answer." },
95
100
  { text: "Pricing and Availability: the price, free or one of Apple's, and the countries and regions the app goes to." },
96
101
  { text: "App Information › Content Rights: whether the app shows, holds or reaches others' content." },
97
102
  ...lackedSteps(listings, settings),
98
103
  ...(api.app.encryption === null ? [{ text: 'Set app.encryption in crossbind.config.js, whose answer App Store Connect takes of every build and App Review of every submission.' }] : []),
99
104
  ...(api.app.encryption === true ? [{ text: 'App Information › App Encryption Documentation: what export compliance takes of an app that uses encryption.' }] : []),
100
- { text: "For --submit and CI: Users and Access › Integrations › App Store Connect API: a key of the App Manager or Admin role, as CROSSBIND_APPLE_API_KEY, CROSSBIND_APPLE_API_KEY_ID and CROSSBIND_APPLE_API_ISSUER; Apple signs the uploads of an Admin key in the cloud, as it does those of Xcode's account on your Mac.", url: API_KEYS },
105
+ { text: "For --send, releases and CI: Users and Access › Integrations › App Store Connect API: a key of the App Manager or Admin role, which crossbind config set APPLE_API_KEY <its .p8 file> and APPLE_API_ISSUER <its issuer ID> keep on this Mac, and CI gives as CROSSBIND_APPLE_API_KEY, CROSSBIND_APPLE_API_KEY_ID and CROSSBIND_APPLE_API_ISSUER. Uploads then go with the key too: Apple signs the uploads of an Admin key in the cloud, as it does those of Xcode's account on your Mac.", url: API_KEYS },
101
106
  ];
102
107
  return {
103
- sends, problems, where: 'App Store Connect', steps,
108
+ uploads, sends, releases, problems, where: 'App Store Connect', steps,
104
109
  };
105
110
  }