eas-cli 0.38.3 → 0.41.1

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 (78) hide show
  1. package/README.md +277 -29
  2. package/build/api.d.ts +1 -0
  3. package/build/api.js +13 -1
  4. package/build/build/build.js +3 -3
  5. package/build/build/context.d.ts +2 -1
  6. package/build/build/createContext.d.ts +3 -2
  7. package/build/build/createContext.js +3 -3
  8. package/build/build/local.d.ts +9 -1
  9. package/build/build/local.js +35 -5
  10. package/build/build/metadata.js +14 -0
  11. package/build/build/runBuildAndSubmit.d.ts +15 -0
  12. package/build/build/runBuildAndSubmit.js +173 -0
  13. package/build/commands/branch/create.d.ts +0 -1
  14. package/build/commands/branch/create.js +0 -1
  15. package/build/commands/branch/delete.d.ts +0 -1
  16. package/build/commands/branch/delete.js +1 -2
  17. package/build/commands/branch/list.d.ts +0 -1
  18. package/build/commands/branch/list.js +1 -2
  19. package/build/commands/branch/publish.d.ts +1 -18
  20. package/build/commands/branch/publish.js +2 -354
  21. package/build/commands/branch/rename.d.ts +0 -1
  22. package/build/commands/branch/rename.js +0 -1
  23. package/build/commands/branch/view.d.ts +0 -1
  24. package/build/commands/branch/view.js +0 -1
  25. package/build/commands/build/configure.js +1 -1
  26. package/build/commands/build/index.d.ts +0 -5
  27. package/build/commands/build/index.js +8 -159
  28. package/build/commands/build/inspect.d.ts +22 -0
  29. package/build/commands/build/inspect.js +129 -0
  30. package/build/commands/channel/create.d.ts +0 -1
  31. package/build/commands/channel/create.js +0 -1
  32. package/build/commands/channel/edit.d.ts +0 -1
  33. package/build/commands/channel/edit.js +1 -2
  34. package/build/commands/channel/list.d.ts +0 -1
  35. package/build/commands/channel/list.js +0 -1
  36. package/build/commands/channel/view.d.ts +0 -1
  37. package/build/commands/channel/view.js +3 -4
  38. package/build/commands/credentials.js +1 -7
  39. package/build/commands/diagnostics.d.ts +1 -0
  40. package/build/commands/diagnostics.js +20 -1
  41. package/build/commands/submit.js +1 -1
  42. package/build/commands/update/configure.d.ts +0 -2
  43. package/build/commands/update/configure.js +23 -15
  44. package/build/commands/update/delete.d.ts +0 -1
  45. package/build/commands/update/delete.js +0 -1
  46. package/build/commands/update/index.d.ts +19 -0
  47. package/build/commands/update/index.js +384 -0
  48. package/build/commands/update/view.d.ts +0 -1
  49. package/build/commands/update/view.js +0 -1
  50. package/build/credentials/context.d.ts +5 -0
  51. package/build/credentials/context.js +12 -7
  52. package/build/credentials/ios/actions/AscApiKeyUtils.js +1 -1
  53. package/build/credentials/ios/appstore/ensureAppExists.js +3 -3
  54. package/build/credentials/manager/ManageAndroid.d.ts +3 -3
  55. package/build/credentials/manager/ManageAndroid.js +21 -13
  56. package/build/credentials/manager/ManageIos.d.ts +3 -3
  57. package/build/credentials/manager/ManageIos.js +23 -13
  58. package/build/credentials/manager/SelectBuildProfileFromEasJson.d.ts +2 -3
  59. package/build/credentials/manager/SelectBuildProfileFromEasJson.js +3 -6
  60. package/build/credentials/manager/SelectPlatform.d.ts +1 -2
  61. package/build/credentials/manager/SelectPlatform.js +3 -3
  62. package/build/graphql/generated.d.ts +31 -11
  63. package/build/graphql/generated.js +6 -1
  64. package/build/graphql/types/Submission.js +1 -0
  65. package/build/project/expoSdk.d.ts +3 -0
  66. package/build/project/expoSdk.js +30 -0
  67. package/build/project/ios/target.js +32 -7
  68. package/build/prompts.d.ts +3 -3
  69. package/build/submit/context.js +0 -1
  70. package/build/submit/ios/AppProduce.js +3 -3
  71. package/build/submit/ios/IosSubmitCommand.js +7 -2
  72. package/build/submit/utils/urls.js +1 -1
  73. package/build/submit/utils/wait.js +1 -1
  74. package/build/update/utils.js +5 -5
  75. package/build/utils/profiles.d.ts +1 -1
  76. package/build/utils/profiles.js +80 -30
  77. package/oclif.manifest.json +1 -1
  78. package/package.json +7 -7
