eas-cli 21.7.1 → 22.0.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.
Files changed (90) hide show
  1. package/README.md +258 -153
  2. package/build/build/android/prepareJob.js +1 -0
  3. package/build/build/ios/prepareJob.js +1 -0
  4. package/build/build/metadata.js +0 -1
  5. package/build/build/runBuildAndSubmit.js +1 -1
  6. package/build/build/utils/formatBuild.js +2 -2
  7. package/build/build/utils/url.js +3 -5
  8. package/build/commandUtils/context/contextUtils/getProjectIdAsync.js +10 -3
  9. package/build/commandUtils/new/configs.js +1 -1
  10. package/build/commandUtils/supabase.d.ts +13 -0
  11. package/build/commandUtils/supabase.js +82 -0
  12. package/build/commands/account/view.js +1 -2
  13. package/build/commands/build/cancel.js +3 -3
  14. package/build/commands/build/download.js +1 -1
  15. package/build/commands/go.js +2 -45
  16. package/build/commands/integrations/supabase/connect.d.ts +26 -0
  17. package/build/commands/integrations/supabase/connect.js +404 -0
  18. package/build/commands/integrations/supabase/dashboard.d.ts +14 -0
  19. package/build/commands/integrations/supabase/dashboard.js +69 -0
  20. package/build/commands/integrations/supabase/disconnect.d.ts +15 -0
  21. package/build/commands/integrations/supabase/disconnect.js +87 -0
  22. package/build/commands/project/icon/set.js +4 -40
  23. package/build/commands/project/init.d.ts +1 -0
  24. package/build/commands/project/init.js +13 -0
  25. package/build/commands/submit.d.ts +1 -0
  26. package/build/commands/submit.js +8 -1
  27. package/build/commands/update/index.js +1 -1
  28. package/build/commands/update/revert-update-rollout.js +1 -1
  29. package/build/commands/update/rollback.js +1 -1
  30. package/build/credentials/ios/api/graphql/queries/AppleDeviceQuery.js +20 -13
  31. package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.d.ts +14 -2
  32. package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.js +47 -7
  33. package/build/credentials/ios/appstore/ensureTestFlightGroup.d.ts +3 -1
  34. package/build/credentials/ios/appstore/ensureTestFlightGroup.js +14 -11
  35. package/build/environments/defaults.d.ts +2 -0
  36. package/build/environments/defaults.js +5 -0
  37. package/build/environments/resolve.d.ts +10 -0
  38. package/build/environments/resolve.js +67 -0
  39. package/build/environments/variables.d.ts +18 -0
  40. package/build/environments/variables.js +124 -0
  41. package/build/graphql/client.d.ts +8 -0
  42. package/build/graphql/client.js +15 -0
  43. package/build/graphql/generated.d.ts +824 -948
  44. package/build/graphql/generated.js +12 -2
  45. package/build/graphql/mutations/SupabaseMutation.d.ts +14 -0
  46. package/build/graphql/mutations/SupabaseMutation.js +145 -0
  47. package/build/graphql/queries/ChannelInsightsQuery.js +4 -1
  48. package/build/graphql/queries/SupabaseQuery.d.ts +10 -0
  49. package/build/graphql/queries/SupabaseQuery.js +54 -0
  50. package/build/graphql/types/Account.js +1 -4
  51. package/build/graphql/types/Build.js +13 -8
  52. package/build/graphql/types/Submission.js +0 -1
  53. package/build/graphql/types/SupabaseConnection.d.ts +8 -0
  54. package/build/graphql/types/SupabaseConnection.js +25 -0
  55. package/build/graphql/types/Update.js +4 -1
  56. package/build/integrations/shared/envFile.d.ts +7 -0
  57. package/build/integrations/shared/envFile.js +94 -0
  58. package/build/integrations/shared/sdk.d.ts +24 -0
  59. package/build/integrations/shared/sdk.js +87 -0
  60. package/build/integrations/supabase/env.d.ts +14 -0
  61. package/build/integrations/supabase/env.js +68 -0
  62. package/build/integrations/supabase/provision.d.ts +32 -0
  63. package/build/integrations/supabase/provision.js +245 -0
  64. package/build/project/accountSelection.js +1 -3
  65. package/build/project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync.js +3 -5
  66. package/build/project/projectIcon.d.ts +40 -0
  67. package/build/project/projectIcon.js +132 -0
  68. package/build/project/projectNotConfiguredError.d.ts +17 -0
  69. package/build/project/projectNotConfiguredError.js +24 -0
  70. package/build/submit/ArchiveSource.js +3 -3
  71. package/build/submit/context.d.ts +2 -0
  72. package/build/submit/context.js +1 -0
  73. package/build/submit/ios/AppProduce.js +1 -1
  74. package/build/submit/ios/IosSubmitCommand.js +2 -0
  75. package/build/submit/ios/ensureTestFlightSetup.d.ts +7 -0
  76. package/build/submit/ios/ensureTestFlightSetup.js +81 -0
  77. package/build/submit/status.js +1 -1
  78. package/build/submit/utils/formatSubmission.js +2 -2
  79. package/build/update/queries.js +1 -1
  80. package/build/update/republish.js +3 -3
  81. package/build/update/roll-back-to-embedded.js +1 -1
  82. package/build/update/utils.d.ts +2 -1
  83. package/build/update/utils.js +7 -7
  84. package/build/user/User.js +1 -1
  85. package/build/utils/pollForBackgroundJobReceiptAsync.d.ts +2 -0
  86. package/build/utils/pollForBackgroundJobReceiptAsync.js +11 -2
  87. package/build/utils/prompts.d.ts +0 -1
  88. package/build/utils/prompts.js +6 -17
  89. package/oclif.manifest.json +1725 -1411
  90. package/package.json +6 -6
