eas-cli 21.8.0 → 22.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/README.md +209 -186
- package/build/build/android/prepareJob.js +1 -0
- package/build/build/ios/prepareJob.js +1 -0
- package/build/build/metadata.js +0 -1
- package/build/build/runBuildAndSubmit.js +1 -1
- package/build/build/utils/formatBuild.js +2 -2
- package/build/build/utils/url.js +3 -5
- package/build/commandUtils/context/contextUtils/getProjectIdAsync.js +10 -3
- package/build/commandUtils/new/configs.js +1 -1
- package/build/commands/account/view.js +1 -2
- package/build/commands/build/cancel.js +3 -3
- package/build/commands/build/download.js +1 -1
- package/build/commands/fingerprint/compare.js +100 -48
- package/build/commands/go.d.ts +1 -0
- package/build/commands/go.js +10 -47
- package/build/commands/project/icon/set.js +4 -40
- package/build/commands/project/init.d.ts +1 -0
- package/build/commands/project/init.js +13 -0
- package/build/commands/simulator/availability.js +2 -1
- package/build/commands/simulator/index.d.ts +1 -0
- package/build/commands/simulator/index.js +10 -5
- package/build/commands/simulator/stop.js +1 -0
- package/build/commands/submit.d.ts +1 -0
- package/build/commands/submit.js +8 -1
- package/build/commands/update/index.js +1 -1
- package/build/commands/update/revert-update-rollout.js +1 -1
- package/build/commands/update/rollback.js +1 -1
- package/build/credentials/ios/api/graphql/queries/AppleDeviceQuery.js +20 -13
- package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.d.ts +14 -2
- package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.js +47 -7
- package/build/credentials/ios/appstore/ensureTestFlightGroup.d.ts +3 -1
- package/build/credentials/ios/appstore/ensureTestFlightGroup.js +14 -11
- package/build/graphql/generated.d.ts +703 -932
- package/build/graphql/generated.js +16 -2
- package/build/graphql/queries/ChannelInsightsQuery.js +4 -1
- package/build/graphql/queries/DeviceRunSessionQuery.js +5 -0
- package/build/graphql/types/Account.js +1 -4
- package/build/graphql/types/Build.js +13 -8
- package/build/graphql/types/Submission.js +0 -1
- package/build/graphql/types/Update.js +4 -1
- package/build/project/accountSelection.js +1 -3
- package/build/project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync.js +3 -5
- package/build/project/projectIcon.d.ts +40 -0
- package/build/project/projectIcon.js +132 -0
- package/build/project/projectNotConfiguredError.d.ts +17 -0
- package/build/project/projectNotConfiguredError.js +24 -0
- package/build/simulator/env.d.ts +1 -1
- package/build/simulator/env.js +12 -2
- package/build/simulator/utils.js +26 -0
- package/build/submit/ArchiveSource.js +3 -3
- package/build/submit/context.d.ts +2 -0
- package/build/submit/context.js +1 -0
- package/build/submit/ios/AppProduce.js +1 -1
- package/build/submit/ios/IosSubmitCommand.js +2 -0
- package/build/submit/ios/ensureTestFlightSetup.d.ts +7 -0
- package/build/submit/ios/ensureTestFlightSetup.js +81 -0
- package/build/submit/status.js +1 -1
- package/build/submit/utils/formatSubmission.js +2 -2
- package/build/update/queries.js +1 -1
- package/build/update/republish.js +3 -3
- package/build/update/roll-back-to-embedded.js +1 -1
- package/build/update/utils.d.ts +2 -1
- package/build/update/utils.js +7 -7
- package/build/uploads.d.ts +5 -0
- package/build/uploads.js +22 -0
- package/build/user/User.js +1 -1
- package/oclif.manifest.json +222 -186
- package/package.json +7 -7
|
@@ -8,6 +8,7 @@ export default class Simulator extends EasCommand {
|
|
|
8
8
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
9
|
platform: import("@oclif/core/lib/interfaces").OptionFlag<"android" | "ios" | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
10
|
name: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
device: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
12
|
type: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
12
13
|
'package-version': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
13
14
|
'max-duration-minutes': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
@@ -42,6 +42,9 @@ class Simulator extends EasCommand_1.default {
|
|
|
42
42
|
name: core_1.Flags.string({
|
|
43
43
|
description: 'Human-readable name for the simulator session, shown in eas simulator:list and on expo.dev. Defaults to unnamed.',
|
|
44
44
|
}),
|
|
45
|
+
device: core_1.Flags.string({
|
|
46
|
+
description: 'Virtual device to start for the session. On iOS, a Simulator device name or UDID (e.g. "iPhone 16 Pro"). On Android, an AVD hardware profile id (e.g. "pixel_7"). Defaults to a device chosen by the runner.',
|
|
47
|
+
}),
|
|
45
48
|
type: core_1.Flags.option({
|
|
46
49
|
description: 'Type of simulator session to create',
|
|
47
50
|
options: Object.values(utils_1.DEVICE_RUN_SESSION_TYPE_FLAG_VALUES),
|
|
@@ -92,6 +95,7 @@ class Simulator extends EasCommand_1.default {
|
|
|
92
95
|
// The server rejects blank names, so trim here and treat a whitespace-only
|
|
93
96
|
// --name as if it had been omitted rather than surfacing a validation error.
|
|
94
97
|
const name = flags.name?.trim() || undefined;
|
|
98
|
+
const deviceIdentifier = flags.device?.trim() || undefined;
|
|
95
99
|
await (0, env_1.loadSimulatorEnvAsync)(projectDir);
|
|
96
100
|
const existingDeviceRunSessionId = process.env[env_1.EAS_SIMULATOR_SESSION_ID];
|
|
97
101
|
if (existingDeviceRunSessionId && !flags.force) {
|
|
@@ -115,6 +119,7 @@ class Simulator extends EasCommand_1.default {
|
|
|
115
119
|
platform,
|
|
116
120
|
type: utils_1.DEVICE_RUN_SESSION_TYPE_BY_FLAG_VALUE[flags.type],
|
|
117
121
|
packageVersion: flags['package-version'],
|
|
122
|
+
deviceIdentifier,
|
|
118
123
|
maxRunTimeMinutes: flags['max-duration-minutes'],
|
|
119
124
|
});
|
|
120
125
|
deviceRunSessionId = session.id;
|
|
@@ -282,7 +287,7 @@ async function waitForSessionEndOrInterruptAsync({ graphqlClient, deviceRunSessi
|
|
|
282
287
|
jobRunStatus === generated_1.JobRunStatus.Canceled ||
|
|
283
288
|
jobRunStatus === generated_1.JobRunStatus.Finished) {
|
|
284
289
|
spinner.succeed(`Simulator session ended. ${(0, log_1.link)(deviceRunSessionUrl)}`);
|
|
285
|
-
await resetSimulatorEnvVerboseAsync(projectDir);
|
|
290
|
+
await resetSimulatorEnvVerboseAsync(projectDir, deviceRunSessionId);
|
|
286
291
|
return;
|
|
287
292
|
}
|
|
288
293
|
await (0, promise_1.sleepAsync)(POLL_INTERVAL_MS, signal);
|
|
@@ -291,7 +296,7 @@ async function waitForSessionEndOrInterruptAsync({ graphqlClient, deviceRunSessi
|
|
|
291
296
|
const stopped = await ensureDeviceRunSessionStoppedSafelyAsync(graphqlClient, deviceRunSessionId);
|
|
292
297
|
if (stopped) {
|
|
293
298
|
spinner.succeed('Simulator session stopped');
|
|
294
|
-
await resetSimulatorEnvVerboseAsync(projectDir);
|
|
299
|
+
await resetSimulatorEnvVerboseAsync(projectDir, deviceRunSessionId);
|
|
295
300
|
}
|
|
296
301
|
else {
|
|
297
302
|
spinner.fail(`Could not confirm the simulator session was stopped. Run \`eas simulator:stop --id ${deviceRunSessionId}\` to terminate it and avoid unexpected charges.`);
|
|
@@ -331,7 +336,7 @@ async function stopDeviceRunSessionAfterInterruptAsync({ graphqlClient, deviceRu
|
|
|
331
336
|
const stopped = await ensureDeviceRunSessionStoppedSafelyAsync(graphqlClient, deviceRunSessionId);
|
|
332
337
|
if (stopped) {
|
|
333
338
|
spinner.succeed('Simulator session stopped');
|
|
334
|
-
await resetSimulatorEnvVerboseAsync(projectDir);
|
|
339
|
+
await resetSimulatorEnvVerboseAsync(projectDir, deviceRunSessionId);
|
|
335
340
|
}
|
|
336
341
|
else {
|
|
337
342
|
spinner.fail(`Could not confirm the simulator session was stopped. Run \`eas simulator:stop --id ${deviceRunSessionId}\` to terminate it and avoid unexpected charges.`);
|
|
@@ -342,9 +347,9 @@ async function stopDeviceRunSessionAfterInterruptAsync({ graphqlClient, deviceRu
|
|
|
342
347
|
}
|
|
343
348
|
process.exit(130);
|
|
344
349
|
}
|
|
345
|
-
async function resetSimulatorEnvVerboseAsync(projectDir) {
|
|
350
|
+
async function resetSimulatorEnvVerboseAsync(projectDir, deviceRunSessionId) {
|
|
346
351
|
try {
|
|
347
|
-
await (0, env_1.resetSimulatorEnvAsync)(projectDir);
|
|
352
|
+
await (0, env_1.resetSimulatorEnvAsync)(projectDir, deviceRunSessionId);
|
|
348
353
|
}
|
|
349
354
|
catch (err) {
|
|
350
355
|
log_1.default.error(`Failed to clean up ${env_1.SIMULATOR_DOTENV_FILE_NAME}`);
|
|
@@ -46,6 +46,7 @@ class SimulatorStop extends EasCommand_1.default {
|
|
|
46
46
|
stopSpinner.fail(`Failed to stop simulator session ${flagId}`);
|
|
47
47
|
throw err;
|
|
48
48
|
}
|
|
49
|
+
await (0, env_1.resetSimulatorEnvAsync)(projectDir, flagId);
|
|
49
50
|
if (jsonFlag) {
|
|
50
51
|
(0, json_1.printJsonOnlyOutput)({ id: session.id, status: session.status });
|
|
51
52
|
}
|
|
@@ -15,6 +15,7 @@ export default class Submit extends EasCommand {
|
|
|
15
15
|
'verbose-fastlane': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
16
16
|
groups: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
17
17
|
'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
18
|
+
'auto-testflight-setup': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
18
19
|
};
|
|
19
20
|
static contextDefinition: {
|
|
20
21
|
vcsClient: import("../commandUtils/context/VcsClientContextField").default;
|
package/build/commands/submit.js
CHANGED
|
@@ -67,6 +67,11 @@ class Submit extends EasCommand_1.default {
|
|
|
67
67
|
default: false,
|
|
68
68
|
description: 'Run command in non-interactive mode',
|
|
69
69
|
}),
|
|
70
|
+
'auto-testflight-setup': core_1.Flags.boolean({
|
|
71
|
+
default: true,
|
|
72
|
+
allowNo: true,
|
|
73
|
+
description: 'Set up an internal TestFlight group for the app (iOS only)',
|
|
74
|
+
}),
|
|
70
75
|
};
|
|
71
76
|
static contextDefinition = {
|
|
72
77
|
...this.ContextOptions.LoggedIn,
|
|
@@ -101,6 +106,7 @@ class Submit extends EasCommand_1.default {
|
|
|
101
106
|
profile: submissionProfile.profile,
|
|
102
107
|
archiveFlags: flagsWithPlatform.archiveFlags,
|
|
103
108
|
nonInteractive: flagsWithPlatform.nonInteractive,
|
|
109
|
+
autoTestFlightSetup: flagsWithPlatform.autoTestFlightSetup,
|
|
104
110
|
isVerboseFastlaneEnabled: flagsWithPlatform.isVerboseFastlaneEnabled,
|
|
105
111
|
groups: flagsWithPlatform.groups,
|
|
106
112
|
actor,
|
|
@@ -130,7 +136,7 @@ class Submit extends EasCommand_1.default {
|
|
|
130
136
|
}
|
|
131
137
|
}
|
|
132
138
|
sanitizeFlags(flags) {
|
|
133
|
-
const { platform, verbose, wait, profile, 'non-interactive': nonInteractive, 'verbose-fastlane': isVerboseFastlaneEnabled, groups, 'what-to-test': whatToTest, ...archiveFlags } = flags;
|
|
139
|
+
const { platform, verbose, wait, profile, 'non-interactive': nonInteractive, 'auto-testflight-setup': autoTestFlightSetup, 'verbose-fastlane': isVerboseFastlaneEnabled, groups, 'what-to-test': whatToTest, ...archiveFlags } = flags;
|
|
134
140
|
if (!flags.platform && nonInteractive) {
|
|
135
141
|
core_1.Errors.error('--platform is required when building in non-interactive mode', { exit: 1 });
|
|
136
142
|
}
|
|
@@ -145,6 +151,7 @@ class Submit extends EasCommand_1.default {
|
|
|
145
151
|
wait,
|
|
146
152
|
profile,
|
|
147
153
|
nonInteractive,
|
|
154
|
+
autoTestFlightSetup,
|
|
148
155
|
whatToTest,
|
|
149
156
|
isVerboseFastlaneEnabled,
|
|
150
157
|
groups,
|
|
@@ -453,7 +453,7 @@ class UpdatePublish extends EasCommand_1.default {
|
|
|
453
453
|
}
|
|
454
454
|
log_1.default.addNewLineIfNone();
|
|
455
455
|
for (const runtime of (0, uniqBy_1.default)(runtimeToPlatformsAndFingerprintInfoMapping, version => version.runtimeVersion)) {
|
|
456
|
-
const newUpdatesForRuntimeVersion = newUpdates.filter(update => update.
|
|
456
|
+
const newUpdatesForRuntimeVersion = newUpdates.filter(update => update.runtime.version === runtime.runtimeVersion);
|
|
457
457
|
if (newUpdatesForRuntimeVersion.length === 0) {
|
|
458
458
|
throw new Error(`Publish response is missing updates with runtime ${runtime.runtimeVersion}.`);
|
|
459
459
|
}
|
|
@@ -193,7 +193,7 @@ class UpdateRevertUpdateRollout extends EasCommand_1.default {
|
|
|
193
193
|
rolloutUpdateGroup,
|
|
194
194
|
});
|
|
195
195
|
const platforms = rolloutUpdateGroup.map(update => update.platform);
|
|
196
|
-
const runtimeVersion = rolloutUpdateGroup[0].
|
|
196
|
+
const runtimeVersion = rolloutUpdateGroup[0].runtime.version;
|
|
197
197
|
const targetBranch = {
|
|
198
198
|
name: rolloutUpdateGroup[0].branchName,
|
|
199
199
|
id: rolloutUpdateGroup[0].branchId,
|
|
@@ -115,7 +115,7 @@ async function getSourceUpdateGroupAsync(graphqlClient, groupId) {
|
|
|
115
115
|
return {
|
|
116
116
|
groupId,
|
|
117
117
|
branchName: arbitraryUpdate.branch.name,
|
|
118
|
-
runtimeVersion: arbitraryUpdate.
|
|
118
|
+
runtimeVersion: arbitraryUpdate.runtime.version,
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
121
|
async function getPreviousUpdateGroupAsync(graphqlClient, projectId, sourceGroup) {
|
|
@@ -38,18 +38,22 @@ exports.AppleDeviceQuery = {
|
|
|
38
38
|
account {
|
|
39
39
|
byName(accountName: $accountName) {
|
|
40
40
|
id
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
appleTeamsPaginated(first: 1, filter: { appleTeamIdentifier: $appleTeamIdentifier }) {
|
|
42
|
+
edges {
|
|
43
|
+
node {
|
|
44
|
+
id
|
|
45
|
+
appleTeamIdentifier
|
|
46
|
+
appleTeamName
|
|
47
|
+
appleDevices(offset: $offset, limit: $limit) {
|
|
48
|
+
id
|
|
49
|
+
identifier
|
|
50
|
+
name
|
|
51
|
+
deviceClass
|
|
52
|
+
enabled
|
|
53
|
+
model
|
|
54
|
+
createdAt
|
|
55
|
+
}
|
|
56
|
+
}
|
|
53
57
|
}
|
|
54
58
|
}
|
|
55
59
|
}
|
|
@@ -59,7 +63,10 @@ exports.AppleDeviceQuery = {
|
|
|
59
63
|
additionalTypenames: ['AppleDevice', 'AppleTeam'],
|
|
60
64
|
})
|
|
61
65
|
.toPromise());
|
|
62
|
-
const
|
|
66
|
+
const appleTeam = data.account.byName.appleTeamsPaginated.edges[0]?.node;
|
|
67
|
+
if (!appleTeam) {
|
|
68
|
+
throw new Error(`Could not find Apple team with the identifier ${appleTeamIdentifier} on account ${accountName}`);
|
|
69
|
+
}
|
|
63
70
|
const { appleDevices } = appleTeam;
|
|
64
71
|
if (!appleDevices) {
|
|
65
72
|
throw new Error(`Could not find devices on Apple team -- ${(0, AppleTeamFormatting_1.formatAppleTeam)(appleTeam)}`);
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import { ExpoGraphqlClient } from '../../../../../commandUtils/context/contextUtils/createGraphqlClient';
|
|
2
|
-
import {
|
|
2
|
+
import { AppleTeamFilterInput, AppleTeamFragment } from '../../../../../graphql/generated';
|
|
3
|
+
import { Connection } from '../../../../../utils/relay';
|
|
3
4
|
export declare const AppleTeamQuery: {
|
|
4
|
-
getAllForAccountAsync(graphqlClient: ExpoGraphqlClient, { accountName, offset, limit }:
|
|
5
|
+
getAllForAccountAsync(graphqlClient: ExpoGraphqlClient, { accountName, offset, limit, }: {
|
|
6
|
+
accountName: string;
|
|
7
|
+
offset?: number | null;
|
|
8
|
+
limit?: number | null;
|
|
9
|
+
}): Promise<AppleTeamFragment[]>;
|
|
10
|
+
getAllForAccountPaginatedAsync(graphqlClient: ExpoGraphqlClient, accountName: string, { after, first, before, last, filter, }: {
|
|
11
|
+
after?: string;
|
|
12
|
+
first?: number;
|
|
13
|
+
before?: string;
|
|
14
|
+
last?: number;
|
|
15
|
+
filter?: AppleTeamFilterInput;
|
|
16
|
+
}): Promise<Connection<AppleTeamFragment>>;
|
|
5
17
|
getByAppleTeamIdentifierAsync(graphqlClient: ExpoGraphqlClient, accountId: string, appleTeamIdentifier: string): Promise<AppleTeamFragment | null>;
|
|
6
18
|
};
|
|
@@ -7,26 +7,66 @@ const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
|
|
|
7
7
|
const client_1 = require("../../../../../graphql/client");
|
|
8
8
|
const AppleTeam_1 = require("../../../../../graphql/types/credentials/AppleTeam");
|
|
9
9
|
exports.AppleTeamQuery = {
|
|
10
|
-
async getAllForAccountAsync(graphqlClient, { accountName, offset, limit }) {
|
|
10
|
+
async getAllForAccountAsync(graphqlClient, { accountName, offset, limit, }) {
|
|
11
|
+
// appleTeamsPaginated is cursor-based, so emulate offset/limit by fetching
|
|
12
|
+
// pages from the start until enough nodes are collected
|
|
13
|
+
const start = offset ?? 0;
|
|
14
|
+
const teams = [];
|
|
15
|
+
let after;
|
|
16
|
+
while (limit == null || teams.length < start + limit) {
|
|
17
|
+
const connection = await exports.AppleTeamQuery.getAllForAccountPaginatedAsync(graphqlClient, accountName, { first: 100, after });
|
|
18
|
+
teams.push(...connection.edges.map(edge => edge.node));
|
|
19
|
+
if (!connection.pageInfo.hasNextPage) {
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
after = connection.pageInfo.endCursor ?? undefined;
|
|
23
|
+
}
|
|
24
|
+
return limit == null ? teams.slice(start) : teams.slice(start, start + limit);
|
|
25
|
+
},
|
|
26
|
+
async getAllForAccountPaginatedAsync(graphqlClient, accountName, { after, first, before, last, filter, }) {
|
|
11
27
|
const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
|
|
12
28
|
.query((0, graphql_tag_1.default) `
|
|
13
|
-
query
|
|
29
|
+
query AppleTeamsPaginatedByAccountQuery(
|
|
30
|
+
$accountName: String!
|
|
31
|
+
$after: String
|
|
32
|
+
$first: Int
|
|
33
|
+
$before: String
|
|
34
|
+
$last: Int
|
|
35
|
+
$filter: AppleTeamFilterInput
|
|
36
|
+
) {
|
|
14
37
|
account {
|
|
15
38
|
byName(accountName: $accountName) {
|
|
16
39
|
id
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
40
|
+
appleTeamsPaginated(
|
|
41
|
+
after: $after
|
|
42
|
+
first: $first
|
|
43
|
+
before: $before
|
|
44
|
+
last: $last
|
|
45
|
+
filter: $filter
|
|
46
|
+
) {
|
|
47
|
+
edges {
|
|
48
|
+
cursor
|
|
49
|
+
node {
|
|
50
|
+
id
|
|
51
|
+
...AppleTeamFragment
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
pageInfo {
|
|
55
|
+
hasNextPage
|
|
56
|
+
hasPreviousPage
|
|
57
|
+
startCursor
|
|
58
|
+
endCursor
|
|
59
|
+
}
|
|
20
60
|
}
|
|
21
61
|
}
|
|
22
62
|
}
|
|
23
63
|
}
|
|
24
64
|
${(0, graphql_1.print)(AppleTeam_1.AppleTeamFragmentNode)}
|
|
25
|
-
`, { accountName,
|
|
65
|
+
`, { accountName, after, first, before, last, filter }, {
|
|
26
66
|
additionalTypenames: ['AppleTeam'],
|
|
27
67
|
})
|
|
28
68
|
.toPromise());
|
|
29
|
-
return data.account.byName.
|
|
69
|
+
return data.account.byName.appleTeamsPaginated;
|
|
30
70
|
},
|
|
31
71
|
async getByAppleTeamIdentifierAsync(graphqlClient, accountId, appleTeamIdentifier) {
|
|
32
72
|
const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
|
|
@@ -3,4 +3,6 @@ import { App } from '@expo/apple-utils';
|
|
|
3
3
|
* Ensure a TestFlight internal group with access to all builds exists for the app and has all admin users invited to it.
|
|
4
4
|
* This allows users to instantly access their builds from TestFlight after it finishes processing.
|
|
5
5
|
*/
|
|
6
|
-
export declare function ensureTestFlightGroupExistsAsync(app: App
|
|
6
|
+
export declare function ensureTestFlightGroupExistsAsync(app: App, { nonInteractive }?: {
|
|
7
|
+
nonInteractive?: boolean;
|
|
8
|
+
}): Promise<void>;
|
|
@@ -13,11 +13,7 @@ const AUTO_GROUP_NAME = 'Team (Expo)';
|
|
|
13
13
|
* Ensure a TestFlight internal group with access to all builds exists for the app and has all admin users invited to it.
|
|
14
14
|
* This allows users to instantly access their builds from TestFlight after it finishes processing.
|
|
15
15
|
*/
|
|
16
|
-
async function ensureTestFlightGroupExistsAsync(app) {
|
|
17
|
-
if (process.env.EAS_NO_AUTO_TESTFLIGHT_SETUP) {
|
|
18
|
-
log_1.default.debug('EAS_NO_AUTO_TESTFLIGHT_SETUP is set, skipping TestFlight setup');
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
16
|
+
async function ensureTestFlightGroupExistsAsync(app, { nonInteractive = false } = {}) {
|
|
21
17
|
const groups = await app.getBetaGroupsAsync({
|
|
22
18
|
query: {
|
|
23
19
|
includes: ['betaTesters'],
|
|
@@ -31,12 +27,13 @@ async function ensureTestFlightGroupExistsAsync(app) {
|
|
|
31
27
|
const group = await ensureInternalGroupAsync({
|
|
32
28
|
app,
|
|
33
29
|
groups,
|
|
30
|
+
nonInteractive,
|
|
34
31
|
});
|
|
35
32
|
const users = await apple_utils_1.User.getAsync(app.context);
|
|
36
33
|
const admins = users.filter(user => user.attributes.roles?.includes(apple_utils_1.UserRole.ADMIN));
|
|
37
|
-
await addAllUsersToInternalGroupAsync(group, admins);
|
|
34
|
+
await addAllUsersToInternalGroupAsync(group, admins, app);
|
|
38
35
|
}
|
|
39
|
-
async function ensureInternalGroupAsync({ groups, app, }) {
|
|
36
|
+
async function ensureInternalGroupAsync({ groups, app, nonInteractive, }) {
|
|
40
37
|
let betaGroup = groups.find(group => group.attributes.name === AUTO_GROUP_NAME);
|
|
41
38
|
if (!betaGroup) {
|
|
42
39
|
const spinner = (0, ora_1.ora)().start('Creating TestFlight group...');
|
|
@@ -70,6 +67,11 @@ async function ensureInternalGroupAsync({ groups, app, }) {
|
|
|
70
67
|
}
|
|
71
68
|
// `hasAccessToAllBuilds` is a newer feature that allows the group to automatically have access to all builds. This cannot be patched so we need to recreate the group.
|
|
72
69
|
if (!betaGroup.attributes.hasAccessToAllBuilds) {
|
|
70
|
+
if (nonInteractive) {
|
|
71
|
+
// Deleting a group is destructive, so it needs explicit confirmation.
|
|
72
|
+
log_1.default.warn(`TestFlight group "${AUTO_GROUP_NAME}" does not have automatic access to new builds. Re-run in interactive mode to regenerate it, or recreate it in App Store Connect.`);
|
|
73
|
+
return betaGroup;
|
|
74
|
+
}
|
|
73
75
|
if (await (0, prompts_1.confirmAsync)({
|
|
74
76
|
message: 'Regenerate internal TestFlight group to allow automatic access to all builds?',
|
|
75
77
|
})) {
|
|
@@ -81,12 +83,13 @@ async function ensureInternalGroupAsync({ groups, app, }) {
|
|
|
81
83
|
includes: ['betaTesters'],
|
|
82
84
|
},
|
|
83
85
|
}),
|
|
86
|
+
nonInteractive,
|
|
84
87
|
});
|
|
85
88
|
}
|
|
86
89
|
}
|
|
87
90
|
return betaGroup;
|
|
88
91
|
}
|
|
89
|
-
async function addAllUsersToInternalGroupAsync(group, users) {
|
|
92
|
+
async function addAllUsersToInternalGroupAsync(group, users, app) {
|
|
90
93
|
let emails = users
|
|
91
94
|
.filter(user => user.attributes.email)
|
|
92
95
|
.map(user => ({
|
|
@@ -128,7 +131,7 @@ async function addAllUsersToInternalGroupAsync(group, users) {
|
|
|
128
131
|
return true;
|
|
129
132
|
});
|
|
130
133
|
if (!success) {
|
|
131
|
-
const groupUrl = await getTestFlightGroupUrlAsync(group);
|
|
134
|
+
const groupUrl = await getTestFlightGroupUrlAsync(group, app);
|
|
132
135
|
log_1.default.error(`Unable to add all admins to TestFlight group "${group.attributes.name}". You can add them manually in App Store Connect. ${groupUrl ?? ''}`);
|
|
133
136
|
}
|
|
134
137
|
else {
|
|
@@ -140,11 +143,11 @@ async function addAllUsersToInternalGroupAsync(group, users) {
|
|
|
140
143
|
// TODO: When we have more TestFlight functionality, we can link to it from here.
|
|
141
144
|
}
|
|
142
145
|
}
|
|
143
|
-
async function getTestFlightGroupUrlAsync(group) {
|
|
146
|
+
async function getTestFlightGroupUrlAsync(group, app) {
|
|
144
147
|
if (group.context.providerId) {
|
|
145
148
|
try {
|
|
146
149
|
const session = await apple_utils_1.Session.getSessionForProviderIdAsync(group.context.providerId);
|
|
147
|
-
return `https://appstoreconnect.apple.com/teams/${session.provider.publicProviderId}/apps/
|
|
150
|
+
return `https://appstoreconnect.apple.com/teams/${session.provider.publicProviderId}/apps/${app.id}/testflight/groups/${group.id}`;
|
|
148
151
|
}
|
|
149
152
|
catch (error) {
|
|
150
153
|
// Avoid crashing if we can't get the session.
|