@@ -1,364 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaultPublishPlatforms = void 0;
4
3
  const tslib_1 = require("tslib");
5
- const config_1 = require("@expo/config");
6
- const config_plugins_1 = require("@expo/config-plugins");
7
- const eas_build_job_1 = require("@expo/eas-build-job");
8
- const command_1 = require("@oclif/command");
9
- const assert_1 = (0, tslib_1.__importDefault)(require("assert"));
10
- const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
11
- const dateformat_1 = (0, tslib_1.__importDefault)(require("dateformat"));
12
- const graphql_tag_1 = (0, tslib_1.__importDefault)(require("graphql-tag"));
13
4
  const EasCommand_1 = (0, tslib_1.__importDefault)(require("../../commandUtils/EasCommand"));
14
- const client_1 = require("../../graphql/client");
15
- const PublishMutation_1 = require("../../graphql/mutations/PublishMutation");
16
- const log_1 = (0, tslib_1.__importDefault)(require("../../log"));
17
- const ora_1 = require("../../ora");
18
- const projectUtils_1 = require("../../project/projectUtils");
19
- const publish_1 = require("../../project/publish");
20
- const workflow_1 = require("../../project/workflow");
21
- const prompts_1 = require("../../prompts");
22
- const utils_1 = require("../../update/utils");
23
- const uniqBy_1 = (0, tslib_1.__importDefault)(require("../../utils/expodash/uniqBy"));
24
- const formatFields_1 = (0, tslib_1.__importDefault)(require("../../utils/formatFields"));
25
- const vcs_1 = require("../../vcs");
26
- const create_1 = require("../channel/create");
27
- const configure_1 = require("../update/configure");
28
- const create_2 = require("./create");
29
- const list_1 = require("./list");
30
- const view_1 = require("./view");
31
- exports.defaultPublishPlatforms = ['android', 'ios'];
32
- async function getUpdateGroupAsync({ group, }) {
33
- const { updatesByGroup } = await (0, client_1.withErrorHandlingAsync)(client_1.graphqlClient
34
- .query((0, graphql_tag_1.default) `
35
- query getUpdateGroupAsync($group: ID!) {
36
- updatesByGroup(group: $group) {
37
- id
38
- group
39
- runtimeVersion
40
- manifestFragment
41
- platform
42
- message
43
- }
44
- }
45
- `, {
46
- group,
47
- }, { additionalTypenames: ['Update'] })
48
- .toPromise());
49
- return updatesByGroup;
50
- }
51
- async function ensureChannelExistsAsync({ appId, branchId, channelName, }) {
52
- var _a;
53
- try {
54
- await (0, create_1.createUpdateChannelOnAppAsync)({
55
- appId,
56
- channelName,
57
- branchId,
58
- });
59
- log_1.default.withTick(`Created a channel: ${chalk_1.default.bold(channelName)} pointed at branch: ${chalk_1.default.bold(channelName)}.`);
60
- }
61
- catch (e) {
62
- const isIgnorableError = ((_a = e.graphQLErrors) === null || _a === void 0 ? void 0 : _a.length) === 1 &&
63
- e.graphQLErrors[0].extensions.errorCode === 'CHANNEL_ALREADY_EXISTS';
64
- if (!isIgnorableError) {
65
- throw e;
66
- }
67
- }
68
- }
69
- async function ensureBranchExistsAsync({ appId, name: branchName, }) {
70
- const { app } = await (0, view_1.viewUpdateBranchAsync)({
71
- appId,
72
- name: branchName,
73
- });
74
- const updateBranch = app === null || app === void 0 ? void 0 : app.byId.updateBranchByName;
75
- if (updateBranch) {
76
- const { id, updates } = updateBranch;
77
- await ensureChannelExistsAsync({ appId, branchId: id, channelName: branchName });
78
- return { id, updates };
79
- }
80
- const newUpdateBranch = await (0, create_2.createUpdateBranchOnAppAsync)({ appId, name: branchName });
81
- log_1.default.withTick(`Created branch: ${chalk_1.default.bold(branchName)}`);
82
- await ensureChannelExistsAsync({ appId, branchId: newUpdateBranch.id, channelName: branchName });
83
- return { id: newUpdateBranch.id, updates: [] };
84
- }
85
5
  class BranchPublish extends EasCommand_1.default {
86
6
  async runAsync() {
87
- var _a, _b, _c;
88
- let { args: { name: branchName }, flags: { json: jsonFlag, auto: autoFlag, message, republish, group, 'input-dir': inputDir, 'skip-bundler': skipBundler, }, } = this.parse(BranchPublish);
89
- const platformFlag = this.parse(BranchPublish).flags.platform;
90
- // If a group was specified, that means we are republishing it.
91
- republish = group ? true : republish;
92
- const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
93
- const { exp } = (0, config_1.getConfig)(projectDir, {
94
- skipSDKVersionRequirement: true,
95
- isPublicConfig: true,
96
- });
97
- const runtimeVersions = await getRuntimeVersionObjectAsync(exp, platformFlag, projectDir);
98
- const projectId = await (0, projectUtils_1.getProjectIdAsync)(exp);
99
- await checkEASUpdateURLIsSetAsync(exp);
100
- if (!branchName && autoFlag) {
101
- branchName =
102
- (await (0, vcs_1.getVcsClient)().getBranchNameAsync()) ||
103
- `branch-${Math.random().toString(36).substr(2, 4)}`;
104
- }
105
- if (!branchName) {
106
- const validationMessage = 'branch name may not be empty.';
107
- if (jsonFlag) {
108
- throw new Error(validationMessage);
109
- }
110
- const branches = await (0, list_1.listBranchesAsync)({ projectId });
111
- branchName = await (0, prompts_1.selectAsync)('which branch would you like to publish on?', branches.map(branch => {
112
- return {
113
- title: `${branch.name} ${chalk_1.default.grey(`- current update: ${(0, utils_1.formatUpdate)(branch.updates[0])}`)}`,
114
- value: branch.name,
115
- };
116
- }));
117
- (0, assert_1.default)(branchName, 'branch name must be specified.');
118
- }
119
- const { id: branchId, updates } = await ensureBranchExistsAsync({
120
- appId: projectId,
121
- name: branchName,
122
- });
123
- let unsortedUpdateInfoGroups = {};
124
- let oldMessage, oldRuntimeVersion;
125
- if (republish) {
126
- // If we are republishing, we don't need to worry about building the bundle or uploading the assets.
127
- // Instead we get the `updateInfoGroup` from the update we wish to republish.
128
- let updatesToRepublish;
129
- if (group) {
130
- updatesToRepublish = await getUpdateGroupAsync({ group });
131
- }
132
- else {
133
- // Drop into interactive mode if the user has not specified an update group to republish.
134
- if (jsonFlag) {
135
- throw new Error('You must specify the update group to republish.');
136
- }
137
- const updateGroups = (0, uniqBy_1.default)(updates, u => u.group)
138
- .filter(update => {
139
- // Only show groups that have updates on the specified platform(s).
140
- return platformFlag === 'all' || update.platform === platformFlag;
141
- })
142
- .map(update => ({
143
- title: formatUpdateTitle(update),
144
- value: update.group,
145
- }));
146
- if (updateGroups.length === 0) {
147
- throw new Error(`There are no updates on branch "${branchName}" published on the platform(s) ${platformFlag}. Did you mean to publish a new update instead?`);
148
- }
149
- const selectedUpdateGroup = await (0, prompts_1.selectAsync)('which update would you like to republish?', updateGroups);
150
- updatesToRepublish = updates.filter(update => update.group === selectedUpdateGroup);
151
- }
152
- const updatesToRepublishFilteredByPlatform = updatesToRepublish.filter(
153
- // Only republish to the specified platforms
154
- update => platformFlag === 'all' || update.platform === platformFlag);
155
- if (updatesToRepublishFilteredByPlatform.length === 0) {
156
- throw new Error(`There are no updates on branch "${branchName}" published on the platform(s) "${platformFlag}" with group ID "${group ? group : updatesToRepublish[0].group}". Did you mean to publish a new update instead?`);
157
- }
158
- let publicationPlatformMessage;
159
- if (platformFlag === 'all') {
160
- if (updatesToRepublishFilteredByPlatform.length !== exports.defaultPublishPlatforms.length) {
161
- log_1.default.warn(`You are republishing an update that wasn't published for all platforms.`);
162
- }
163
- publicationPlatformMessage = `The republished update will appear on the same plaforms it was originally published on: ${updatesToRepublishFilteredByPlatform
164
- .map(update => update.platform)
165
- .join(',')}`;
166
- }
167
- else {
168
- publicationPlatformMessage = `The republished update will appear only on: ${platformFlag}`;
169
- }
170
- log_1.default.withTick(publicationPlatformMessage);
171
- for (const update of updatesToRepublishFilteredByPlatform) {
172
- const { manifestFragment } = update;
173
- const platform = update.platform;
174
- unsortedUpdateInfoGroups[platform] = JSON.parse(manifestFragment);
175
- }
176
- // These are the same for each member of an update group
177
- group = updatesToRepublishFilteredByPlatform[0].group;
178
- oldMessage = (_a = updatesToRepublishFilteredByPlatform[0].message) !== null && _a !== void 0 ? _a : '';
179
- oldRuntimeVersion = updatesToRepublishFilteredByPlatform[0].runtimeVersion;
180
- }
181
- else {
182
- // build bundle and upload assets for a new publish
183
- if (!skipBundler) {
184
- await (0, publish_1.buildBundlesAsync)({ projectDir, inputDir });
185
- }
186
- const assetSpinner = (0, ora_1.ora)('Uploading assets...').start();
187
- try {
188
- const platforms = platformFlag === 'all' ? exports.defaultPublishPlatforms : [platformFlag];
189
- const assets = await (0, publish_1.collectAssetsAsync)({ inputDir: inputDir, platforms });
190
- await (0, publish_1.uploadAssetsAsync)(assets);
191
- unsortedUpdateInfoGroups = await (0, publish_1.buildUnsortedUpdateInfoGroupAsync)(assets, exp);
192
- assetSpinner.succeed('Uploaded assets!');
193
- }
194
- catch (e) {
195
- assetSpinner.fail('Failed to upload assets');
196
- throw e;
197
- }
198
- }
199
- if (!message && autoFlag) {
200
- message = (_b = (await (0, vcs_1.getVcsClient)().getLastCommitMessageAsync())) === null || _b === void 0 ? void 0 : _b.trim();
201
- }
202
- if (!message) {
203
- const validationMessage = 'publish message may not be empty.';
204
- if (jsonFlag) {
205
- throw new Error(validationMessage);
206
- }
207
- ({ publishMessage: message } = await (0, prompts_1.promptAsync)({
208
- type: 'text',
209
- name: 'publishMessage',
210
- message: `Please enter a publication message.`,
211
- initial: republish
212
- ? `Republish "${oldMessage}" - group: ${group}`
213
- : (_c = (await (0, vcs_1.getVcsClient)().getLastCommitMessageAsync())) === null || _c === void 0 ? void 0 : _c.trim(),
214
- validate: value => (value ? true : validationMessage),
215
- }));
216
- }
217
- const runtimeToPlatformMapping = {};
218
- for (const runtime of new Set(Object.values(runtimeVersions))) {
219
- runtimeToPlatformMapping[runtime] = Object.entries(runtimeVersions)
220
- .filter(pair => pair[1] === runtime)
221
- .map(pair => pair[0]);
222
- }
223
- // Sort the updates into different groups based on their platform specific runtime versions
224
- const updateGroups = Object.entries(runtimeToPlatformMapping).map(([runtime, platforms]) => {
225
- const localUpdateInfoGroup = Object.fromEntries(platforms.map(platform => [
226
- platform,
227
- unsortedUpdateInfoGroups[platform],
228
- ]));
229
- if (republish && !oldRuntimeVersion) {
230
- throw new Error('Can not find the runtime version of the update group that is being republished.');
231
- }
232
- return {
233
- branchId,
234
- updateInfoGroup: localUpdateInfoGroup,
235
- runtimeVersion: republish ? oldRuntimeVersion : runtime,
236
- message,
237
- };
238
- });
239
- let newUpdates;
240
- const publishSpinner = (0, ora_1.ora)('Publishing...').start();
241
- try {
242
- newUpdates = await PublishMutation_1.PublishMutation.publishUpdateGroupAsync(updateGroups);
243
- publishSpinner.succeed('Published!');
244
- }
245
- catch (e) {
246
- publishSpinner.fail('Failed to published updates');
247
- throw e;
248
- }
249
- if (jsonFlag) {
250
- log_1.default.log(JSON.stringify(newUpdates));
251
- }
252
- else {
253
- if (new Set(newUpdates.map(update => update.group)).size > 1) {
254
- log_1.default.addNewLineIfNone();
255
- log_1.default.log('👉 Since multiple runtime versions are defined, multiple update groups have been published.');
256
- }
257
- log_1.default.addNewLineIfNone();
258
- for (const runtime of new Set(Object.values(runtimeVersions))) {
259
- const platforms = newUpdates
260
- .filter(update => update.runtimeVersion === runtime)
261
- .map(update => update.platform);
262
- const newUpdate = newUpdates.find(update => update.runtimeVersion === runtime);
263
- if (!newUpdate) {
264
- throw new Error(`Publish response is missing updates with runtime ${runtime}.`);
265
- }
266
- log_1.default.log((0, formatFields_1.default)([
267
- { label: 'branch', value: branchName },
268
- { label: 'runtime version', value: runtime },
269
- { label: 'platform', value: platforms.join(',') },
270
- { label: 'update group ID', value: newUpdate.group },
271
- { label: 'message', value: message },
272
- ]));
273
- log_1.default.addNewLineIfNone();
274
- }
275
- }
7
+ throw new Error(BranchPublish.description);
276
8
  }
277
9
  }
