eas-cli 0.31.1 → 0.34.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 (128) hide show
  1. package/README.md +29 -28
  2. package/build/analytics.js +3 -9
  3. package/build/build/android/UpdatesModule.js +4 -15
  4. package/build/build/android/configure.js +3 -3
  5. package/build/build/android/graphql.js +2 -4
  6. package/build/build/android/prepareJob.js +4 -3
  7. package/build/build/build.js +2 -2
  8. package/build/build/configure.js +26 -13
  9. package/build/build/ios/UpdatesModule.js +6 -18
  10. package/build/build/ios/configure.js +1 -1
  11. package/build/build/ios/graphql.js +2 -23
  12. package/build/build/ios/prepareJob.js +4 -6
  13. package/build/build/metadata.js +5 -10
  14. package/build/build/utils/appJson.d.ts +1 -0
  15. package/build/build/utils/appJson.js +13 -4
  16. package/build/build/utils/devClient.d.ts +4 -4
  17. package/build/build/utils/devClient.js +10 -18
  18. package/build/build/utils/repository.js +10 -7
  19. package/build/build/validate.js +4 -4
  20. package/build/commandUtils/EasCommand.d.ts +1 -0
  21. package/build/commandUtils/EasCommand.js +21 -0
  22. package/build/commands/branch/create.js +3 -2
  23. package/build/commands/branch/delete.js +1 -1
  24. package/build/commands/branch/list.js +1 -1
  25. package/build/commands/branch/publish.js +20 -48
  26. package/build/commands/branch/view.js +1 -1
  27. package/build/commands/build/index.d.ts +1 -1
  28. package/build/commands/build/index.js +64 -49
  29. package/build/commands/channel/edit.js +1 -1
  30. package/build/commands/channel/list.js +1 -1
  31. package/build/commands/channel/view.js +1 -1
  32. package/build/commands/diagnostics.js +2 -2
  33. package/build/commands/project/info.js +1 -1
  34. package/build/commands/submit.js +16 -11
  35. package/build/commands/update/view.js +1 -1
  36. package/build/credentials/android/api/graphql/queries/GoogleServiceAccountKeyQuery.js +2 -0
  37. package/build/credentials/context.d.ts +1 -1
  38. package/build/credentials/context.js +5 -5
  39. package/build/credentials/credentialsJson/update.js +5 -4
  40. package/build/credentials/errors.d.ts +3 -0
  41. package/build/credentials/errors.js +7 -1
  42. package/build/credentials/ios/IosCredentialsProvider.js +1 -1
  43. package/build/credentials/ios/actions/AscApiKeyUtils.d.ts +5 -0
  44. package/build/credentials/ios/actions/AscApiKeyUtils.js +63 -0
  45. package/build/credentials/ios/actions/CreateDistributionCertificate.js +1 -1
  46. package/build/credentials/ios/actions/CreatePushKey.js +1 -1
  47. package/build/credentials/ios/actions/DistributionCertificateUtils.d.ts +1 -1
  48. package/build/credentials/ios/actions/DistributionCertificateUtils.js +10 -12
  49. package/build/credentials/ios/actions/PushKeyUtils.d.ts +1 -1
  50. package/build/credentials/ios/actions/PushKeyUtils.js +5 -5
  51. package/build/credentials/ios/actions/SetupTargetBuildCredentials.js +1 -1
  52. package/build/credentials/ios/api/graphql/queries/AppQuery.js +3 -1
  53. package/build/credentials/ios/api/graphql/queries/AppleDeviceQuery.js +6 -2
  54. package/build/credentials/ios/api/graphql/queries/AppleDistributionCertificateQuery.js +7 -1
  55. package/build/credentials/ios/api/graphql/queries/AppleProvisioningProfileQuery.js +5 -1
  56. package/build/credentials/ios/api/graphql/queries/ApplePushKeyQuery.js +2 -0
  57. package/build/credentials/ios/api/graphql/queries/AppleTeamQuery.js +5 -1
  58. package/build/credentials/ios/appstore/AppStoreApi.d.ts +7 -1
  59. package/build/credentials/ios/appstore/AppStoreApi.js +17 -0
  60. package/build/credentials/ios/appstore/Credentials.js +3 -3
  61. package/build/credentials/ios/appstore/Credentials.types.d.ts +13 -0
  62. package/build/credentials/ios/appstore/ascApiKey.d.ts +9 -0
  63. package/build/credentials/ios/appstore/ascApiKey.js +99 -0
  64. package/build/credentials/ios/credentials.d.ts +17 -0
  65. package/build/credentials/ios/credentials.js +16 -1
  66. package/build/credentials/manager/Actions.d.ts +47 -0
  67. package/build/credentials/manager/Actions.js +48 -0
  68. package/build/credentials/manager/AndroidActions.d.ts +6 -0
  69. package/build/credentials/manager/AndroidActions.js +114 -0
  70. package/build/credentials/manager/IosActions.d.ts +6 -0
  71. package/build/credentials/manager/IosActions.js +110 -0
  72. package/build/credentials/manager/ManageAndroid.d.ts +1 -29
  73. package/build/credentials/manager/ManageAndroid.js +26 -159
  74. package/build/credentials/manager/ManageIos.d.ts +1 -29
  75. package/build/credentials/manager/ManageIos.js +28 -155
  76. package/build/graphql/client.d.ts +8 -2
  77. package/build/graphql/generated.d.ts +134 -121
  78. package/build/graphql/generated.js +46 -28
  79. package/build/graphql/queries/BuildQuery.js +4 -1
  80. package/build/graphql/queries/EnvironmentSecretsQuery.js +4 -2
  81. package/build/graphql/queries/ProjectQuery.js +3 -1
  82. package/build/graphql/queries/PublishQuery.js +4 -1
  83. package/build/graphql/queries/SubmissionQuery.js +5 -2
  84. package/build/graphql/queries/UserQuery.js +4 -1
  85. package/build/graphql/queries/WebhookQuery.js +6 -2
  86. package/build/log.d.ts +11 -3
  87. package/build/log.js +23 -22
  88. package/build/project/android/applicationId.d.ts +1 -1
  89. package/build/project/android/applicationId.js +7 -6
  90. package/build/project/ios/bundleIdentifier.d.ts +1 -1
  91. package/build/project/ios/bundleIdentifier.js +7 -6
  92. package/build/project/projectUtils.js +1 -1
  93. package/build/project/publish.js +2 -2
  94. package/build/project/workflow.js +2 -2
  95. package/build/submit/ArchiveSource.d.ts +7 -2
  96. package/build/submit/ArchiveSource.js +94 -11
  97. package/build/submit/ios/AscApiKeySource.d.ts +28 -0
  98. package/build/submit/ios/AscApiKeySource.js +51 -0
  99. package/build/submit/ios/IosSubmitCommand.d.ts +2 -0
  100. package/build/submit/ios/IosSubmitCommand.js +55 -3
  101. package/build/submit/ios/IosSubmitter.d.ts +3 -1
  102. package/build/submit/ios/IosSubmitter.js +49 -5
  103. package/build/submit/submit.js +1 -1
  104. package/build/submit/utils/builds.d.ts +3 -1
  105. package/build/submit/utils/builds.js +6 -6
  106. package/build/user/User.js +1 -0
  107. package/build/utils/easCli.d.ts +1 -0
  108. package/build/utils/easCli.js +5 -0
  109. package/build/utils/{expoCommand.d.ts → expoCli.d.ts} +0 -0
  110. package/build/utils/{expoCommand.js → expoCli.js} +0 -0
  111. package/build/utils/profiles.d.ts +11 -0
  112. package/build/utils/profiles.js +46 -0
  113. package/build/vcs/clients/git.d.ts +26 -0
  114. package/build/vcs/clients/git.js +184 -0
  115. package/build/vcs/clients/gitNoCommit.d.ts +7 -0
  116. package/build/vcs/clients/gitNoCommit.js +27 -0
  117. package/build/vcs/clients/noVcs.d.ts +6 -0
  118. package/build/vcs/clients/noVcs.js +19 -0
  119. package/build/vcs/git.d.ts +10 -17
  120. package/build/vcs/git.js +7 -175
  121. package/build/vcs/index.d.ts +2 -2
  122. package/build/vcs/index.js +15 -6
  123. package/build/vcs/local.d.ts +18 -5
  124. package/build/vcs/local.js +61 -32
  125. package/build/vcs/vcs.d.ts +2 -1
  126. package/build/vcs/vcs.js +8 -4
  127. package/oclif.manifest.json +1 -1
  128. package/package.json +7 -7
