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.
Files changed (68) hide show
  1. package/README.md +209 -186
  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/commands/account/view.js +1 -2
  11. package/build/commands/build/cancel.js +3 -3
  12. package/build/commands/build/download.js +1 -1
  13. package/build/commands/fingerprint/compare.js +100 -48
  14. package/build/commands/go.d.ts +1 -0
  15. package/build/commands/go.js +10 -47
  16. package/build/commands/project/icon/set.js +4 -40
  17. package/build/commands/project/init.d.ts +1 -0
  18. package/build/commands/project/init.js +13 -0
  19. package/build/commands/simulator/availability.js +2 -1
  20. package/build/commands/simulator/index.d.ts +1 -0
  21. package/build/commands/simulator/index.js +10 -5
  22. package/build/commands/simulator/stop.js +1 -0
  23. package/build/commands/submit.d.ts +1 -0
  24. package/build/commands/submit.js +8 -1
  25. package/build/commands/update/index.js +1 -1
  26. package/build/commands/update/revert-update-rollout.js +1 -1
  27. package/build/commands/update/rollback.js +1 -1
  28. package/build/credentials/ios/api/graphql/queries/AppleDeviceQuery.js +20 -13
  29. package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.d.ts +14 -2
  30. package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.js +47 -7
  31. package/build/credentials/ios/appstore/ensureTestFlightGroup.d.ts +3 -1
  32. package/build/credentials/ios/appstore/ensureTestFlightGroup.js +14 -11
  33. package/build/graphql/generated.d.ts +703 -932
  34. package/build/graphql/generated.js +16 -2
  35. package/build/graphql/queries/ChannelInsightsQuery.js +4 -1
  36. package/build/graphql/queries/DeviceRunSessionQuery.js +5 -0
  37. package/build/graphql/types/Account.js +1 -4
  38. package/build/graphql/types/Build.js +13 -8
  39. package/build/graphql/types/Submission.js +0 -1
  40. package/build/graphql/types/Update.js +4 -1
  41. package/build/project/accountSelection.js +1 -3
  42. package/build/project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync.js +3 -5
  43. package/build/project/projectIcon.d.ts +40 -0
  44. package/build/project/projectIcon.js +132 -0
  45. package/build/project/projectNotConfiguredError.d.ts +17 -0
  46. package/build/project/projectNotConfiguredError.js +24 -0
  47. package/build/simulator/env.d.ts +1 -1
  48. package/build/simulator/env.js +12 -2
  49. package/build/simulator/utils.js +26 -0
  50. package/build/submit/ArchiveSource.js +3 -3
  51. package/build/submit/context.d.ts +2 -0
  52. package/build/submit/context.js +1 -0
  53. package/build/submit/ios/AppProduce.js +1 -1
  54. package/build/submit/ios/IosSubmitCommand.js +2 -0
  55. package/build/submit/ios/ensureTestFlightSetup.d.ts +7 -0
  56. package/build/submit/ios/ensureTestFlightSetup.js +81 -0
  57. package/build/submit/status.js +1 -1
  58. package/build/submit/utils/formatSubmission.js +2 -2
  59. package/build/update/queries.js +1 -1
  60. package/build/update/republish.js +3 -3
  61. package/build/update/roll-back-to-embedded.js +1 -1
  62. package/build/update/utils.d.ts +2 -1
  63. package/build/update/utils.js +7 -7
  64. package/build/uploads.d.ts +5 -0
  65. package/build/uploads.js +22 -0
  66. package/build/user/User.js +1 -1
  67. package/oclif.manifest.json +222 -186
  68. package/package.json +7 -7
@@ -83,6 +83,7 @@ async function prepareJobAsync(ctx, jobData) {
83
83
  }),
84
84
  experimental: {
85
85
  prebuildCommand: buildProfile.prebuildCommand,
86
+ uploadSourceMaps: buildProfile.uploadSourceMaps,
86
87
  },
87
88
  mode: buildMode,
88
89
  triggeredBy: eas_build_job_1.BuildTrigger.EAS_CLI,
@@ -78,6 +78,7 @@ async function prepareJobAsync(ctx, jobData) {
78
78
  }),