@@ -3,21 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const core_1 = require("@oclif/core");
5
5
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
- const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
7
- const path_1 = tslib_1.__importDefault(require("path"));
8
6
  const url_1 = require("../../../build/utils/url");
9
7
  const EasCommand_1 = tslib_1.__importDefault(require("../../../commandUtils/EasCommand"));
10
8
  const flags_1 = require("../../../commandUtils/flags");
11
- const generated_1 = require("../../../graphql/generated");
12
9
  const AppQuery_1 = require("../../../graphql/queries/AppQuery");
13
10
  const log_1 = tslib_1.__importStar(require("../../../log"));
14
11
  const ora_1 = require("../../../ora");
15
- const uploads_1 = require("../../../uploads");
16
- const promise_1 = require("../../../utils/promise");
17
- const ALLOWED_EXTENSIONS = ['.png', '.jpg', '.jpeg'];
18
- const MAX_IMAGE_SIZE_BYTES = 10 * 1024 * 1024; // matches the upload session's GCS limit
19
- const POLL_INTERVAL_MS = 2000;
20
- const POLL_TIMEOUT_MS = 90_000;
12
+ const projectIcon_1 = require("../../../project/projectIcon");
21
13
  class ProjectIconSet extends EasCommand_1.default {
22
14
  static description = 'set the project icon displayed on the EAS dashboard';
23
15
  static args = {
@@ -38,21 +30,17 @@ class ProjectIconSet extends EasCommand_1.default {
38
30
  const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(ProjectIconSet, {
39
31
  nonInteractive: flags['non-interactive'],
40
32
  });
41
- await validateImageAsync(imagePath);
33
+ await (0, projectIcon_1.validateIconAsync)(imagePath);
42
34
  const app = await AppQuery_1.AppQuery.byIdAsync(graphqlClient, projectId);
43
35
  const projectDashboardUrl = (0, url_1.getProjectDashboardUrl)(app.ownerAccount.name, app.slug);
44
36
  const previousProfileImageUrl = await AppQuery_1.AppQuery.byIdProfileImageUrlAsync(graphqlClient, projectId);
45
37
  const spinner = (0, ora_1.ora)('Uploading project icon').start();
46
38
  try {
47
- await (0, uploads_1.uploadAppScopedFileAtPathToGCSAsync)(graphqlClient, {
48
- type: generated_1.AppUploadSessionType.ProfileImageUpload,
49
- appId: projectId,
50
- path: imagePath,
51
- });
39
+ await (0, projectIcon_1.uploadProjectIconAsync)(graphqlClient, { projectId, imagePath });
52
40
  // The icon is processed asynchronously (resized and assigned to the
53
41
  // project by the server), so poll until the icon URL changes.
54
42
  spinner.text = 'Processing project icon';
55
- await pollForProfileImageChangeAsync(graphqlClient, {
43
+ await (0, projectIcon_1.pollForProfileImageChangeAsync)(graphqlClient, {
56
44
  projectId,
57
45
  previousProfileImageUrl,
58
46
  projectDashboardUrl,
@@ -67,27 +55,3 @@ class ProjectIconSet extends EasCommand_1.default {
67
55
  }
68
56
  }
69
57
  exports.default = ProjectIconSet;
70
- async function validateImageAsync(imagePath) {
71
- if (!(await fs_extra_1.default.pathExists(imagePath))) {
72
- throw new Error(`No file found at ${imagePath}`);
73
- }
74
- const extension = path_1.default.extname(imagePath).toLowerCase();
75
- if (!ALLOWED_EXTENSIONS.includes(extension)) {
76
- throw new Error(`Unsupported image format "${extension}". The icon must be a PNG or JPEG file.`);
77
- }
78
- const { size } = await fs_extra_1.default.stat(imagePath);
79
- if (size > MAX_IMAGE_SIZE_BYTES) {
80
- throw new Error(`The image is ${(size / 1024 / 1024).toFixed(1)} MB, but the maximum allowed size is 10 MB.`);
81
- }
82
- }
83
- async function pollForProfileImageChangeAsync(graphqlClient, { projectId, previousProfileImageUrl, projectDashboardUrl, }) {
84
- const startTime = Date.now();
85
- while (Date.now() - startTime < POLL_TIMEOUT_MS) {
86
- await (0, promise_1.sleepAsync)(POLL_INTERVAL_MS);
87
- const profileImageUrl = await AppQuery_1.AppQuery.byIdProfileImageUrlAsync(graphqlClient, projectId);
88
- if (profileImageUrl && profileImageUrl !== previousProfileImageUrl) {
89
- return;
90
- }
91
- }
92
- throw new Error(`Timed out waiting for the icon to be processed. It may still appear on the project page shortly: ${chalk_1.default.underline(projectDashboardUrl)}`);
93
- }
@@ -9,6 +9,7 @@ export default class ProjectInit extends EasCommand {
9
9
  id: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
10
10
  account: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
11
11
  force: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
+ icon: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
12
13
  };
13
14
  static contextDefinition: {
14
15
  projectDir: import("../../commandUtils/context/ProjectDirContextField").default;
@@ -5,6 +5,7 @@ const core_1 = require("@oclif/core");
5
5
  const url_1 = require("../../build/utils/url");
6
6
  const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
7
7
  const flags_1 = require("../../commandUtils/flags");
8
+ const projectIcon_1 = require("../../project/projectIcon");
8
9
  const projectInitialization_1 = require("../../project/projectInitialization");
9
10
  const json_1 = require("../../utils/json");
10
11
  class ProjectInit extends EasCommand_1.default {
@@ -27,6 +28,11 @@ class ProjectInit extends EasCommand_1.default {
27
28
  force: core_1.Flags.boolean({
28
29
  description: 'Whether to create a new project/link an existing project without additional prompts or overwrite any existing project ID when running with --id flag',
29
30
  }),
31
+ icon: core_1.Flags.boolean({
32
+ description: 'Set the icon shown on the EAS dashboard from the app config, when the project does not have one yet',
33
+ default: true,
34
+ allowNo: true,
35
+ }),
30
36
  ...flags_1.EasNonInteractiveAndJsonFlags,
31
37
  };
32
38
  static contextDefinition = {
@@ -60,6 +66,12 @@ class ProjectInit extends EasCommand_1.default {
60
66
  force,
61
67
  nonInteractive,
62
68
  });
69
+ const iconResult = flags.icon
70
+ ? await (0, projectIcon_1.maybeSetProjectIconFromAppConfigAsync)(graphqlClient, {
71
+ projectId: result.projectId,
72
+ projectDir,
73
+ })
74
+ : null;
63
75
  if (jsonFlag) {
64
76
  (0, json_1.printJsonOnlyOutput)({
65
77
  status: result.status,
@@ -67,6 +79,7 @@ class ProjectInit extends EasCommand_1.default {
67
79
  owner,
68
80
  slug,
69
81
  dashboardUrl: (0, url_1.getProjectDashboardUrl)(owner, slug),
82
+ ...(iconResult?.status === 'set' ? { icon: { source: iconResult.icon.field } } : {}),
70
83
  });
71
84
  }
72
85
  }
@@ -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;
@@ -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.runtimeVersion === runtime.runtimeVersion);
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].runtimeVersion;
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.runtimeVersion,
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
- appleTeams(appleTeamIdentifier: $appleTeamIdentifier) {
42
- id
43
- appleTeamIdentifier
44
- appleTeamName
45
- appleDevices(offset: $offset, limit: $limit) {
46
- id
47
- identifier
48
- name
49
- deviceClass
50
- enabled
51
- model
52
- createdAt
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 [appleTeam] = data.account.byName.appleTeams;
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 { AppleTeamFragment, AppleTeamsByAccountNameQueryVariables } from '../../../../../graphql/generated';
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 }: AppleTeamsByAccountNameQueryVariables): Promise<AppleTeamFragment[]>;
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 AppleTeamsByAccountName($accountName: String!, $offset: Int, $limit: Int) {
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
- appleTeams(offset: $offset, limit: $limit) {
18
- id
19
- ...AppleTeamFragment
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, offset, limit }, {
65
+ `, { accountName, after, first, before, last, filter }, {
26
66
  additionalTypenames: ['AppleTeam'],
27
67
  })
28
68
  .toPromise());
29
- return data.account.byName.appleTeams ?? [];
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): Promise<void>;
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/6741088859/testflight/groups/${group.id}`;
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.
@@ -0,0 +1,2 @@
1
+ import { DefaultEnvironment } from '../build/utils/environment';
2
+ export declare const DEFAULT_ENVIRONMENTS: DefaultEnvironment[];
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_ENVIRONMENTS = void 0;
4
+ const environment_1 = require("../build/utils/environment");
5
+ exports.DEFAULT_ENVIRONMENTS = Object.values(environment_1.DefaultEnvironment);
@@ -0,0 +1,10 @@
1
+ import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
2
+ export declare function parseEnvironmentFlag(value: string | undefined): string[] | null;
3
+ /**
4
+ * Resolve requested EAS environment names against what the project already uses.
5
+ * Shared across integrations; pass integration-specific defaults and messages at each callsite.
6
+ */
7
+ export declare function resolveTargetEnvironmentsAsync(graphqlClient: ExpoGraphqlClient, projectId: string, requested: string[], nonInteractive: boolean, { defaultEnvironments, cancelMessage, }: {
8
+ defaultEnvironments: string[];
9
+ cancelMessage: (knownEnvironments: string) => string;
10
+ }): Promise<string[]>;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseEnvironmentFlag = parseEnvironmentFlag;
4
+ exports.resolveTargetEnvironmentsAsync = resolveTargetEnvironmentsAsync;
5
+ const prompts_1 = require("../prompts");
6
+ const variables_1 = require("./variables");
7
+ function parseEnvironmentFlag(value) {
8
+ if (value === undefined) {
9
+ return null;
10
+ }
11
+ if (!value.trim()) {
12
+ throw new Error('Pass at least one EAS environment to --environment (e.g. --environment preview).');
13
+ }
14
+ const environments = [
15
+ ...new Set(value
16
+ .split(',')
17
+ .map(part => part.trim().toLowerCase())
18
+ .filter(Boolean)),
19
+ ];
20
+ if (environments.length === 0) {
21
+ throw new Error('Pass at least one EAS environment to --environment (e.g. --environment preview).');
22
+ }
23
+ for (const environment of environments) {
24
+ if (environment.length < 3 || environment.length > 100 || !/^[a-z0-9_-]+$/.test(environment)) {
25
+ throw new Error(`Invalid EAS environment "${environment}". Use 3–100 lowercase letters, numbers, dashes, or underscores.`);
26
+ }
27
+ }
28
+ return environments;
29
+ }
30
+ /**
31
+ * Resolve requested EAS environment names against what the project already uses.
32
+ * Shared across integrations; pass integration-specific defaults and messages at each callsite.
33
+ */
34
+ async function resolveTargetEnvironmentsAsync(graphqlClient, projectId, requested, nonInteractive, { defaultEnvironments, cancelMessage, }) {
35
+ let known = await (0, variables_1.getProjectEnvironmentVariableEnvironmentsAsync)(graphqlClient, projectId);
36
+ if (known.length === 0) {
37
+ known = [...defaultEnvironments];
38
+ }
39
+ const knownSet = new Set(known);
40
+ const unknown = requested.filter(environment => !knownSet.has(environment));
41
+ if (unknown.length === 0) {
42
+ return requested;
43
+ }
44
+ const defaultEnvironmentSet = new Set(defaultEnvironments);
45
+ const hasCustom = unknown.some(environment => !defaultEnvironmentSet.has(environment));
46
+ if (nonInteractive) {
47
+ const hint = hasCustom
48
+ ? 'Custom environments require an Enterprise plan; pass only default environments, or upgrade.'
49
+ : 'Re-run interactively to create them, or pass only existing environments.';
50
+ throw new Error(`EAS environment(s) not found on this project: ${unknown.join(', ')}. Known: ${known.join(', ')}. ${hint}`);
51
+ }
52
+ const listed = unknown.map(environment => `"${environment}"`).join(', ');
53
+ const isPlural = unknown.length > 1;
54
+ const noun = isPlural ? 'environments' : 'environment';
55
+ const verb = isPlural ? 'are' : 'is';
56
+ const customHint = hasCustom
57
+ ? ' Custom environments require an Enterprise plan; values will be written if your account supports them.'
58
+ : '';
59
+ const create = await (0, prompts_1.confirmAsync)({
60
+ message: `EAS ${noun} ${listed} ${verb} not used on this project yet.${customHint} Continue provisioning?`,
61
+ });
62
+ if (!create) {
63
+ throw new Error(cancelMessage(known.join(', ')));
64
+ }
65
+ // Custom environments are created lazily when env vars are written (createForAppAsync).
66
+ return requested;
67
+ }
@@ -0,0 +1,18 @@
1
+ import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
2
+ import { EnvironmentVariableVisibility } from '../graphql/generated';
3
+ import { EnvironmentVariablesQuery } from '../graphql/queries/EnvironmentVariablesQuery';
4
+ export type EnvVar = {
5
+ name: string;
6
+ value: string;
7
+ visibility: EnvironmentVariableVisibility;
8
+ };
9
+ type ProjectScopedEnvVar = Awaited<ReturnType<typeof EnvironmentVariablesQuery.byAppIdAsync>>[number];
10
+ export type EnvVarWriteMode = 'replaceOtherEnvironments' | 'keepOtherEnvironments';
11
+ export declare function getProjectEnvironmentVariableEnvironmentsAsync(graphqlClient: ExpoGraphqlClient, projectId: string): Promise<string[]>;
12
+ export declare function loadProjectScopedEnvVarsAsync(graphqlClient: ExpoGraphqlClient, projectId: string, name: string): Promise<ProjectScopedEnvVar[]>;
13
+ export declare function upsertEnvVarAsync(graphqlClient: ExpoGraphqlClient, projectId: string, envVar: EnvVar, environments: string[], nonInteractive: boolean, overwrite: boolean, { mode, moveConfirmMessage, }: {
14
+ mode: EnvVarWriteMode;
15
+ moveConfirmMessage?: (variableName: string, overlappingEnvironments: string) => string;
16
+ }): Promise<boolean>;
17
+ export declare function upsertEnvVarsSequentiallyAsync(envVars: EnvVar[], upsert: (envVar: EnvVar) => Promise<boolean>): Promise<boolean[]>;
18
+ export {};