@@ -7,6 +7,8 @@ const eas_json_1 = require("@expo/eas-json");
7
7
  const command_1 = require("@oclif/command");
8
8
  const errors_1 = require("@oclif/errors");
9
9
  const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
10
+ const figures_1 = (0, tslib_1.__importDefault)(require("figures"));
11
+ const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
10
12
  const nullthrows_1 = (0, tslib_1.__importDefault)(require("nullthrows"));
11
13
  const build_1 = require("../../build/android/build");
12
14
  const build_2 = require("../../build/build");
@@ -19,7 +21,7 @@ const repository_1 = require("../../build/utils/repository");
19
21
  const EasCommand_1 = (0, tslib_1.__importDefault)(require("../../commandUtils/EasCommand"));
20
22
  const generated_1 = require("../../graphql/generated");
21
23
  const AppPlatform_1 = require("../../graphql/types/AppPlatform");
22
- const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
24
+ const log_1 = (0, tslib_1.__importStar)(require("../../log"));
23
25
  const platform_1 = require("../../platform");
24
26
  const isEasEnabledForProject_1 = require("../../project/isEasEnabledForProject");
25
27
  const metroConfig_1 = require("../../project/metroConfig");
@@ -28,8 +30,11 @@ const prompts_1 = require("../../prompts");
28
30
  const context_2 = require("../../submit/context");
29
31
  const submit_1 = require("../../submit/submit");
30
32
  const urls_1 = require("../../submit/utils/urls");
33
+ const easCli_1 = require("../../utils/easCli");
31
34
  const json_1 = require("../../utils/json");