79
79
  experimental: {
80
80
  prebuildCommand: buildProfile.prebuildCommand,
81
+ uploadSourceMaps: buildProfile.uploadSourceMaps,
81
82
  },
82
83
  mode: buildMode,
83
84
  triggeredBy: eas_build_job_1.BuildTrigger.EAS_CLI,
@@ -60,7 +60,6 @@ async function collectMetadataAsync(ctx, runtimeAndFingerprintMetadata) {
60
60
  customWorkflowName: ctx.customBuildConfigMetadata?.workflowName,
61
61
  developmentClient: ctx.developmentClient,
62
62
  requiredPackageManager: ctx.requiredPackageManager ?? undefined,
63
- selectedImage: ctx.buildProfile.image,
64
63
  customNodeVersion: ctx.buildProfile.node,
65
64
  simulator: 'simulator' in ctx.buildProfile && ctx.buildProfile.simulator,
66
65
  };
@@ -369,7 +369,7 @@ function exitWithNonZeroCodeIfSomeBuildsFailed(maybeBuilds) {
369
369
  }
370
370
  async function downloadAndRunAsync(build, simulator) {
371
371
  (0, assert_1.default)(build.artifacts?.applicationArchiveUrl);
372
- const cachedAppPath = (0, run_1.getEasBuildRunCachedAppPath)(build.project.id, build.id, build.platform);
372
+ const cachedAppPath = (0, run_1.getEasBuildRunCachedAppPath)(build.app.id, build.id, build.platform);
373
373
  if (await (0, fs_extra_1.pathExists)(cachedAppPath)) {
374
374
  log_1.default.newLine();
375
375
  log_1.default.log(`Using cached app...`);
@@ -88,7 +88,7 @@ function formatGraphQLBuild(build) {
88
88
  },
89
89
  {
90
90
  label: 'Channel',
91
- value: build.channel,
91
+ value: build.updateChannel?.name,
92
92
  },
93
93
  {
94
94
  label: 'SDK Version',
@@ -96,7 +96,7 @@ function formatGraphQLBuild(build) {
96
96
  },
97
97
  {
98
98
  label: 'Runtime Version',
99
- value: build.runtimeVersion,
99
+ value: build.runtime?.version,
100
100
  },
101
101
  {
102
102
  label: 'Version',
@@ -23,10 +23,8 @@ function getProjectPageUrl(accountName, projectName, page) {
23
23
  return new URL(page ? `${projectPath}/${page}` : projectPath, (0, api_1.getExpoWebsiteBaseUrl)()).toString();
24
24
  }
25
25
  function getBuildLogsUrl(build, hash) {
26
- const { project } = build;
27
- const url = project.__typename !== 'App'
28
- ? `/builds/${build.id}`
29
- : `/accounts/${project.ownerAccount.name}/projects/${project.slug}/builds/${build.id}${hash ? `#${hash}` : ''}`;
26
+ const { app } = build;
27
+ const url = `/accounts/${app.ownerAccount.name}/projects/${app.slug}/builds/${build.id}${hash ? `#${hash}` : ''}`;
30
28
  return new URL(url, (0, api_1.getExpoWebsiteBaseUrl)()).toString();
31
29
  }
32
30
  function getArtifactUrl(artifactId) {
@@ -34,7 +32,7 @@ function getArtifactUrl(artifactId) {
34
32
  }
35
33
  function getInternalDistributionInstallUrl(build) {
36
34
  if (build.platform === generated_1.AppPlatform.Ios) {
37
- return `itms-services://?action=download-manifest;url=${(0, api_1.getExpoApiBaseUrl)()}/v2/projects/${build.project.id}/builds/${build.id}/manifest.plist`;
35
+ return `itms-services://?action=download-manifest;url=${(0, api_1.getExpoApiBaseUrl)()}/v2/projects/${build.app.id}/builds/${build.id}/manifest.plist`;
38
36
  }
39
37
  (0, assert_1.default)(build.artifacts?.buildUrl, 'buildUrl is missing');
40
38
  return build.artifacts.buildUrl;
@@ -15,6 +15,7 @@ const ora_1 = require("../../../ora");
15
15
  const accountSelection_1 = require("../../../project/accountSelection");
16
16
  const expoConfig_1 = require("../../../project/expoConfig");
17
17
  const fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync_1 = require("../../../project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync");
18
+ const projectNotConfiguredError_1 = require("../../../project/projectNotConfiguredError");
18
19
  const prompts_1 = require("../../../prompts");
19
20
  const User_1 = require("../../../user/User");
20
21
  /**
@@ -106,7 +107,9 @@ async function validateOrSetProjectIdAsync({ exp, graphqlClient, actor, options,
106
107
  if (!projectDir) {
107
108
  throw new Error('This command must be run inside a project directory.');
108
109
  }
109
- log_1.default.warn('EAS project not configured.');
110
+ if (!options.nonInteractive) {
111
+ log_1.default.warn('EAS project not configured.');
112
+ }
110
113
  const accountName = await chooseAccountNameForEASProjectAsync(exp, actor, options);
111
114
  const projectId = await (0, fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync_1.fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync)(graphqlClient, {
112
115
  accountName,
@@ -135,14 +138,18 @@ async function chooseAccountNameForEASProjectAsync(exp, actor, options) {
135
138
  return exp.owner;
136
139
  }
137
140
  if (actor.__typename === 'Robot') {
138
- throw new Error(`Project is not configured. When using a robot access token, run "eas init --account <name> --non-interactive" or set the "owner" field in your app config before managing the project. Accounts this token can create projects in: ${(0, User_1.getCreatableAccountNames)(actor).join(', ')}`);
141
+ throw (0, projectNotConfiguredError_1.getUnconfiguredProjectError)({
142
+ actor,
143
+ reason: 'A robot access token cannot configure it interactively.',
144
+ additionalFix: 'Alternatively, set the "owner" field in your app config.',
145
+ });
139
146
  }
140
147
  const allAccounts = actor.accounts;
141
148
  if (allAccounts.length === 1) {
142
149
  return allAccounts[0].name;
143
150
  }
144
151
  if (options.nonInteractive) {
145
- throw new Error(`Must configure EAS project by running 'eas init' before this command can be run in non-interactive mode.`);
152
+ throw (0, projectNotConfiguredError_1.getUnconfiguredProjectError)({ actor });
146
153
  }
147
154
  const choices = (0, accountSelection_1.getAccountChoices)(actor, (0, accountSelection_1.getAccountNamesWhereUserHasSufficientPermissionsToCreateApp)(actor));
148
155
  return (await (0, prompts_1.promptAsync)({
@@ -55,7 +55,7 @@ async function generateProjectConfigAsync(pathArg, options) {
55
55
  function getAccountPermissionsMap(actor) {
56
56
  const permissionsMap = new Map();
57
57
  for (const account of actor.accounts) {
58
- const hasPermission = account.users.find(it => it.actor.id === actor.id)?.role !== generated_1.Role.ViewOnly;
58
+ const hasPermission = account.viewerUserPermission.role !== generated_1.Role.ViewOnly;
59
59
  permissionsMap.set(account.name, hasPermission);
60
60
  }
61
61
  return permissionsMap;
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
5
- const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
6
5
  const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
7
6
  const generated_1 = require("../../graphql/generated");
8
7
  const log_1 = tslib_1.__importDefault(require("../../log"));
@@ -45,7 +44,7 @@ class AccountView extends EasCommand_1.default {
45
44
  if ('username' in actor && account.name === actor.username) {
46
45
  return generated_1.Role.Owner;
47
46
  }
48
- return (0, nullthrows_1.default)(account.users.find(user => user.actor.id === actor.id)?.role);
47
+ return account.viewerUserPermission.role;
49
48
  }
50
49
  static getLabelForRole(role) {
51
50
  switch (role) {
@@ -18,8 +18,8 @@ async function cancelBuildAsync(graphqlClient, buildId) {
18
18
  const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
19
19
  .mutation((0, graphql_tag_1.default) `
20
20
  mutation CancelBuildMutation($buildId: ID!) {
21
- build(buildId: $buildId) {
22
- cancel {
21
+ build {
22
+ cancelBuild(buildId: $buildId) {
23
23
  id
24
24
  status
25
25
  }
@@ -27,7 +27,7 @@ async function cancelBuildAsync(graphqlClient, buildId) {
27
27
  }
28
28
  `, { buildId })
29
29
  .toPromise());
30
- return data.build.cancel;
30
+ return data.build.cancelBuild;
31
31
  }
32
32
  async function selectBuildToCancelAsync(graphqlClient, projectId, projectDisplayName, filters) {
33
33
  const spinner = (0, ora_1.ora)().start('Fetching the uncompleted builds…');
@@ -168,7 +168,7 @@ class Download extends EasCommand_1.default {
168
168
  return builds[0];
169
169
  }
170
170
  async getPathToBuildArtifactAsync(build, platform) {
171
- const cachedBuildArtifactPath = (0, run_1.getEasBuildRunCachedAppPath)(build.project.id, build.id, platform);
171
+ const cachedBuildArtifactPath = (0, run_1.getEasBuildRunCachedAppPath)(build.app.id, build.id, platform);
172
172
  if (await fs_extra_1.default.pathExists(cachedBuildArtifactPath)) {
173
173
  log_1.default.newLine();
174
174
  log_1.default.log(`Using cached build...`);
@@ -112,7 +112,14 @@ class FingerprintCompare extends EasCommand_1.default {
112
112
  environmentForProjectFingerprint: environment,
113
113
  }, firstFingerprintInfo);
114
114
  const { fingerprint: secondFingerprint, origin: secondFingerprintOrigin } = secondFingerprintInfo;
115
+ const unavailableSourceHashes = [
116
+ firstFingerprintInfo.isFingerprintSourceUnavailable ? firstFingerprint.hash : null,
117
+ secondFingerprintInfo.isFingerprintSourceUnavailable ? secondFingerprint.hash : null,
118
+ ].filter((hash) => hash !== null);
115
119
  if (json) {
120
+ if (unavailableSourceHashes.length > 0) {
121
+ throw new Error(getUnavailableSourceMessage(unavailableSourceHashes));
122
+ }
116
123
  (0, json_1.printJsonOnlyOutput)({ fingerprint1: firstFingerprint, fingerprint2: secondFingerprint });
117
124
  return;
118
125
  }
@@ -123,54 +130,60 @@ class FingerprintCompare extends EasCommand_1.default {
123
130
  else {
124
131
  log_1.default.log(`🔄 ${capitalizeFirstLetter(prettyPrintFingerprint(firstFingerprint, firstFingerprintOrigin))} differs from ${prettyPrintFingerprint(secondFingerprint, secondFingerprintOrigin)}`);
125
132
  }
126
- const fingerprintDiffs = (0, cli_1.diffFingerprint)(projectDir, firstFingerprint, secondFingerprint);
127
- if (!fingerprintDiffs) {
128
- log_1.default.error('Fingerprint diffs can only be computed for projects with SDK 52 or higher');
129
- return;
130
- }
131
- const filePathDiffs = fingerprintDiffs.filter(diff => {
132
- let sourceType;
133
- if (diff.op === 'added') {
134
- sourceType = diff.addedSource.type;
135
- }
136
- else if (diff.op === 'removed') {
137
- sourceType = diff.removedSource.type;
138
- }
139
- else if (diff.op === 'changed') {
140
- sourceType = diff.beforeSource.type;
141
- }
142
- return sourceType === 'dir' || sourceType === 'file';
143
- });
144
- if (filePathDiffs.length > 0) {
133
+ if (unavailableSourceHashes.length > 0) {
145
134
  log_1.default.newLine();
146
- log_1.default.log('📁 Paths with native dependencies:');
135
+ log_1.default.warn(`A detailed diff cannot be shown. ${getUnavailableSourceMessage(unavailableSourceHashes)}`);
147
136
  }
148
- const fields = [];
149
- for (const diff of filePathDiffs) {
150
- const field = getDiffFilePathFields(diff);
151
- if (!field) {
152
- throw new Error(`Unsupported diff: ${JSON.stringify(diff)}`);
137
+ else {
138
+ const fingerprintDiffs = (0, cli_1.diffFingerprint)(projectDir, firstFingerprint, secondFingerprint);
139
+ if (!fingerprintDiffs) {
140
+ log_1.default.error('Fingerprint diffs can only be computed for projects with SDK 52 or higher');
141
+ return;
153
142
  }
154
- fields.push(field);
155
- }
156
- log_1.default.log((0, formatFields_1.default)(fields, {
157
- labelFormat: label => ` ${chalk_1.default.dim(label)}:`,
158
- }));
159
- const contentDiffs = fingerprintDiffs.filter(diff => {
160
- let sourceType;
161
- if (diff.op === 'added') {
162
- sourceType = diff.addedSource.type;
143
+ const filePathDiffs = fingerprintDiffs.filter(diff => {
144
+ let sourceType;
145
+ if (diff.op === 'added') {
146
+ sourceType = diff.addedSource.type;
147
+ }
148
+ else if (diff.op === 'removed') {
149
+ sourceType = diff.removedSource.type;
150
+ }
151
+ else if (diff.op === 'changed') {
152
+ sourceType = diff.beforeSource.type;
153
+ }
154
+ return sourceType === 'dir' || sourceType === 'file';
155
+ });
156
+ if (filePathDiffs.length > 0) {
157
+ log_1.default.newLine();
158
+ log_1.default.log('📁 Paths with native dependencies:');
163
159
  }
164
- else if (diff.op === 'removed') {
165
- sourceType = diff.removedSource.type;
160
+ const fields = [];
161
+ for (const diff of filePathDiffs) {
162
+ const field = getDiffFilePathFields(diff);
163
+ if (!field) {
164
+ throw new Error(`Unsupported diff: ${JSON.stringify(diff)}`);
165
+ }
166
+ fields.push(field);
166
167
  }
167
- else if (diff.op === 'changed') {
168
- sourceType = diff.beforeSource.type;
168
+ log_1.default.log((0, formatFields_1.default)(fields, {
169
+ labelFormat: label => ` ${chalk_1.default.dim(label)}:`,
170
+ }));
171
+ const contentDiffs = fingerprintDiffs.filter(diff => {
172
+ let sourceType;
173
+ if (diff.op === 'added') {
174
+ sourceType = diff.addedSource.type;
175
+ }
176
+ else if (diff.op === 'removed') {
177
+ sourceType = diff.removedSource.type;
178
+ }
179
+ else if (diff.op === 'changed') {
180
+ sourceType = diff.beforeSource.type;
181
+ }
182
+ return sourceType === 'contents';
183
+ });
184
+ for (const diff of contentDiffs) {
185
+ printContentDiff(diff);
169
186
  }
170
- return sourceType === 'contents';
171
- });
172
- for (const diff of contentDiffs) {
173
- printContentDiff(diff);
174
187
  }
175
188
  if (nonInteractive) {
176
189
  return;
@@ -310,7 +323,11 @@ async function getFingerprintInfoFromLocalProjectAsync({ graphqlClient, projectD
310
323
  ? { ...(await getServerSideEnvironmentVariablesAsync()), EXPO_NO_DOTENV: '1' }
311
324
  : undefined;
312
325
  const fingerprint = await (0, utils_1.getFingerprintInfoFromLocalProjectForPlatformsAsync)(graphqlClient, projectDir, projectId, vcsClient, firstFingerprintPlatforms, { env });
313
- return { fingerprint, origin: { type: FingerprintOriginType.Project } };
326
+ return {
327
+ fingerprint,
328
+ origin: { type: FingerprintOriginType.Project },
329
+ isFingerprintSourceUnavailable: false,
330
+ };
314
331
  }
315
332
  async function getFingerprintFromUpdateFragmentAsync(updateWithFingerprint) {
316
333
  if (!updateWithFingerprint.fingerprint) {
@@ -319,8 +336,10 @@ async function getFingerprintFromUpdateFragmentAsync(updateWithFingerprint) {
319
336
  else if (!updateWithFingerprint.fingerprint.debugInfoUrl) {
320
337
  throw new Error(`Fingerprint source for update ${updateWithFingerprint.id} was not computed.`);
321
338
  }
339
+ const { fingerprint, isFingerprintSourceUnavailable } = await getFingerprintFromFingerprintFragmentAsync(updateWithFingerprint.fingerprint);
322
340
  return {
323
- fingerprint: await getFingerprintFromFingerprintFragmentAsync(updateWithFingerprint.fingerprint),
341
+ fingerprint,
342
+ isFingerprintSourceUnavailable,
324
343
  platforms: [(0, utils_1.stringToAppPlatform)(updateWithFingerprint.platform)],
325
344
  origin: {
326
345
  type: FingerprintOriginType.Update,
@@ -330,7 +349,7 @@ async function getFingerprintFromUpdateFragmentAsync(updateWithFingerprint) {
330
349
  }
331
350
  async function getFingerprintInfoFromHashAsync(graphqlClient, projectId, hash) {
332
351
  const fingerprintFragment = await getFingerprintFragmentFromHashAsync(graphqlClient, projectId, hash);
333
- const fingerprint = await getFingerprintFromFingerprintFragmentAsync(fingerprintFragment);
352
+ const { fingerprint, isFingerprintSourceUnavailable } = await getFingerprintFromFingerprintFragmentAsync(fingerprintFragment);
334
353
  let platforms;
335
354
  const fingerprintBuilds = fingerprintFragment.builds?.edges.map(edge => edge.node) ?? [];
336
355
  const fingerprintUpdates = fingerprintFragment.updates?.edges.map(edge => edge.node) ?? [];
@@ -342,6 +361,7 @@ async function getFingerprintInfoFromHashAsync(graphqlClient, projectId, hash) {
342
361
  }
343
362
  return {
344
363
  fingerprint,
364
+ isFingerprintSourceUnavailable,
345
365
  platforms,
346
366
  origin: {
347
367
  type: FingerprintOriginType.Hash,
@@ -390,8 +410,10 @@ async function getFingerprintInfoFromBuildIdAsync(graphqlClient, buildId) {
390
410
  else if (!buildWithFingerprint.fingerprint.debugInfoUrl) {
391
411
  throw new Error(`Fingerprint source for build ${buildId} was not computed.`);
392
412
  }
413
+ const { fingerprint, isFingerprintSourceUnavailable } = await getFingerprintFromFingerprintFragmentAsync(buildWithFingerprint.fingerprint);
393
414
  return {
394
- fingerprint: await getFingerprintFromFingerprintFragmentAsync(buildWithFingerprint.fingerprint),
415
+ fingerprint,
416
+ isFingerprintSourceUnavailable,
395
417
  platforms: [buildWithFingerprint.platform],
396
418
  origin: {
397
419
  type: FingerprintOriginType.Build,
@@ -410,13 +432,43 @@ async function getFingerprintFragmentFromHashAsync(graphqlClient, projectId, has
410
432
  }
411
433
  return fingerprint;
412
434
  }
435
+ async function fetchFingerprintSourceAsync(fingerprintDebugUrl) {
436
+ const fingerprintResponse = await fetch(fingerprintDebugUrl);
437
+ if (!fingerprintResponse.ok) {
438
+ throw new Error(`Fingerprint source request failed: ${fingerprintResponse.status}`);
439
+ }
440
+ const fingerprintSource = (await fingerprintResponse.json());
441
+ if (!Array.isArray(fingerprintSource?.sources)) {
442
+ throw new Error('Fingerprint source file does not contain a list of sources');
443
+ }
444
+ return fingerprintSource;
445
+ }
413
446
  async function getFingerprintFromFingerprintFragmentAsync(fingerprintFragment) {
414
447
  const fingerprintDebugUrl = fingerprintFragment.debugInfoUrl;
415
448
  if (!fingerprintDebugUrl) {
416
449
  throw new Error(`The source for fingerprint hash ${fingerprintFragment.hash} was not computed.`);
417
450
  }
418
- const fingerprintResponse = await fetch(fingerprintDebugUrl);
419
- return (await fingerprintResponse.json());
451
+ try {
452
+ return {
453
+ fingerprint: await fetchFingerprintSourceAsync(fingerprintDebugUrl),
454
+ isFingerprintSourceUnavailable: false,
455
+ };
456
+ }
457
+ catch (error) {
458
+ // Uploaded source files expire after a period of time or may be malformed
459
+ // (e.g. zero-length). The hash from the API is still valid, so fall back to a
460
+ // sourceless fingerprint instead of failing the whole comparison.
461
+ log_1.default.debug(`Failed to fetch source for fingerprint hash ${fingerprintFragment.hash}`, error);
462
+ return {
463
+ fingerprint: { hash: fingerprintFragment.hash, sources: [] },
464
+ isFingerprintSourceUnavailable: true,
465
+ };
466
+ }
467
+ }
468
+ function getUnavailableSourceMessage(hashes) {
469
+ return hashes.length === 1
470
+ ? `The uploaded source file for fingerprint ${hashes[0]} has expired or is invalid.`
471
+ : `The uploaded source files for fingerprints ${hashes.join(' and ')} have expired or are invalid.`;
420
472
  }
421
473
  function printContentDiff(diff) {
422
474
  if (diff.op === 'added') {
@@ -1,5 +1,6 @@
1
1
  import EasCommand from '../commandUtils/EasCommand';
2
2
  export declare function detectProjectSdkVersionAsync(projectDir: string): Promise<string | undefined>;
3
+ export declare function toRepackTargetSdkVersion(sdkVersion: string | undefined): string | undefined;
3
4
  export default class Go extends EasCommand {
4
5
  static description: string;
5
6
  static hidden: boolean;
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.detectProjectSdkVersionAsync = detectProjectSdkVersionAsync;
4
+ exports.toRepackTargetSdkVersion = toRepackTargetSdkVersion;
4
5
  const tslib_1 = require("tslib");
5
6
  const config_1 = require("@expo/config");
6
- const apple_utils_1 = require("@expo/apple-utils");
7
7
  const core_1 = require("@oclif/core");
8
8
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
9
9
  const fs = tslib_1.__importStar(require("fs-extra"));
10
10
  const os = tslib_1.__importStar(require("os"));
11
11
  const path = tslib_1.__importStar(require("path"));
12
+ const semver_1 = tslib_1.__importDefault(require("semver"));
12
13
  const EasCommand_1 = tslib_1.__importDefault(require("../commandUtils/EasCommand"));
13
14
  const context_1 = require("../credentials/context");
14
15
  const AscApiKeyUtils_1 = require("../credentials/ios/actions/AscApiKeyUtils");
@@ -17,6 +18,7 @@ const SetUpAscApiKey_1 = require("../credentials/ios/actions/SetUpAscApiKey");
17
18
  const SetUpBuildCredentials_1 = require("../credentials/ios/actions/SetUpBuildCredentials");
18
19
  const SetUpPushKey_1 = require("../credentials/ios/actions/SetUpPushKey");
19
20
  const ensureAppExists_1 = require("../credentials/ios/appstore/ensureAppExists");
21
+ const ensureTestFlightGroup_1 = require("../credentials/ios/appstore/ensureTestFlightGroup");
20
22
  const generated_1 = require("../graphql/generated");
21
23
  const url_1 = require("../build/utils/url");
22
24
  const AppMutation_1 = require("../graphql/mutations/AppMutation");
@@ -49,51 +51,12 @@ async function detectProjectSdkVersionAsync(projectDir) {
49
51
  return;
50
52
  }
51
53
  }
52
- const TESTFLIGHT_GROUP_NAME = 'Team (Expo)';
54
+ function toRepackTargetSdkVersion(sdkVersion) {
55
+ const coerced = semver_1.default.coerce(sdkVersion);
56
+ return coerced ? `${coerced.major}.0.0` : sdkVersion;
57
+ }
53
58
  async function setupTestFlightAsync(ascApp) {
54
- let group;
55
- for (let attempt = 0; attempt < 10; attempt++) {
56
- try {
57
- const groups = await ascApp.getBetaGroupsAsync({
58
- query: { includes: ['betaTesters'] },
59
- });
60
- group = groups.find(g => g.attributes.isInternalGroup && g.attributes.name === TESTFLIGHT_GROUP_NAME);
61
- if (!group) {
62
- group = await ascApp.createBetaGroupAsync({
63
- name: TESTFLIGHT_GROUP_NAME,
64
- isInternalGroup: true,
65
- hasAccessToAllBuilds: true,
66
- });
67
- }
68
- break;
69
- }
70
- catch (error) {
71
- // Apple returns this error when the app isn't ready yet
72
- if (error?.data?.errors?.some((e) => e.code === 'ENTITY_ERROR.RELATIONSHIP.INVALID')) {
73
- if (attempt < 9) {
74
- await (0, promise_1.sleepAsync)(10_000);
75
- continue;
76
- }
77
- }
78
- throw error;
79
- }
80
- }
81
- if (!group) {
82
- throw new Error('Failed to create TestFlight group');
83
- }
84
- const users = await apple_utils_1.User.getAsync(ascApp.context);
85
- const admins = users.filter(u => u.attributes.roles?.includes(apple_utils_1.UserRole.ADMIN));
86
- const existingEmails = new Set(group.attributes.betaTesters?.map((t) => t.attributes.email?.toLowerCase()) ?? []);
87
- const newTesters = admins
88
- .filter(u => u.attributes.email && !existingEmails.has(u.attributes.email.toLowerCase()))
89
- .map(u => ({
90
- email: u.attributes.email,
91
- firstName: u.attributes.firstName ?? '',
92
- lastName: u.attributes.lastName ?? '',
93
- }));
94
- if (newTesters.length > 0) {
95
- await group.createBulkBetaTesterAssignmentsAsync(newTesters);
96
- }
59
+ await (0, ensureTestFlightGroup_1.ensureTestFlightGroupExistsAsync)(ascApp);
97
60
  }
98
61
  /* eslint-disable no-console */
99
62
  async function withSuppressedOutputAsync(fn) {
@@ -146,7 +109,7 @@ class Go extends EasCommand_1.default {
146
109
  default: 'My Expo Go',
147
110
  }),
148
111
  'sdk-version': core_1.Flags.string({
149
- description: 'Expo Go SDK version to prepare (default: latest)',
112
+ description: 'Expo Go SDK version to prepare, for example 57 (default: the SDK version of the current project)',
150
113
  required: false,
151
114
  }),
152
115
  credentials: core_1.Flags.boolean({
@@ -169,7 +132,7 @@ class Go extends EasCommand_1.default {
169
132
  if (detectedSdkVersion && !flags['sdk-version']) {
170
133
  log_1.default.log(`Current project using SDK ${detectedSdkVersion.split('.')[0]}. Auto-selected same version. To use a different version, pass --sdk-version.`);
171
134
  }
172
- let sdkVersion = flags['sdk-version'] ?? detectedSdkVersion;
135
+ let sdkVersion = toRepackTargetSdkVersion(flags['sdk-version'] ?? detectedSdkVersion);
173
136
  if (!sdkVersion) {
174
137
  ({ sdkVersion } = await this.selectSdkVersionAsync(graphqlClient));
175
138
  }
@@ -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
  }
@@ -25,7 +25,7 @@ class SimulatorAvailability extends EasCommand_1.default {
25
25
  if (jsonFlag) {
26
26
  (0, json_1.enableJsonOutput)();
27
27
  }
28
- const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(SimulatorAvailability, {
28
+ const { projectId, loggedIn: { actor, graphqlClient }, } = await this.getContextAsync(SimulatorAvailability, {
29
29
  nonInteractive,
30
30
  });
31
31
  const fetchSpinner = jsonFlag ? null : (0, ora_1.ora)('Checking EAS Simulator availability').start();
@@ -33,6 +33,7 @@ class SimulatorAvailability extends EasCommand_1.default {
33
33
  let available;
34
34
  try {
35
35
  ({ accountName, available } = await DeviceRunSessionAvailabilityQuery_1.DeviceRunSessionAvailabilityQuery.byAppIdAsync(graphqlClient, projectId));
36
+ available ||= actor.isExpoAdmin;
36
37
  fetchSpinner?.stop();
37
38
  }
38
39
  catch (err) {