278
10
  exports.default = BranchPublish;
11
+ BranchPublish.description = 'deprecated, use "eas update"';
279
12
  BranchPublish.hidden = true;
280
- BranchPublish.description = 'Publish an update group to a branch.';
281
- BranchPublish.args = [
282
- {
283
- name: 'name',
284
- description: 'Name of the branch to publish on',
285
- },
286
- ];
287
- BranchPublish.flags = {
288
- message: command_1.flags.string({
289
- description: 'short message describing the updates.',
290
- required: false,
291
- }),
292
- republish: command_1.flags.boolean({
293
- description: 'republish an update group',
294
- exclusive: ['input-dir', 'skip-bundler'],
295
- }),
296
- group: command_1.flags.string({
297
- description: 'update group to republish',
298
- exclusive: ['input-dir', 'skip-bundler'],
299
- }),
300
- 'input-dir': command_1.flags.string({
301
- description: 'location of the bundle',
302
- default: 'dist',
303
- required: false,
304
- }),
305
- 'skip-bundler': command_1.flags.boolean({
306
- description: `skip running Expo CLI to bundle the app before publishing`,
307
- default: false,
308
- }),
309
- platform: command_1.flags.enum({
310
- char: 'p',
311
- description: `only publish to a single platform`,
312
- options: [...exports.defaultPublishPlatforms, 'all'],
313
- default: 'all',
314
- required: false,
315
- }),
316
- json: command_1.flags.boolean({
317
- description: `return a json with the new update group.`,
318
- default: false,
319
- }),
320
- auto: command_1.flags.boolean({
321
- description: 'use the current git branch and commit message for the EAS branch and update message',
322
- default: false,
323
- }),
324
- };
325
- async function getRuntimeVersionObjectAsync(exp, platformFlag, projectDir) {
326
- var _a, _b;
327
- const platforms = (platformFlag === 'all' ? ['android', 'ios'] : [platformFlag]);
328
- for (const platform of platforms) {
329
- const isPolicy = typeof ((_b = (_a = exp[platform]) === null || _a === void 0 ? void 0 : _a.runtimeVersion) !== null && _b !== void 0 ? _b : exp.runtimeVersion) === 'object';
330
- if (isPolicy) {
331
- const isManaged = (await (0, workflow_1.resolveWorkflowAsync)(projectDir, platform)) === eas_build_job_1.Workflow.MANAGED;
332
- if (!isManaged) {
333
- throw new Error('Runtime version policies are only supported in the managed workflow.');
334
- }
335
- }
336
- }
337
- return Object.fromEntries(platforms.map(platform => [platform, config_plugins_1.Updates.getRuntimeVersion(exp, platform)]));
338
- }
339
- function formatUpdateTitle(update) {
340
- const { message, createdAt, actor, runtimeVersion } = update;
341
- let actorName;
342
- switch (actor === null || actor === void 0 ? void 0 : actor.__typename) {
343
- case 'User': {
344
- actorName = actor.username;
345
- break;
346
- }
347
- case 'Robot': {
348
- const { firstName, id } = actor;
349
- actorName = firstName !== null && firstName !== void 0 ? firstName : `robot: ${id.slice(0, 4)}...`;
350
- break;
351
- }
352
- default:
353
- actorName = 'unknown';
354
- }
355
- return `[${(0, dateformat_1.default)(createdAt, 'mmm dd HH:MM')} by ${actorName}, runtimeVersion: ${runtimeVersion}] ${message}`;
356
- }
357
- async function checkEASUpdateURLIsSetAsync(exp) {
358
- var _a;
359
- const configuredURL = (_a = exp.updates) === null || _a === void 0 ? void 0 : _a.url;
360
- const expectedURL = await (0, configure_1.getEASUpdateURLAsync)(exp);
361
- if (configuredURL !== expectedURL) {
362
- throw new Error(`The update URL is incorrectly configured for EAS Update. Please set updates.url to ${expectedURL} in your app.json.`);
363
- }
364
- }
@@ -1,7 +1,6 @@
1
1
  import { flags } from '@oclif/command';