32
- const vcs_1 = (0, tslib_1.__importDefault)(require("../../vcs"));
35
+ const profiles_1 = require("../../utils/profiles");
36
+ const vcs_1 = require("../../vcs");
37
+ const git_1 = (0, tslib_1.__importDefault)(require("../../vcs/clients/git"));
33
38
  class Build extends EasCommand_1.default {
34
39
  constructor() {
35
40
  super(...arguments);
@@ -45,45 +50,53 @@ class Build extends EasCommand_1.default {
45
50
  const { requestedPlatform } = flags;
46
51
  const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
47
52
  await handleDeprecatedEasJsonAsync(projectDir, flags.nonInteractive);
48
- await vcs_1.default.ensureRepoExistsAsync();
53
+ await (0, vcs_1.getVcsClient)().ensureRepoExistsAsync();
49
54
  await (0, repository_1.ensureRepoIsCleanAsync)(flags.nonInteractive);
50
55
  await (0, configure_1.ensureProjectConfiguredAsync)(projectDir, requestedPlatform);
51
56
  const platforms = (0, platform_1.toPlatforms)(requestedPlatform);
52
- await (0, devClient_1.ensureExpoDevClientInstalledForDevClientBuildsAsync)({
57
+ const easJsonReader = new eas_json_1.EasJsonReader(projectDir);
58
+ const buildProfiles = await (0, profiles_1.getProfilesAsync)({
53
59
  platforms,
60
+ profileName: flags.profile,
61
+ async readProfileAsync(platform, profileName) {
62
+ return await easJsonReader.readBuildProfileAsync(platform, profileName);
63
+ },
64
+ });
65
+ await (0, devClient_1.ensureExpoDevClientInstalledForDevClientBuildsAsync)({
54
66
  projectDir,
55
- profile: flags.profile,
56
67
  nonInteractive: flags.nonInteractive,
68
+ buildProfiles,
57
69
  });
58
70
  const startedBuilds = [];
59
71
  const buildCtxByPlatform = {};
60
- for (const platform of platforms) {
72
+ for (const buildProfile of buildProfiles) {
61
73
  const { build: maybeBuild, buildCtx } = await this.prepareAndStartBuildAsync({
62
74
  projectDir,
63
- platform,
64
75
  flags,
65
76
  moreBuilds: platforms.length > 1,
77
+ buildProfile,
66
78
  });
67
79
  if (maybeBuild) {
68
- startedBuilds.push(maybeBuild);
80
+ startedBuilds.push({ build: maybeBuild, buildProfile });
69
81
  }
70
- buildCtxByPlatform[(0, AppPlatform_1.toAppPlatform)(platform)] = buildCtx;
82
+ buildCtxByPlatform[(0, AppPlatform_1.toAppPlatform)(buildProfile.platform)] = buildCtx;
71
83
  }
72
84
  if (flags.local) {
73
85
  return;
74
86
  }
75
87
  log_1.default.newLine();
76
- (0, printBuildInfo_1.printLogsUrls)(startedBuilds);
88
+ (0, printBuildInfo_1.printLogsUrls)(startedBuilds.map(startedBuild => startedBuild.build));
77
89
  log_1.default.newLine();
78
90
  const submissions = [];
79
91
  if (flags.autoSubmit) {
80
- for (const build of startedBuilds) {
92
+ for (const startedBuild of startedBuilds) {
81
93
  const submission = await this.prepareAndStartSubmissionAsync({
82
- build,
83
- credentialsCtx: (0, nullthrows_1.default)((_a = buildCtxByPlatform[build.platform]) === null || _a === void 0 ? void 0 : _a.credentialsCtx),
94
+ build: startedBuild.build,
95
+ credentialsCtx: (0, nullthrows_1.default)((_a = buildCtxByPlatform[startedBuild.build.platform]) === null || _a === void 0 ? void 0 : _a.credentialsCtx),
84
96
  flags,
85
97
  moreBuilds: startedBuilds.length > 1,
86
98
  projectDir,
99
+ buildProfile: startedBuild.buildProfile,
87
100
  });
88
101
  submissions.push(submission);
89
102
  }
@@ -94,7 +107,7 @@ class Build extends EasCommand_1.default {
94
107
  if (!flags.wait) {
95
108
  return;
96
109
  }
97
- const builds = await (0, build_2.waitForBuildEndAsync)(startedBuilds.map(build => build.id));
110
+ const builds = await (0, build_2.waitForBuildEndAsync)(startedBuilds.map(({ build }) => build.id));
98
111
  (0, printBuildInfo_1.printBuildResults)(builds, flags.json);
99
112
  const haveAllBuildsFailedOrCanceled = builds.every(build => (build === null || build === void 0 ? void 0 : build.status) && [generated_1.BuildStatus.Errored, generated_1.BuildStatus.Canceled].includes(build === null || build === void 0 ? void 0 : build.status));
100
113
  if (haveAllBuildsFailedOrCanceled || !flags.autoSubmit) {
@@ -135,7 +148,7 @@ class Build extends EasCommand_1.default {
135
148
  return {
136
149
  requestedPlatform,
137
150
  skipProjectConfiguration: flags['skip-project-configuration'],
138
- profile,
151
+ profile: profile !== null && profile !== void 0 ? profile : null,
139
152
  nonInteractive,
140
153
  local: flags['local'],
141
154
  wait: flags['wait'],
@@ -145,22 +158,20 @@ class Build extends EasCommand_1.default {
145
158
  submitProfile: (_a = flags['auto-submit-with-profile']) !== null && _a !== void 0 ? _a : profile,
146
159
  };
147
160
  }
148
- async prepareAndStartBuildAsync({ projectDir, platform, flags, moreBuilds, }) {
149
- const easJsonReader = new eas_json_1.EasJsonReader(projectDir);
150
- const buildProfile = await easJsonReader.readBuildProfileAsync(platform, flags.profile);
161
+ async prepareAndStartBuildAsync({ projectDir, flags, moreBuilds, buildProfile, }) {
151
162
  const buildCtx = await (0, context_1.createBuildContextAsync)({
152
- buildProfileName: flags.profile,
163
+ buildProfileName: buildProfile.profileName,
153
164
  clearCache: flags.clearCache,
154
- buildProfile,
165
+ buildProfile: buildProfile.profile,
155
166
  local: flags.local,
156
167
  nonInteractive: flags.nonInteractive,
157
- platform,
168
+ platform: buildProfile.platform,
158
169
  projectDir,
159
170
  skipProjectConfiguration: flags.skipProjectConfiguration,
160
171
  });
161
172
  if (moreBuilds) {
162
173
  log_1.default.newLine();
163
- const appPlatform = (0, AppPlatform_1.toAppPlatform)(platform);
174
+ const appPlatform = (0, AppPlatform_1.toAppPlatform)(buildProfile.platform);
164
175
  log_1.default.log(`${platform_1.appPlatformEmojis[appPlatform]} ${chalk_1.default.bold(`${platform_1.appPlatformDisplayNames[appPlatform]} build`)}`);
165
176
  }
166
177
  if (buildCtx.workflow === eas_build_job_1.Workflow.MANAGED && !this.metroConfigValidated) {
@@ -186,10 +197,9 @@ class Build extends EasCommand_1.default {
186
197
  }
187
198
  return await sendBuildRequestAsync();
188
199
  }
189
- async prepareAndStartSubmissionAsync({ build, credentialsCtx, flags, moreBuilds, projectDir, }) {
200
+ async prepareAndStartSubmissionAsync({ build, credentialsCtx, flags, moreBuilds, projectDir, buildProfile, }) {
190
201
  const easJsonReader = new eas_json_1.EasJsonReader(projectDir);
191
202
  const platform = (0, AppPlatform_1.toPlatform)(build.platform);
192
- const buildProfile = await easJsonReader.readBuildProfileAsync(platform, flags.profile);
193
203
  const submitProfile = await easJsonReader.readSubmitProfileAsync(platform, flags.submitProfile);
194
204
  const submissionCtx = await (0, context_2.createSubmissionContextAsync)({
195
205
  platform,
@@ -198,7 +208,7 @@ class Build extends EasCommand_1.default {
198
208
  profile: submitProfile,
199
209
  archiveFlags: { id: build.id },
200
210
  nonInteractive: flags.nonInteractive,
201
- env: buildProfile.env,
211
+ env: buildProfile.profile.env,
202
212
  credentialsCtx,
203
213
  });
204
214
  if (moreBuilds) {
@@ -234,8 +244,7 @@ Build.flags = {
234
244
  description: 'Skip project configuration',
235
245
  }),
236
246
  profile: command_1.flags.string({
237
- default: 'release',
238
- description: 'Name of the build profile from eas.json',
247
+ description: 'Name of the build profile from eas.json. Defaults to "production" if defined in eas.json.',
239
248
  helpValue: 'PROFILE_NAME',
240
249
  }),
241
250
  'non-interactive': command_1.flags.boolean({
@@ -267,28 +276,34 @@ Build.flags = {
267
276
  }),
268
277
  };
269
278
  async function handleDeprecatedEasJsonAsync(projectDir, nonInteractive) {
270
- if (await (0, eas_json_1.isUsingDeprecatedFormatAsync)(projectDir)) {
271
- const hasMismatchedExtendsKeys = await (0, eas_json_1.hasMismatchedExtendsAsync)(projectDir);
272
- if (nonInteractive) {
273
- log_1.default.error('We detected that your eas.json is using a deprecated format.');
274
- log_1.default.error('We will convert it automatically if run this command without --non-interactive flag. Alternatively, you can update eas.json manually according to https://docs.expo.dev/build/eas-json');
275
- (0, errors_1.error)('Unsupported eas.json format', { exit: 1 });
276
- }
277
- const confirm = await (0, prompts_1.confirmAsync)({
278
- message: 'We detected that your eas.json is using a deprecated format, do you want to migrate to the new format?',
279
- });
280
- if (confirm) {
281
- await (0, eas_json_1.migrateAsync)(projectDir);
282
- if (hasMismatchedExtendsKeys) {
283
- log_1.default.warn('"extends" keyword can only be migrated automatically to the new format if both Android and iOS profiles extend base profiles with the same names for both platforms');
284
- log_1.default.warn('Migration was successful, but you need to manually adjust the extend rules for your profiles');
285
- (0, errors_1.error)('Fix eas.json manually', { exit: 1 });
286
- }
287
- }
288
- else {
289
- log_1.default.error("Aborting, update your eas.json according to https://docs.expo.dev/build/eas-json and run 'eas build' again");
290
- (0, errors_1.error)('Unsupported eas.json format', { exit: 1 });
291
- }
279
+ if (!(await fs_extra_1.default.pathExists(eas_json_1.EasJsonReader.formatEasJsonPath(projectDir)))) {
280
+ return;
281
+ }
282
+ const easJsonReader = new eas_json_1.EasJsonReader(projectDir);
283
+ const rawEasJson = await easJsonReader.readRawAsync();
284
+ if (rawEasJson === null || rawEasJson === void 0 ? void 0 : rawEasJson.cli) {
285
+ return;
286
+ }
287
+ if (nonInteractive) {
288
+ log_1.default.warn(`${figures_1.default.warning} Action required: the default behavior of EAS CLI has changed and your eas.json must be updated to remove ambiguity around which Git integration workflow to use. Refer to ${(0, log_1.link)('https://expo.fyi/eas-vcs-workflow')} for more information.`);
289
+ log_1.default.warn('This warning will become an error in an upcoming EAS CLI release. For now, we will proceed with the old default behavior to avoid disruption of your builds.');
290
+ (0, vcs_1.setVcsClient)(new git_1.default());
291
+ return;
292
+ }
293
+ log_1.default.log(`${chalk_1.default.bold('eas-cli@>=0.34.0 no longer requires that you commit changes to Git before starting a build.')} ${(0, log_1.learnMore)('https://expo.fyi/eas-vcs-workflow')}`);
294
+ log_1.default.log(`If you want to continue using the Git integration, you can opt in with ${chalk_1.default.bold('cli.requireCommit')} in ${chalk_1.default.bold('eas.json')} or with the following prompt`);
295
+ log_1.default.newLine();
296
+ const mode = await (0, prompts_1.selectAsync)('Select your preferred Git integration', [
297
+ { title: 'Require changes to be committed in Git (old default)', value: 'requireCommit' },
298
+ { title: 'Allow builds with dirty Git working tree (new default)', value: 'noCommit' },
299
+ ]);
300
+ rawEasJson.cli =
301
+ mode === 'requireCommit'
302
+ ? { version: `>= ${easCli_1.easCliVersion}`, requireCommit: true }
303
+ : { version: `>= ${easCli_1.easCliVersion}` };
304
+ await fs_extra_1.default.writeJSON(eas_json_1.EasJsonReader.formatEasJsonPath(projectDir), rawEasJson, { spaces: 2 });
305
+ if (mode === 'requireCommit') {
306
+ (0, vcs_1.setVcsClient)(new git_1.default());
292
307
  }
293
308
  }
294
309
  exports.handleDeprecatedEasJsonAsync = handleDeprecatedEasJsonAsync;
@@ -30,7 +30,7 @@ async function getChannelByNameForAppAsync({ appId, channelName, }) {
30
30
  }
31
31
  }
32
32
  }
33
- `, { appId, channelName })
33
+ `, { appId, channelName }, { additionalTypenames: ['UpdateChannel', 'UpdateBranch'] })
34
34
  .toPromise());
35
35
  const updateChannelByNameResult = (_a = data.app) === null || _a === void 0 ? void 0 : _a.byId.updateChannelByName;
36
36
  if (!updateChannelByNameResult) {
@@ -47,7 +47,7 @@ async function getAllUpdateChannelForAppAsync({ appId, }) {
47
47
  }
48
48
  }
49
49
  }
50
- `, { appId, offset: 0, limit: CHANNEL_LIMIT })
50
+ `, { appId, offset: 0, limit: CHANNEL_LIMIT }, { additionalTypenames: ['UpdateChannel', 'UpdateBranch', 'Update'] })
51
51
  .toPromise());
52
52
  }
53
53
  class ChannelList extends EasCommand_1.default {
@@ -101,7 +101,7 @@ async function getUpdateChannelByNameForAppAsync({ appId, channelName, }) {
101
101
  }
102
102
  }
103
103
  }
104
- `, { appId, channelName })
104
+ `, { appId, channelName }, { additionalTypenames: ['UpdateChannel', 'UpdateBranch', 'Update'] })
105
105
  .toPromise());
106
106
  }
107
107
  exports.getUpdateChannelByNameForAppAsync = getUpdateChannelByNameForAppAsync;
@@ -4,7 +4,7 @@ const tslib_1 = require("tslib");
4
4
  const envinfo_1 = (0, tslib_1.__importDefault)(require("envinfo"));
5
5
  const EasCommand_1 = (0, tslib_1.__importDefault)(require("../commandUtils/EasCommand"));
6
6
  const log_1 = (0, tslib_1.__importDefault)(require("../log"));
7
- const packageJSON = require('../../package.json');
7
+ const easCli_1 = require("../utils/easCli");
8
8
  class Diagnostics extends EasCommand_1.default {
9
9
  constructor() {
10
10
  super(...arguments);
@@ -28,7 +28,7 @@ class Diagnostics extends EasCommand_1.default {
28
28
  ],
29
29
  npmGlobalPackages: ['eas-cli', 'expo-cli'],
30
30
  }, {
31
- title: `EAS CLI ${packageJSON.version} environment info`,
31
+ title: `EAS CLI ${easCli_1.easCliVersion} environment info`,
32
32
  });
33
33
  log_1.default.log(info);
34
34
  }
@@ -19,7 +19,7 @@ async function projectInfoByIdAsync(appId) {
19
19
  }
20
20
  }
21
21
  }
22
- `, { appId })
22
+ `, { appId }, { additionalTypenames: ['App'] })
23
23
  .toPromise());