2
2
  import EasCommand from '../../commandUtils/EasCommand';
3
3
  export default class BranchRename extends EasCommand {
4
- static hidden: boolean;
5
4
  static description: string;
6
5
  static flags: {
7
6
  from: flags.IOptionFlag<string | undefined>;
@@ -75,7 +75,6 @@ class BranchRename extends EasCommand_1.default {
75
75
  }
76
76
  }
77
77
  exports.default = BranchRename;
78
- BranchRename.hidden = true;
79
78
  BranchRename.description = 'Rename a branch.';
80
79
  BranchRename.flags = {
81
80
  from: command_1.flags.string({
@@ -2,7 +2,6 @@ import EasCommand from '../../commandUtils/EasCommand';
2
2
  import { ViewBranchQuery, ViewBranchQueryVariables } from '../../graphql/generated';
3
3
  export declare function viewUpdateBranchAsync({ appId, name, }: Pick<ViewBranchQueryVariables, 'appId' | 'name'>): Promise<ViewBranchQuery>;
4
4
  export default class BranchView extends EasCommand {
5
- static hidden: boolean;
6
5
  static description: string;
7
6
  static args: {
8
7
  name: string;
@@ -115,7 +115,6 @@ class BranchView extends EasCommand_1.default {
115
115
  }
116
116
  }
117
117
  exports.default = BranchView;
118
- BranchView.hidden = true;
119
118
  BranchView.description = 'View a branch.';
120
119
  BranchView.args = [
121
120
  {
@@ -44,7 +44,7 @@ function logSuccess(platform) {
44
44
  }
45
45
  else if (platform === 'ios') {
46
46
  platformsText = 'iOS project is';
47
- storesText = 'the Apple App Store';
47
+ storesText = 'the Apple App Store Connect';
48
48
  }
49
49
  log_1.default.log(`🎉 Your ${platformsText} ready to build.
50
50
 
@@ -15,12 +15,7 @@ export default class Build extends EasCommand {
15
15
  'auto-submit': import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
16
16
  'auto-submit-with-profile': flags.IOptionFlag<string | undefined>;
17
17
  };
18
- private metroConfigValidated;
19
18
  runAsync(): Promise<void>;
20
19
  private sanitizeFlagsAsync;
21
- private prepareAndStartBuildAsync;
22
- private startBuildAsync;
23
- private prepareAndStartSubmissionAsync;
24
- private exitWithNonZeroCodeIfSomeBuildsFailed;
25
20
  }
26
21
  export declare function handleDeprecatedEasJsonAsync(projectDir: string, nonInteractive: boolean): Promise<void>;
@@ -2,126 +2,33 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.handleDeprecatedEasJsonAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const eas_build_job_1 = require("@expo/eas-build-job");
6
5
  const eas_json_1 = require("@expo/eas-json");
7
6
  const command_1 = require("@oclif/command");
8
7
  const errors_1 = require("@oclif/errors");
9
8
  const chalk_1 = (0, tslib_1.__importDefault)(require("chalk"));
10
9
  const figures_1 = (0, tslib_1.__importDefault)(require("figures"));
11
10
  const fs_extra_1 = (0, tslib_1.__importDefault)(require("fs-extra"));
12
- const nullthrows_1 = (0, tslib_1.__importDefault)(require("nullthrows"));
13
- const build_1 = require("../../build/android/build");
14
- const build_2 = require("../../build/build");
15
- const configure_1 = require("../../build/configure");
16
- const createContext_1 = require("../../build/createContext");
17
- const build_3 = require("../../build/ios/build");
18
- const devClient_1 = require("../../build/utils/devClient");
19
- const printBuildInfo_1 = require("../../build/utils/printBuildInfo");
11
+ const runBuildAndSubmit_1 = require("../../build/runBuildAndSubmit");
20
12
  const repository_1 = require("../../build/utils/repository");
21
13
  const EasCommand_1 = (0, tslib_1.__importDefault)(require("../../commandUtils/EasCommand"));
22
- const generated_1 = require("../../graphql/generated");
23
- const AppPlatform_1 = require("../../graphql/types/AppPlatform");
24
14
  const log_1 = (0, tslib_1.__importStar)(require("../../log"));
25
15
  const platform_1 = require("../../platform");
26
- const metroConfig_1 = require("../../project/metroConfig");
27
16
  const projectUtils_1 = require("../../project/projectUtils");
28
17
  const prompts_1 = require("../../prompts");
29
- const context_1 = require("../../submit/context");
30
- const submit_1 = require("../../submit/submit");
31
- const urls_1 = require("../../submit/utils/urls");
32
18
  const easCli_1 = require("../../utils/easCli");
33
19
  const json_1 = require("../../utils/json");
34
- const profiles_1 = require("../../utils/profiles");
35
20
  const vcs_1 = require("../../vcs");
36
21
  const git_1 = (0, tslib_1.__importDefault)(require("../../vcs/clients/git"));
37
22
  class Build extends EasCommand_1.default {
38
- constructor() {
39
- super(...arguments);
40
- this.metroConfigValidated = false;
41
- }
42
23
  async runAsync() {
43
- var _a;
44
24
  const { flags: rawFlags } = this.parse(Build);
45
25
  if (rawFlags.json) {
46
26
  (0, json_1.enableJsonOutput)();
47
27
  }
48
28
  const flags = await this.sanitizeFlagsAsync(rawFlags);
49
- const { requestedPlatform } = flags;
50
29
  const projectDir = await (0, projectUtils_1.findProjectRootAsync)();
51
30
  await handleDeprecatedEasJsonAsync(projectDir, flags.nonInteractive);
52
- await (0, vcs_1.getVcsClient)().ensureRepoExistsAsync();
53
- await (0, repository_1.ensureRepoIsCleanAsync)(flags.nonInteractive);
54
- await (0, configure_1.ensureProjectConfiguredAsync)(projectDir, requestedPlatform);
55
- const platforms = (0, platform_1.toPlatforms)(requestedPlatform);
56
- const buildProfiles = await (0, profiles_1.getProfilesAsync)({
57
- type: 'build',
58
- projectDir,
59
- platforms,
60
- profileName: (_a = flags.profile) !== null && _a !== void 0 ? _a : undefined,
61
- });
62
- await (0, devClient_1.ensureExpoDevClientInstalledForDevClientBuildsAsync)({
63
- projectDir,
64
- nonInteractive: flags.nonInteractive,
65
- buildProfiles,
66
- });
67
- const startedBuilds = [];
68
- const buildCtxByPlatform = {};
69
- for (const buildProfile of buildProfiles) {
70
- const { build: maybeBuild, buildCtx } = await this.prepareAndStartBuildAsync({
71
- projectDir,
72
- flags,
73
- moreBuilds: platforms.length > 1,
74
- buildProfile,
75
- });
76
- if (maybeBuild) {
77
- startedBuilds.push({ build: maybeBuild, buildProfile });
78
- }
79
- buildCtxByPlatform[(0, AppPlatform_1.toAppPlatform)(buildProfile.platform)] = buildCtx;
80
- }
81
- if (flags.local) {
82
- return;
83
- }
84
- log_1.default.newLine();
85
- (0, printBuildInfo_1.printLogsUrls)(startedBuilds.map(startedBuild => startedBuild.build));
86
- log_1.default.newLine();
87
- const submissions = [];
88
- if (flags.autoSubmit) {
89
- const submitProfiles = await (0, profiles_1.getProfilesAsync)({
90
- projectDir,
91
- platforms,
92
- profileName: flags.submitProfile,
93
- type: 'submit',
94
- });
95
- for (const startedBuild of startedBuilds) {
96
- const submitProfile = (0, nullthrows_1.default)(submitProfiles.find(({ platform }) => (0, AppPlatform_1.toAppPlatform)(platform) === startedBuild.build.platform)).profile;
97
- const submission = await this.prepareAndStartSubmissionAsync({
98
- build: startedBuild.build,
99
- buildCtx: (0, nullthrows_1.default)(buildCtxByPlatform[startedBuild.build.platform]),
100
- moreBuilds: startedBuilds.length > 1,
101
- projectDir,
102
- buildProfile: startedBuild.buildProfile.profile,
103
- submitProfile,
104
- nonInteractive: flags.nonInteractive,
105
- });
106
- submissions.push(submission);
107
- }
108
- log_1.default.newLine();
109
- (0, urls_1.printSubmissionDetailsUrls)(submissions);
110
- log_1.default.newLine();
111
- }
112
- if (!flags.wait) {
113
- return;
114
- }
115
- const builds = await (0, build_2.waitForBuildEndAsync)(startedBuilds.map(({ build }) => build.id));
116
- (0, printBuildInfo_1.printBuildResults)(builds, flags.json);
117
- 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));
118
- if (haveAllBuildsFailedOrCanceled || !flags.autoSubmit) {
119
- this.exitWithNonZeroCodeIfSomeBuildsFailed(builds);
120
- }
121
- else {
122
- // the following function also exits with non zero code if any of the submissions failed
123
- await (0, submit_1.waitToCompleteAsync)(submissions);
124
- }
31
+ await (0, runBuildAndSubmit_1.runBuildAndSubmitAsync)(projectDir, flags);
125
32
  }
126
33
  async sanitizeFlagsAsync(flags) {
127
34
  var _a;
@@ -155,7 +62,11 @@ class Build extends EasCommand_1.default {
155
62
  skipProjectConfiguration: flags['skip-project-configuration'],
156
63
  profile,
157
64
  nonInteractive,
158
- local: flags['local'],
65
+ localBuildOptions: flags['local']
66
+ ? { enable: true, verbose: true }
67
+ : {
68
+ enable: false,
69
+ },
159
70
  wait: flags['wait'],
160
71
  clearCache: flags['clear-cache'],
161
72
  json: flags['json'],
@@ -163,71 +74,9 @@ class Build extends EasCommand_1.default {
163
74
  submitProfile: (_a = flags['auto-submit-with-profile']) !== null && _a !== void 0 ? _a : profile,
164
75
  };
165
76
  }
166
- async prepareAndStartBuildAsync({ projectDir, flags, moreBuilds, buildProfile, }) {
167
- const buildCtx = await (0, createContext_1.createBuildContextAsync)({
168
- buildProfileName: buildProfile.profileName,
169
- clearCache: flags.clearCache,
170
- buildProfile: buildProfile.profile,
171
- local: flags.local,
172
- nonInteractive: flags.nonInteractive,
173
- platform: buildProfile.platform,
174
- projectDir,
175
- skipProjectConfiguration: flags.skipProjectConfiguration,
176
- });
177
- if (moreBuilds) {
178
- log_1.default.newLine();
179
- const appPlatform = (0, AppPlatform_1.toAppPlatform)(buildProfile.platform);
180
- log_1.default.log(`${platform_1.appPlatformEmojis[appPlatform]} ${chalk_1.default.bold(`${platform_1.appPlatformDisplayNames[appPlatform]} build`)}`);
181
- }
182
- if (buildCtx.workflow === eas_build_job_1.Workflow.MANAGED && !this.metroConfigValidated) {
183
- await (0, metroConfig_1.validateMetroConfigForManagedWorkflowAsync)(buildCtx);
184
- this.metroConfigValidated = true;
185
- }
186
- const build = await this.startBuildAsync(buildCtx);
187
- return {
188
- build,
189
- buildCtx,
190
- };
191
- }
192
- async startBuildAsync(ctx) {
193
- let sendBuildRequestAsync;
194
- if (ctx.platform === eas_build_job_1.Platform.ANDROID) {
195
- sendBuildRequestAsync = await (0, build_1.prepareAndroidBuildAsync)(ctx);
196
- }
197
- else {
198
- sendBuildRequestAsync = await (0, build_3.prepareIosBuildAsync)(ctx);
199
- }
200
- return await sendBuildRequestAsync();
201
- }
202
- async prepareAndStartSubmissionAsync({ build, buildCtx, moreBuilds, projectDir, buildProfile, submitProfile, nonInteractive, }) {
203
- var _a, _b, _c;
204
- const platform = (0, AppPlatform_1.toPlatform)(build.platform);
205
- const submissionCtx = await (0, context_1.createSubmissionContextAsync)({
206
- platform,
207
- projectDir,
208
- projectId: build.project.id,
209
- profile: submitProfile,
210
- archiveFlags: { id: build.id },
211
- nonInteractive,
212
- env: buildProfile.env,
213
- credentialsCtx: buildCtx.credentialsCtx,
214
- applicationIdentifier: (_b = (_a = buildCtx.android) === null || _a === void 0 ? void 0 : _a.applicationId) !== null && _b !== void 0 ? _b : (_c = buildCtx.ios) === null || _c === void 0 ? void 0 : _c.bundleIdentifier,
215
- });
216
- if (moreBuilds) {
217
- log_1.default.newLine();
218
- log_1.default.log(`${platform_1.appPlatformEmojis[build.platform]} ${chalk_1.default.bold(`${platform_1.appPlatformDisplayNames[build.platform]} submission`)}`);
219
- }
220
- return await (0, submit_1.submitAsync)(submissionCtx);
221
- }
222
- exitWithNonZeroCodeIfSomeBuildsFailed(maybeBuilds) {
223
- const failedBuilds = maybeBuilds.filter(i => i).filter(i => i.status === generated_1.BuildStatus.Errored);
224
- if (failedBuilds.length > 0) {
225
- process.exit(1);
226
- }
227
- }
228
77
  }
229
78
  exports.default = Build;
230
- Build.description = 'start a build';
79
+ Build.description = 'Start a build';
231
80
  Build.flags = {
232
81
  platform: command_1.flags.enum({
233
82
  char: 'p',
@@ -0,0 +1,22 @@
1
+ import { flags } from '@oclif/command';
2
+ import EasCommand from '../../commandUtils/EasCommand';
3
+ import { RequestedPlatform } from '../../platform';
4
+ declare enum InspectStage {
5
+ ARCHIVE = "archive",
6
+ PRE_BUILD = "pre-build",
7
+ POST_BUILD = "post-build"
8
+ }
9
+ export default class BuildInspect extends EasCommand {
10
+ static description: string;
11
+ static flags: {
12
+ platform: flags.IOptionFlag<RequestedPlatform>;
13
+ profile: flags.IOptionFlag<string | undefined>;
14
+ stage: flags.IOptionFlag<InspectStage>;
15
+ output: flags.IOptionFlag<string>;
16
+ force: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
17
+ verbose: import("@oclif/parser/lib/flags").IBooleanFlag<boolean>;
18
+ };
19
+ runAsync(): Promise<void>;
20
+ private prepareOutputDirAsync;
21
+ }
22
+ export {};