24
24
  return data;
25
25
  }
@@ -15,6 +15,7 @@ const projectUtils_1 = require("../project/projectUtils");
15
15
  const context_1 = require("../submit/context");
16
16
  const submit_1 = require("../submit/submit");
17
17
  const urls_1 = require("../submit/utils/urls");
18
+ const profiles_1 = require("../utils/profiles");
18
19
  class Submit extends EasCommand_1.default {
19
20
  async runAsync() {
20
21
  const { flags: rawFlags } = this.parse(Submit);
@@ -27,22 +28,28 @@ class Submit extends EasCommand_1.default {
27
28
  process.exitCode = 1;
28
29
  return;
29
30
  }
30
- const easJsonReader = new eas_json_1.EasJsonReader(projectDir);
31
31
  const platforms = (0, platform_1.toPlatforms)(flags.requestedPlatform);
32
+ const easJsonReader = new eas_json_1.EasJsonReader(projectDir);
33
+ const submissionProfiles = await (0, profiles_1.getProfilesAsync)({
34
+ platforms,
35
+ profileName: flags.profile,
36
+ async readProfileAsync(platform, profileName) {
37
+ return await easJsonReader.readSubmitProfileAsync(platform, profileName);
38
+ },
39
+ });
32
40
  const submissions = [];
33
- for (const platform of platforms) {
34
- const profile = await easJsonReader.readSubmitProfileAsync(platform, flags.profile);
41
+ for (const submissionProfile of submissionProfiles) {
35
42
  const ctx = await (0, context_1.createSubmissionContextAsync)({
36
- platform,
43
+ platform: submissionProfile.platform,
37
44
  projectDir,
38
45
  projectId,
39
- profile,
46
+ profile: submissionProfile.profile,
40
47
  archiveFlags: flags.archiveFlags,
41
48
  nonInteractive: flags.nonInteractive,
42
49
  });
43
- if (platforms.length > 1) {
50
+ if (submissionProfiles.length > 1) {
44
51
  log_1.default.newLine();
45
- const appPlatform = (0, AppPlatform_1.toAppPlatform)(platform);
52
+ const appPlatform = (0, AppPlatform_1.toAppPlatform)(submissionProfile.platform);
46
53
  log_1.default.log(`${platform_1.appPlatformEmojis[appPlatform]} ${chalk_1.default.bold(`${platform_1.appPlatformDisplayNames[appPlatform]} submission`)}`);
47
54
  }
48
55
  const submission = await (0, submit_1.submitAsync)(ctx);
@@ -77,9 +84,7 @@ class Submit extends EasCommand_1.default {
77
84
  }
78
85
  exports.default = Submit;
79
86
  Submit.description = `submit build archive to app store
80
- See how to configure submits with eas.json: ${(0, log_1.learnMore)('https://docs.expo.dev/submit/eas-json/', {
81
- learnMoreMessage: '',
82
- })}`;
87
+ See how to configure submits with eas.json: ${(0, log_1.link)('https://docs.expo.dev/submit/eas-json/')}`;
83
88
  Submit.aliases = ['build:submit'];
84
89
  Submit.flags = {
85
90
  platform: command_1.flags.enum({
@@ -87,7 +92,7 @@ Submit.flags = {
87
92
  options: ['android', 'ios', 'all'],
88
93
  }),
89
94
  profile: command_1.flags.string({
90
- description: 'Name of the submit profile from eas.json. Defaults to "release" if defined in eas.json.',
95
+ description: 'Name of the submit profile from eas.json. Defaults to "production" if defined in eas.json.',
91
96
  }),
92
97
  latest: command_1.flags.boolean({
93
98
  description: 'Submit the latest build for specified platform',
@@ -33,7 +33,7 @@ async function viewUpdateAsync({ groupId, }) {
33
33
  }
34
34
  `, {
35
35
  groupId,
36
- })
36
+ }, { additionalTypenames: ['Update'] })
37
37
  .toPromise());
38
38
  if (data.updatesByGroup.length === 0) {
39
39
  throw new Error(`Could not find any updates with group ID: "${groupId}"`);
@@ -24,6 +24,8 @@ exports.GoogleServiceAccountKeyQuery = {
24
24
  ${(0, graphql_1.print)(GoogleServiceAccountKey_1.GoogleServiceAccountKeyFragmentNode)}
25
25
  `, {
26
26
  accountName,
27
+ }, {
28
+ additionalTypenames: ['GoogleServiceAccountKey'],
27
29
  })
28
30
  .toPromise());
29
31
  return data.account.byName.googleServiceAccountKeys;
@@ -12,7 +12,7 @@ export declare class CredentialsContext {
12
12
  readonly projectDir: string;
13
13
  readonly user: Actor;
14
14
  private shouldAskAuthenticateAppStore;
15
- private _exp?;
15
+ private resolvedExp?;
16
16
  constructor(options: {
17
17
  exp?: ExpoConfig;
18
18
  nonInteractive?: boolean;
@@ -23,10 +23,10 @@ class CredentialsContext {
23
23
  this.projectDir = options.projectDir;
24
24
  this.user = options.user;
25
25
  this.nonInteractive = (_a = options.nonInteractive) !== null && _a !== void 0 ? _a : false;
26
- this._exp = options.exp;
27
- if (!this._exp) {
26
+ this.resolvedExp = options.exp;
27
+ if (!this.resolvedExp) {
28
28
  try {
29
- this._exp = (0, expoConfig_1.getExpoConfig)(options.projectDir);
29
+ this.resolvedExp = (0, expoConfig_1.getExpoConfig)(options.projectDir);
30
30
  }
31
31
  catch (error) {
32
32
  // ignore error, context might be created outside of expo project
@@ -34,11 +34,11 @@ class CredentialsContext {
34
34
  }
35
35
  }
36
36
  get hasProjectContext() {
37
- return !!this._exp;
37
+ return !!this.resolvedExp;
38
38
  }
39
39
  get exp() {
40
40
  this.ensureProjectContext();
41
- return this._exp;
41
+ return this.resolvedExp;
42
42
  }
43
43
  ensureProjectContext() {
44
44
  if (this.hasProjectContext) {
@@ -8,8 +8,8 @@ const path_1 = (0, tslib_1.__importDefault)(require("path"));
8
8
  const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
9
9
  const target_1 = require("../../project/ios/target");
10
10
  const zipObject_1 = (0, tslib_1.__importDefault)(require("../../utils/expodash/zipObject"));
11
- const vcs_1 = (0, tslib_1.__importDefault)(require("../../vcs"));
12
- const git_1 = (0, tslib_1.__importDefault)(require("../../vcs/git"));
11
+ const vcs_1 = require("../../vcs");
12
+ const git_1 = (0, tslib_1.__importDefault)(require("../../vcs/clients/git"));
13
13
  const read_1 = require("./read");
14
14
  const utils_1 = require("./utils");
15
15
  /**
@@ -197,8 +197,9 @@ async function updateFileAsync(projectDir, filePath, base64Data) {
197
197
  }
198
198
  }
199
199
  async function isFileUntrackedAsync(path) {
200
- if (vcs_1.default instanceof git_1.default) {
201
- return await vcs_1.default.isFileUntrackedAsync(path);
200
+ const vcsClient = (0, vcs_1.getVcsClient)();
201
+ if (vcsClient instanceof git_1.default) {
202
+ return await vcsClient.isFileUntrackedAsync(path);
202
203
  }
203
204
  return false;
204
205
  }
@@ -1,3 +1,6 @@
1
1
  export declare class MissingCredentialsNonInteractiveError extends Error {
2
2
  constructor(message?: string);
3
3
  }
4
+ export declare class MissingCredentialsError extends Error {
5
+ constructor(message?: string);
6
+ }
@@ -1,9 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MissingCredentialsNonInteractiveError = void 0;
3
+ exports.MissingCredentialsError = exports.MissingCredentialsNonInteractiveError = void 0;
4
4
  class MissingCredentialsNonInteractiveError extends Error {
5
5
  constructor(message) {
6
6
  super(message !== null && message !== void 0 ? message : 'Credentials are not set up. Please run this command again in interactive mode.');
7
7
  }
8
8
  }
9
9
  exports.MissingCredentialsNonInteractiveError = MissingCredentialsNonInteractiveError;
10
+ class MissingCredentialsError extends Error {
11
+ constructor(message) {
12
+ super(message !== null && message !== void 0 ? message : 'Credentials are not set up.');
13
+ }
14
+ }
15
+ exports.MissingCredentialsError = MissingCredentialsError;
@@ -65,7 +65,7 @@ class IosCredentialsProvider {
65
65
  return null;
66
66
  }
67
67
  const confirmSetup = await (0, prompts_1.confirmAsync)({
68
- message: `Would you like to setup Push Notifications for your project?`,
68
+ message: `Would you like to set up Push Notifications for your project?`,
69
69
  });
70
70
  if (!confirmSetup) {
71
71
  return null;
@@ -0,0 +1,5 @@
1
+ import { AscApiKey } from '../appstore/Credentials.types';
2
+ import { AscApiKeyPath, MinimalAscApiKey } from '../credentials';
3
+ export declare function promptForAscApiKeyAsync(): Promise<AscApiKeyPath>;
4
+ export declare function promptForIssuerIdAsync(): Promise<string>;
5
+ export declare function getMinimalAscApiKeyAsync(ascApiKey: AscApiKey): Promise<MinimalAscApiKey>;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMinimalAscApiKeyAsync = exports.promptForIssuerIdAsync = exports.promptForAscApiKeyAsync = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
6
+ const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
7
+ const path_1 = (0, tslib_1.__importDefault)(require("path"));
8
+ const uuid = (0, tslib_1.__importStar)(require("uuid"));
9
+ const log_1 = (0, tslib_1.__importStar)(require("../../../log"));
10
+ const prompts_1 = require("../../../prompts");
11
+ const promptForCredentials_1 = require("../../utils/promptForCredentials");
12
+ const credentials_1 = require("../credentials");
13
+ async function promptForAscApiKeyAsync() {
14
+ var _a, _b;
15
+ log_1.default.log(chalk_1.default.bold('An App Store Connect Api key is required to upload your app to the Apple App Store'));
16
+ log_1.default.log(`If you're not sure what this is or how to create one, ${(0, log_1.learnMore)('https://expo.fyi/creating-asc-api-key')}`);
17
+ const { keyP8Path } = await (0, prompts_1.promptAsync)({
18
+ type: 'text',
19
+ name: 'keyP8Path',
20
+ message: 'Path to App Store Connect Api Key:',
21
+ initial: 'AuthKey_ABCD.p8',
22
+ // eslint-disable-next-line async-protect/async-suffix
23
+ validate: async (filePath) => {
24
+ try {
25
+ const stats = await fs_extra_1.default.stat(filePath);
26
+ if (stats.isFile()) {
27
+ return true;
28
+ }
29
+ return 'Input is not a file.';
30
+ }
31
+ catch {
32
+ return 'File does not exist.';
33
+ }
34
+ },
35
+ });
36
+ const regex = /^AuthKey_(?<keyId>\w+)\.p8$/; // Common ASC Api file name downloaded from Apple
37
+ const bestEffortKeyId = (_b = (_a = path_1.default.basename(keyP8Path).match(regex)) === null || _a === void 0 ? void 0 : _a.groups) === null || _b === void 0 ? void 0 : _b.keyId;
38
+ const ascApiKeyMetadata = await (0, promptForCredentials_1.getCredentialsFromUserAsync)(credentials_1.ascApiKeyMetadataSchema, {
39
+ keyId: bestEffortKeyId,
40
+ });
41
+ return { ...ascApiKeyMetadata, keyP8Path };
42
+ }
43
+ exports.promptForAscApiKeyAsync = promptForAscApiKeyAsync;
44
+ async function promptForIssuerIdAsync() {
45
+ log_1.default.log(chalk_1.default.bold('An App Store Connect Issuer ID is required'));
46
+ log_1.default.log(`If you're not sure what this is or how to find yours, ${(0, log_1.learnMore)('https://expo.fyi/asc-issuer-id')}`);
47
+ const { issuerId } = await (0, prompts_1.promptAsync)({
48
+ type: 'text',
49
+ name: 'issuerId',
50
+ message: 'App Store Connect Issuer ID:',
51
+ validate: (input) => uuid.validate(input),
52
+ });
53
+ return issuerId;
54
+ }
55
+ exports.promptForIssuerIdAsync = promptForIssuerIdAsync;
56
+ async function getMinimalAscApiKeyAsync(ascApiKey) {
57
+ var _a;
58
+ return {
59
+ ...ascApiKey,
60
+ issuerId: (_a = ascApiKey.issuerId) !== null && _a !== void 0 ? _a : (await promptForIssuerIdAsync()),
61
+ };
62
+ }
63
+ exports.getMinimalAscApiKeyAsync = getMinimalAscApiKeyAsync;
@@ -9,7 +9,7 @@ class CreateDistributionCertificate {
9
9
  this.account = account;
10
10
  }
11
11
  async runAsync(ctx) {
12
- const distCert = await (0, DistributionCertificateUtils_1.provideOrGenerateDistributionCertificateAsync)(ctx, this.account.name);
12
+ const distCert = await (0, DistributionCertificateUtils_1.provideOrGenerateDistributionCertificateAsync)(ctx);
13
13
  const result = await ctx.ios.createDistributionCertificateAsync(this.account, distCert);
14
14
  log_1.default.succeed('Created distribution certificate');
15
15
  return result;
@@ -12,7 +12,7 @@ class CreatePushKey {
12
12
  if (ctx.nonInteractive) {
13
13
  throw new Error(`A new push key cannot be created in non-interactive mode.`);
14
14
  }
15
- const pushKey = await (0, PushKeyUtils_1.provideOrGeneratePushKeyAsync)(ctx, this.account.name);
15
+ const pushKey = await (0, PushKeyUtils_1.provideOrGeneratePushKeyAsync)(ctx);
16
16
  const result = await ctx.ios.createPushKeyAsync(this.account, pushKey);
17
17
  log_1.default.succeed('Created push key');
18
18
  return result;
@@ -12,4 +12,4 @@ export declare function selectDistributionCertificateWithDependenciesAsync(ctx:
12
12
  * select a distribution certificate from a valid set (curated on a best effort basis)
13
13
  * */
14
14
  export declare function selectValidDistributionCertificateAsync(ctx: CredentialsContext, appLookupParams: AppLookupParams): Promise<AppleDistributionCertificateFragment | null>;
15
- export declare function provideOrGenerateDistributionCertificateAsync(ctx: CredentialsContext, accountName: string): Promise<DistributionCertificate>;
15
+ export declare function provideOrGenerateDistributionCertificateAsync(ctx: CredentialsContext): Promise<DistributionCertificate>;