eas-cli 3.3.2 → 3.4.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.
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.waitForBuildEndAsync = exports.prepareBuildRequestForPlatformAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const eas_build_job_1 = require("@expo/eas-build-job");
6
+ const eas_json_1 = require("@expo/eas-json");
7
+ const assert_1 = tslib_1.__importDefault(require("assert"));
6
8
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
9
  const cli_progress_1 = tslib_1.__importDefault(require("cli-progress"));
8
10
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
@@ -15,8 +17,10 @@ const BuildQuery_1 = require("../graphql/queries/BuildQuery");
15
17
  const log_1 = tslib_1.__importStar(require("../log"));
16
18
  const ora_1 = require("../ora");
17
19
  const platform_1 = require("../platform");
20
+ const prompts_1 = require("../prompts");
18
21
  const uploads_1 = require("../uploads");
19
22
  const files_1 = require("../utils/files");
23
+ const json_1 = require("../utils/json");
20
24
  const progress_1 = require("../utils/progress");
21
25
  const promise_1 = require("../utils/promise");
22
26
  const vcs_1 = require("../vcs");
@@ -47,15 +51,26 @@ async function prepareBuildRequestForPlatformAsync(builder) {
47
51
  log_1.default.addNewLineIfNone();
48
52
  await (0, repository_1.reviewAndCommitChangesAsync)(`[EAS Build] Run EAS Build for ${platform_1.requestedPlatformDisplayNames[ctx.platform]}`, { nonInteractive: ctx.nonInteractive });
49
53
  }
50
- const projectArchive = ctx.localBuildOptions.enable
51
- ? {
54
+ let projectArchive;
55
+ if (ctx.localBuildOptions.localBuildMode === local_1.LocalBuildMode.LOCAL_BUILD_PLUGIN) {
56
+ projectArchive = {
52
57
  type: eas_build_job_1.ArchiveSourceType.PATH,
53
58
  path: (await (0, repository_1.makeProjectTarballAsync)()).path,
54
- }
55
- : {
59
+ };
60
+ }
61
+ else if (ctx.localBuildOptions.localBuildMode === local_1.LocalBuildMode.INTERNAL) {
62
+ projectArchive = {
63
+ type: eas_build_job_1.ArchiveSourceType.PATH,
64
+ path: process.cwd(),
65
+ };
66
+ }
67
+ else if (!ctx.localBuildOptions.localBuildMode) {
68
+ projectArchive = {
56
69
  type: eas_build_job_1.ArchiveSourceType.GCS,
57
70
  bucketKey: await uploadProjectAsync(ctx),
58
71
  };
72
+ }
73
+ (0, assert_1.default)(projectArchive);
59
74
  const metadata = await (0, metadata_1.collectMetadataAsync)(ctx);
60
75
  const buildParams = resolveBuildParamsInput(ctx);
61
76
  const job = await builder.prepareJobAsync(ctx, {
@@ -63,11 +78,15 @@ async function prepareBuildRequestForPlatformAsync(builder) {
63
78
  credentials: credentialsResult === null || credentialsResult === void 0 ? void 0 : credentialsResult.credentials,
64
79
  });
65
80
  return async () => {
66
- if (ctx.localBuildOptions.enable) {
81
+ if (ctx.localBuildOptions.localBuildMode === local_1.LocalBuildMode.LOCAL_BUILD_PLUGIN) {
67
82
  await (0, local_1.runLocalBuildAsync)(job, metadata, ctx.localBuildOptions);
68
83
  return undefined;
69
84
  }
70
- else {
85
+ else if (ctx.localBuildOptions.localBuildMode === local_1.LocalBuildMode.INTERNAL) {
86
+ (0, json_1.printJsonOnlyOutput)({ job, metadata });
87
+ return undefined;
88
+ }
89
+ else if (!ctx.localBuildOptions.localBuildMode) {
71
90
  try {
72
91
  return await sendBuildRequestAsync(builder, job, metadata, buildParams);
73
92
  }
@@ -75,32 +94,30 @@ async function prepareBuildRequestForPlatformAsync(builder) {
75
94
  handleBuildRequestError(error, job.platform);
76
95
  }
77
96
  }
97
+ else {
98
+ throw new Error('Unknown localBuildMode.');
99
+ }
78
100
  };
79
101
  }
80
102
  exports.prepareBuildRequestForPlatformAsync = prepareBuildRequestForPlatformAsync;
103
+ const SERVER_SIDE_DEFINED_ERRORS = [
104
+ 'TURTLE_DEPRECATED_JOB_FORMAT',
105
+ 'EAS_BUILD_FREE_TIER_DISABLED',
106
+ 'EAS_BUILD_FREE_TIER_DISABLED_IOS',
107
+ 'EAS_BUILD_FREE_TIER_DISABLED_ANDROID',
108
+ ];
81
109
  function handleBuildRequestError(error, platform) {
82
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
83
- if (((_c = (_b = (_a = error === null || error === void 0 ? void 0 : error.graphQLErrors) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.extensions) === null || _c === void 0 ? void 0 : _c.errorCode) === 'TURTLE_DEPRECATED_JOB_FORMAT') {
84
- log_1.default.error('EAS Build API has changed. Upgrade to the latest eas-cli version.');
110
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
111
+ log_1.default.debug(JSON.stringify(error.graphQLErrors, null, 2));
112
+ if (SERVER_SIDE_DEFINED_ERRORS.includes((_c = (_b = (_a = error === null || error === void 0 ? void 0 : error.graphQLErrors) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.extensions) === null || _c === void 0 ? void 0 : _c.errorCode)) {
113
+ log_1.default.error((_e = (_d = error === null || error === void 0 ? void 0 : error.graphQLErrors) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.message);
85
114
  throw new Error('Build request failed.');
86
115
  }
87
- else if (((_f = (_e = (_d = error === null || error === void 0 ? void 0 : error.graphQLErrors) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.extensions) === null || _f === void 0 ? void 0 : _f.errorCode) === 'EAS_BUILD_DOWN_FOR_MAINTENANCE') {
116
+ else if (((_h = (_g = (_f = error === null || error === void 0 ? void 0 : error.graphQLErrors) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.extensions) === null || _h === void 0 ? void 0 : _h.errorCode) === 'EAS_BUILD_DOWN_FOR_MAINTENANCE') {
88
117
  log_1.default.error(`EAS Build is down for maintenance. Try again later. Check ${(0, log_1.link)('https://status.expo.dev/')} for updates.`);
89
118
  throw new Error('Build request failed.');
90
119
  }
91
- else if (((_j = (_h = (_g = error === null || error === void 0 ? void 0 : error.graphQLErrors) === null || _g === void 0 ? void 0 : _g[0]) === null || _h === void 0 ? void 0 : _h.extensions) === null || _j === void 0 ? void 0 : _j.errorCode) === 'EAS_BUILD_FREE_TIER_DISABLED') {
92
- log_1.default.error(`EAS Build free tier is temporarily disabled and we are not accepting any new builds. Try again later. ${(0, log_1.learnMore)('https://expo.fyi/eas-build-queues')}`);
93
- throw new Error('Build request failed.');
94
- }
95
- else if (((_m = (_l = (_k = error === null || error === void 0 ? void 0 : error.graphQLErrors) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.extensions) === null || _m === void 0 ? void 0 : _m.errorCode) === 'EAS_BUILD_FREE_TIER_DISABLED_IOS') {
96
- log_1.default.error(`EAS Build free tier is temporarily disabled for iOS and we are not accepting any new builds. Try again later. ${(0, log_1.learnMore)('https://expo.fyi/eas-build-queues')}`);
97
- throw new Error('Build request failed.');
98
- }
99
- else if (((_q = (_p = (_o = error === null || error === void 0 ? void 0 : error.graphQLErrors) === null || _o === void 0 ? void 0 : _o[0]) === null || _p === void 0 ? void 0 : _p.extensions) === null || _q === void 0 ? void 0 : _q.errorCode) === 'EAS_BUILD_FREE_TIER_DISABLED_ANDROID') {
100
- log_1.default.error(`EAS Build free tier is temporarily disabled for Android and we are not accepting any new builds. Try again later. ${(0, log_1.learnMore)('https://expo.fyi/eas-build-queues')}`);
101
- throw new Error('Build request failed.');
102
- }
103
- else if (((_t = (_s = (_r = error === null || error === void 0 ? void 0 : error.graphQLErrors) === null || _r === void 0 ? void 0 : _r[0]) === null || _s === void 0 ? void 0 : _s.extensions) === null || _t === void 0 ? void 0 : _t.errorCode) === 'EAS_BUILD_TOO_MANY_PENDING_BUILDS') {
120
+ else if (((_l = (_k = (_j = error === null || error === void 0 ? void 0 : error.graphQLErrors) === null || _j === void 0 ? void 0 : _j[0]) === null || _k === void 0 ? void 0 : _k.extensions) === null || _l === void 0 ? void 0 : _l.errorCode) === 'EAS_BUILD_TOO_MANY_PENDING_BUILDS') {
104
121
  log_1.default.error(`You have already reached the maximum number of pending ${platform_1.requestedPlatformDisplayNames[platform]} builds for your account. Try again later.`);
105
122
  throw new Error('Build request failed.');
106
123
  }
@@ -155,7 +172,7 @@ async function sendBuildRequestAsync(builder, job, metadata, buildParams) {
155
172
  properties: ctx.analyticsEventProperties,
156
173
  });
157
174
  }
158
- async function waitForBuildEndAsync(graphqlClient, { buildIds, accountName }, { intervalSec = 10 } = {}) {
175
+ async function waitForBuildEndAsync(graphqlClient, { buildIds, accountName, projectDir, nonInteractive, }, { intervalSec = 10 } = {}) {
159
176
  let spinner;
160
177
  let originalSpinnerText;
161
178
  if (buildIds.length === 1) {
@@ -170,7 +187,7 @@ async function waitForBuildEndAsync(graphqlClient, { buildIds, accountName }, {
170
187
  while (true) {
171
188
  const builds = await getBuildsSafelyAsync(graphqlClient, buildIds);
172
189
  const { refetch } = builds.length === 1
173
- ? await handleSingleBuildProgressAsync({ build: builds[0], accountName }, { spinner })
190
+ ? await handleSingleBuildProgressAsync({ build: builds[0], accountName, projectDir, nonInteractive }, { spinner })
174
191
  : await handleMultipleBuildsProgressAsync({ builds }, { spinner, originalSpinnerText });
175
192
  if (!refetch) {
176
193
  return builds;
@@ -193,7 +210,7 @@ async function getBuildsSafelyAsync(graphqlClient, buildIds) {
193
210
  }
194
211
  let queueProgressBarStarted = false;
195
212
  const queueProgressBar = new cli_progress_1.default.SingleBar({ format: '|{bar}| {estimatedWaitTime}' }, cli_progress_1.default.Presets.rect);
196
- async function handleSingleBuildProgressAsync({ build, accountName }, { spinner }) {
213
+ async function handleSingleBuildProgressAsync({ build, accountName, projectDir, nonInteractive, }, { spinner }) {
197
214
  if (build === null) {
198
215
  spinner.text = 'Could not fetch the build status. Check your network connection.';
199
216
  return { refetch: true };
@@ -223,13 +240,46 @@ async function handleSingleBuildProgressAsync({ build, accountName }, { spinner
223
240
  : { estimatedWaitTime: '' };
224
241
  if (!queueProgressBarStarted &&
225
242
  typeof build.initialQueuePosition === 'number' &&
226
- typeof build.queuePosition === 'number') {
243
+ typeof build.queuePosition === 'number' &&
244
+ typeof build.estimatedWaitTimeLeftSeconds === 'number') {
227
245
  spinner.stopAndPersist();
228
246
  if (build.priority !== generated_1.BuildPriority.High) {
229
247
  log_1.default.newLine();
230
248
  log_1.default.log('Start builds sooner in the priority queue.');
231
249
  log_1.default.log(`Sign up for EAS Production or Enterprise at ${(0, log_1.link)(formatAccountSubscriptionsUrl(accountName))}`);
232
250
  }
251
+ if (build.platform === generated_1.AppPlatform.Ios &&
252
+ [generated_1.BuildResourceClass.IosIntelLarge, generated_1.BuildResourceClass.IosIntelMedium].includes(build.resourceClass)) {
253
+ let askToSwitchToM1 = false;
254
+ if (build.priority === generated_1.BuildPriority.High &&
255
+ build.estimatedWaitTimeLeftSeconds >= /* 10 minutes */ 10 * 60) {
256
+ log_1.default.newLine();
257
+ log_1.default.warn(`Warning: Priority queue wait time for legacy iOS Intel workers is longer than usual (more than 10 minutes).`);
258
+ log_1.default.warn(`We recommend switching to the new, faster M1 workers for iOS builds.`);
259
+ log_1.default.warn((0, log_1.learnMore)('https://blog.expo.dev/m1-workers-on-eas-build-dcaa2c1333ad', {
260
+ learnMoreMessage: 'Learn more on switching to M1 workers.',
261
+ }));
262
+ askToSwitchToM1 = true;
263
+ }
264
+ else if (build.priority !== generated_1.BuildPriority.High &&
265
+ build.estimatedWaitTimeLeftSeconds >= /* 120 minutes */ 120 * 60) {
266
+ log_1.default.newLine();
267
+ log_1.default.warn(`Warning: Free tier queue wait time for legacy iOS Intel workers is longer than usual.`);
268
+ log_1.default.warn(`We recommend switching to the new, faster M1 workers for iOS builds.`);
269
+ log_1.default.warn((0, log_1.learnMore)('https://blog.expo.dev/m1-workers-on-eas-build-dcaa2c1333ad', {
270
+ learnMoreMessage: 'Learn more on switching to M1 workers.',
271
+ }));
272
+ askToSwitchToM1 = true;
273
+ }
274
+ if (!nonInteractive && askToSwitchToM1) {
275
+ const shouldSwitchToM1 = await (0, prompts_1.confirmAsync)({
276
+ message: `Switch iOS builds to M1 workers (modifies build profiles in eas.json)?`,
277
+ });
278
+ if (shouldSwitchToM1) {
279
+ await updateIosBuildProfilesToUseM1WorkersAsync(projectDir);
280
+ }
281
+ }
282
+ }
233
283
  log_1.default.newLine();
234
284
  log_1.default.log(`Waiting in ${priorityToQueueDisplayName[build.priority]}`);
235
285
  queueProgressBar.start(build.initialQueuePosition + 1, build.initialQueuePosition - build.queuePosition + 1, progressBarPayload);
@@ -338,3 +388,19 @@ function formatEstimatedWaitTime(estimatedWaitTimeLeftSeconds) {
338
388
  function formatAccountSubscriptionsUrl(accountName) {
339
389
  return new URL(`/accounts/${accountName}/settings/subscriptions`, (0, api_1.getExpoWebsiteBaseUrl)()).toString();
340
390
  }
391
+ async function updateIosBuildProfilesToUseM1WorkersAsync(projectDir) {
392
+ const easJsonAccessor = new eas_json_1.EasJsonAccessor(projectDir);
393
+ await easJsonAccessor.readRawJsonAsync();
394
+ const profileNames = await eas_json_1.EasJsonUtils.getBuildProfileNamesAsync(easJsonAccessor);
395
+ easJsonAccessor.patch(easJsonRawObject => {
396
+ for (const profileName of profileNames) {
397
+ easJsonRawObject.build[profileName].ios = {
398
+ ...easJsonRawObject.build[profileName].ios,
399
+ resourceClass: eas_json_1.ResourceClass.M1_MEDIUM,
400
+ };
401
+ }
402
+ return easJsonRawObject;
403
+ });
404
+ await easJsonAccessor.writeAsync();
405
+ log_1.default.withTick('Updated eas.json. Your next builds will run on M1 workers.');
406
+ }
@@ -44,11 +44,21 @@ const EAS_JSON_MANAGED_DEFAULT = {
44
44
  development: {
45
45
  developmentClient: true,
46
46
  distribution: 'internal',
47
+ ios: {
48
+ resourceClass: eas_json_1.ResourceClass.M1_MEDIUM,
49
+ },
47
50
  },
48
51
  preview: {
49
52
  distribution: 'internal',
53
+ ios: {
54
+ resourceClass: eas_json_1.ResourceClass.M1_MEDIUM,
55
+ },
56
+ },
57
+ production: {
58
+ ios: {
59
+ resourceClass: eas_json_1.ResourceClass.M1_MEDIUM,
60
+ },
50
61
  },
51
- production: {},
52
62
  },
53
63
  submit: {
54
64
  production: {},
@@ -66,12 +76,20 @@ const EAS_JSON_BARE_DEFAULT = {
66
76
  },
67
77
  ios: {
68
78
  buildConfiguration: 'Debug',
79
+ resourceClass: eas_json_1.ResourceClass.M1_MEDIUM,
69
80
  },
70
81
  },
71
82
  preview: {
72
83
  distribution: 'internal',
84
+ ios: {
85
+ resourceClass: eas_json_1.ResourceClass.M1_MEDIUM,
86
+ },
87
+ },
88
+ production: {
89
+ ios: {
90
+ resourceClass: eas_json_1.ResourceClass.M1_MEDIUM,
91
+ },
73
92
  },
74
- production: {},
75
93
  },
76
94
  submit: {
77
95
  production: {},
@@ -1,6 +1,23 @@
1
1
  import { Job, Metadata } from '@expo/eas-build-job';
2
+ export declare enum LocalBuildMode {
3
+ /**
4
+ * Local build that users can run on their own machines. Instead
5
+ * of sending build request to EAS Servers it's passing it as an argument
6
+ * to local-build-plugin, that will run the build locally.
7
+ *
8
+ * Triggered when running `eas build --local`.
9
+ */
10
+ LOCAL_BUILD_PLUGIN = 0,
11
+ /**
12
+ * Type of local build that is not accessible to users directly. When
13
+ * cloud build is triggered by git based integration, we are running
14
+ * in this mode. Instead of sending build request to EAS Servers it's
15
+ * printing it to the stdout as JSON, so EAS Build worker can read it.
16
+ */
17
+ INTERNAL = 1
18
+ }
2
19
  export interface LocalBuildOptions {
3
- enable: boolean;
20
+ localBuildMode?: LocalBuildMode;
4
21
  skipCleanup?: boolean;
5
22
  skipNativeBuild?: boolean;
6
23
  artifactsDir?: string;
@@ -1,12 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runLocalBuildAsync = void 0;
3
+ exports.runLocalBuildAsync = exports.LocalBuildMode = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const spawn_async_1 = tslib_1.__importDefault(require("@expo/spawn-async"));
6
6
  const semver_1 = tslib_1.__importDefault(require("semver"));
7
7
  const ora_1 = require("../ora");
8
8
  const PLUGIN_PACKAGE_NAME = 'eas-cli-local-build-plugin';
9
9
  const PLUGIN_PACKAGE_VERSION = '0.0.120';
10
+ var LocalBuildMode;
11
+ (function (LocalBuildMode) {
12
+ /**
13
+ * Local build that users can run on their own machines. Instead
14
+ * of sending build request to EAS Servers it's passing it as an argument
15
+ * to local-build-plugin, that will run the build locally.
16
+ *
17
+ * Triggered when running `eas build --local`.
18
+ */
19
+ LocalBuildMode[LocalBuildMode["LOCAL_BUILD_PLUGIN"] = 0] = "LOCAL_BUILD_PLUGIN";
20
+ /**
21
+ * Type of local build that is not accessible to users directly. When
22
+ * cloud build is triggered by git based integration, we are running
23
+ * in this mode. Instead of sending build request to EAS Servers it's
24
+ * printing it to the stdout as JSON, so EAS Build worker can read it.
25
+ */
26
+ LocalBuildMode[LocalBuildMode["INTERNAL"] = 1] = "INTERNAL";
27
+ })(LocalBuildMode = exports.LocalBuildMode || (exports.LocalBuildMode = {}));
10
28
  async function runLocalBuildAsync(job, metadata, options) {
11
29
  var _a;
12
30
  const { command, args } = await getCommandAndArgsAsync(job, metadata);
@@ -125,7 +125,7 @@ async function runBuildAndSubmitAsync(graphqlClient, analytics, projectDir, flag
125
125
  }
126
126
  buildCtxByPlatform[(0, AppPlatform_1.toAppPlatform)(buildProfile.platform)] = buildCtx;
127
127
  }
128
- if (flags.localBuildOptions.enable) {
128
+ if (flags.localBuildOptions.localBuildMode) {
129
129
  return;
130
130
  }
131
131
  log_1.default.newLine();
@@ -167,6 +167,8 @@ async function runBuildAndSubmitAsync(graphqlClient, analytics, projectDir, flag
167
167
  const builds = await (0, build_2.waitForBuildEndAsync)(graphqlClient, {
168
168
  buildIds: startedBuilds.map(({ build }) => build.id),
169
169
  accountName,
170
+ projectDir,
171
+ nonInteractive: flags.nonInteractive,
170
172
  });
171
173
  if (!flags.json) {
172
174
  (0, printBuildInfo_1.printBuildResults)(builds);
@@ -10,6 +10,7 @@ const chalk_1 = tslib_1.__importDefault(require("chalk"));
10
10
  const figures_1 = tslib_1.__importDefault(require("figures"));
11
11
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
12
12
  const path_1 = tslib_1.__importDefault(require("path"));
13
+ const local_1 = require("../../build/local");
13
14
  const runBuildAndSubmit_1 = require("../../build/runBuildAndSubmit");
14
15
  const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
15
16
  const flags_1 = require("../../commandUtils/flags");
@@ -31,7 +32,7 @@ class Build extends EasCommand_1.default {
31
32
  nonInteractive: flags.nonInteractive,
32
33
  });
33
34
  await handleDeprecatedEasJsonAsync(projectDir, flags.nonInteractive);
34
- if (!flags.localBuildOptions.enable) {
35
+ if (!flags.localBuildOptions.localBuildMode) {
35
36
  await (0, statuspageService_1.maybeWarnAboutEasOutagesAsync)(graphqlClient, flags.autoSubmit
36
37
  ? [generated_1.StatuspageServiceName.EasBuild, generated_1.StatuspageServiceName.EasSubmit]
37
38
  : [generated_1.StatuspageServiceName.EasBuild]);
@@ -74,13 +75,11 @@ class Build extends EasCommand_1.default {
74
75
  nonInteractive,
75
76
  localBuildOptions: flags['local']
76
77
  ? {
77
- enable: true,
78
+ localBuildMode: local_1.LocalBuildMode.LOCAL_BUILD_PLUGIN,
78
79
  verbose: true,
79
80
  artifactPath: flags.output && path_1.default.resolve(process.cwd(), flags.output),
80
81
  }
81
- : {
82
- enable: false,
83
- },
82
+ : {},
84
83
  wait: flags['wait'],
85
84
  clearCache: flags['clear-cache'],
86
85
  json: flags['json'],
@@ -92,7 +91,7 @@ class Build extends EasCommand_1.default {
92
91
  }
93
92
  async ensurePlatformSelectedAsync(flags) {
94
93
  const requestedPlatform = await (0, platform_1.selectRequestedPlatformAsync)(flags.requestedPlatform);
95
- if (flags.localBuildOptions.enable) {
94
+ if (flags.localBuildOptions.localBuildMode) {
96
95
  if (flags.autoSubmit) {
97
96
  // TODO: implement this
98
97
  core_1.Errors.error('Auto-submits are not yet supported when building locally', { exit: 1 });
@@ -7,6 +7,7 @@ const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
7
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
8
8
  const path_1 = tslib_1.__importDefault(require("path"));
9
9
  const uuid_1 = require("uuid");
10
+ const local_1 = require("../../build/local");
10
11
  const runBuildAndSubmit_1 = require("../../build/runBuildAndSubmit");
11
12
  const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
12
13
  const log_1 = tslib_1.__importDefault(require("../../log"));
@@ -53,7 +54,7 @@ class BuildInspect extends EasCommand_1.default {
53
54
  requestedPlatform: flags.platform,
54
55
  profile: flags.profile,
55
56
  localBuildOptions: {
56
- enable: true,
57
+ localBuildMode: local_1.LocalBuildMode.LOCAL_BUILD_PLUGIN,
57
58
  ...(flags.stage === InspectStage.PRE_BUILD ? { skipNativeBuild: true } : {}),
58
59
  ...(flags.stage === InspectStage.POST_BUILD ? { skipCleanup: true } : {}),
59
60
  verbose: flags.verbose,
@@ -0,0 +1,21 @@
1
+ import EasCommand from '../../commandUtils/EasCommand';
2
+ /**
3
+ * This command will be run on the EAS Build workers, when building
4
+ * directly from git. This command resolves credentials and other
5
+ * build configuration, that normally would be included in the
6
+ * job and metadata objects, and prints them to stdout.
7
+ */
8
+ export default class BuildInternal extends EasCommand {
9
+ static hidden: boolean;
10
+ static flags: {
11
+ platform: import("@oclif/core/lib/interfaces").OptionFlag<string>;
12
+ profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
13
+ };
14
+ static contextDefinition: {
15
+ analytics: import("../../commandUtils/context/AnalyticsContextField").default;
16
+ projectDir: import("../../commandUtils/context/ProjectDirContextField").default;
17
+ getDynamicProjectConfigAsync: import("../../commandUtils/context/DynamicProjectConfigContextField").DynamicProjectConfigContextField;
18
+ loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
19
+ };
20
+ runAsync(): Promise<void>;
21
+ }
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const tslib_1 = require("tslib");
5
+ const core_1 = require("@oclif/core");
6
+ const _1 = require(".");
7
+ const local_1 = require("../../build/local");
8
+ const runBuildAndSubmit_1 = require("../../build/runBuildAndSubmit");
9
+ const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
10
+ const json_1 = require("../../utils/json");
11
+ /**
12
+ * This command will be run on the EAS Build workers, when building
13
+ * directly from git. This command resolves credentials and other
14
+ * build configuration, that normally would be included in the
15
+ * job and metadata objects, and prints them to stdout.
16
+ */
17
+ class BuildInternal extends EasCommand_1.default {
18
+ async runAsync() {
19
+ const { flags } = await this.parse(BuildInternal);
20
+ // This command is always run with implicit --non-interactive and --json options
21
+ (0, json_1.enableJsonOutput)();
22
+ const { loggedIn: { actor, graphqlClient }, getDynamicProjectConfigAsync, projectDir, analytics, } = await this.getContextAsync(BuildInternal, {
23
+ nonInteractive: true,
24
+ });
25
+ await (0, _1.handleDeprecatedEasJsonAsync)(projectDir, flags.nonInteractive);
26
+ await (0, runBuildAndSubmit_1.runBuildAndSubmitAsync)(graphqlClient, analytics, projectDir, {
27
+ requestedPlatform: flags.platform,
28
+ profile: flags.profile,
29
+ nonInteractive: true,
30
+ wait: false,
31
+ clearCache: false,
32
+ json: true,
33
+ autoSubmit: false,
34
+ localBuildOptions: {
35
+ localBuildMode: local_1.LocalBuildMode.INTERNAL,
36
+ },
37
+ }, actor, getDynamicProjectConfigAsync);
38
+ }
39
+ }
40
+ exports.default = BuildInternal;
41
+ _a = BuildInternal;
42
+ BuildInternal.hidden = true;
43
+ BuildInternal.flags = {
44
+ platform: core_1.Flags.enum({
45
+ char: 'p',
46
+ options: ['android', 'ios'],
47
+ required: true,
48
+ }),
49
+ profile: core_1.Flags.string({
50
+ char: 'e',
51
+ description: 'Name of the build profile from eas.json. Defaults to "production" if defined in eas.json.',
52
+ helpValue: 'PROFILE_NAME',
53
+ }),
54
+ };
55
+ BuildInternal.contextDefinition = {
56
+ ..._a.ContextOptions.LoggedIn,
57
+ ..._a.ContextOptions.DynamicProjectConfig,
58
+ ..._a.ContextOptions.ProjectDir,
59
+ ..._a.ContextOptions.Analytics,
60
+ };
@@ -109,6 +109,8 @@ class BuildResign extends EasCommand_1.default {
109
109
  const buildResult = await (0, build_1.waitForBuildEndAsync)(graphqlClient, {
110
110
  buildIds: [newBuild.id],
111
111
  accountName: account.name,
112
+ nonInteractive,
113
+ projectDir,
112
114
  });
113
115
  if (!flags.json) {
114
116
  (0, printBuildInfo_1.printBuildResults)(buildResult);
@@ -3,8 +3,11 @@ import EasCommand from '../commandUtils/EasCommand';
3
3
  export default class Config extends EasCommand {
4
4
  static description: string;
5
5
  static flags: {
6
+ json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
+ 'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
6
8
  platform: import("@oclif/core/lib/interfaces").OptionFlag<Platform | undefined>;
7
9
  profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
10
+ 'eas-json-only': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
11
  };
9
12
  static contextDefinition: {
10
13
  projectDir: import("../commandUtils/context/ProjectDirContextField").default;
@@ -8,13 +8,18 @@ const eas_json_1 = require("@expo/eas-json");
8
8
  const core_1 = require("@oclif/core");
9
9
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
10
10
  const EasCommand_1 = tslib_1.__importDefault(require("../commandUtils/EasCommand"));
11
+ const flags_1 = require("../commandUtils/flags");
11
12
  const AppPlatform_1 = require("../graphql/types/AppPlatform");
12
13
  const log_1 = tslib_1.__importDefault(require("../log"));
13
14
  const platform_1 = require("../platform");
14
15
  const prompts_1 = require("../prompts");
16
+ const json_1 = require("../utils/json");
15
17
  class Config extends EasCommand_1.default {
16
18
  async runAsync() {
17
19
  const { flags } = await this.parse(Config);
20
+ if (flags.json) {
21
+ (0, json_1.enableJsonOutput)();
22
+ }
18
23
  const { platform: maybePlatform, profile: maybeProfile } = flags;
19
24
  const { getDynamicProjectConfigAsync, projectDir } = await this.getContextAsync(Config, {
20
25
  nonInteractive: false,
@@ -35,21 +40,40 @@ class Config extends EasCommand_1.default {
35
40
  },
36
41
  ]));
37
42
  const profile = await eas_json_1.EasJsonUtils.getBuildProfileAsync(accessor, platform, profileName);
38
- const { exp: config } = await getDynamicProjectConfigAsync({
39
- env: profile.env,
40
- isPublicConfig: true,
41
- });
42
- log_1.default.addNewLineIfNone();
43
- log_1.default.log(chalk_1.default.bold((0, config_1.getProjectConfigDescription)(projectDir)));
44
- log_1.default.newLine();
45
- log_1.default.log(JSON.stringify(config, null, 2));
46
- log_1.default.newLine();
47
- log_1.default.newLine();
48
- const appPlatform = (0, AppPlatform_1.toAppPlatform)(platform);
49
- const platformEmoji = platform_1.appPlatformEmojis[appPlatform];
50
- log_1.default.log(`${platformEmoji} ${chalk_1.default.bold(`Build profile "${profileName}"`)}`);
51
- log_1.default.newLine();
52
- log_1.default.log(JSON.stringify(profile, null, 2));
43
+ if (flags['eas-json-only']) {
44
+ if (flags.json) {
45
+ (0, json_1.printJsonOnlyOutput)({ buildProfile: profile });
46
+ }
47
+ else {
48
+ const appPlatform = (0, AppPlatform_1.toAppPlatform)(platform);
49
+ const platformEmoji = platform_1.appPlatformEmojis[appPlatform];
50
+ log_1.default.log(`${platformEmoji} ${chalk_1.default.bold(`Build profile "${profileName}"`)}`);
51
+ log_1.default.newLine();
52
+ log_1.default.log(JSON.stringify(profile, null, 2));
53
+ }
54
+ }
55
+ else {
56
+ const { exp: appConfig } = await getDynamicProjectConfigAsync({
57
+ env: profile.env,
58
+ isPublicConfig: true,
59
+ });
60
+ if (flags.json) {
61
+ (0, json_1.printJsonOnlyOutput)({ buildProfile: profile, appConfig });
62
+ }
63
+ else {
64
+ log_1.default.addNewLineIfNone();
65
+ log_1.default.log(chalk_1.default.bold((0, config_1.getProjectConfigDescription)(projectDir)));
66
+ log_1.default.newLine();
67
+ log_1.default.log(JSON.stringify(appConfig, null, 2));
68
+ log_1.default.newLine();
69
+ log_1.default.newLine();
70
+ const appPlatform = (0, AppPlatform_1.toAppPlatform)(platform);
71
+ const platformEmoji = platform_1.appPlatformEmojis[appPlatform];
72
+ log_1.default.log(`${platformEmoji} ${chalk_1.default.bold(`Build profile "${profileName}"`)}`);
73
+ log_1.default.newLine();
74
+ log_1.default.log(JSON.stringify(profile, null, 2));
75
+ }
76
+ }
53
77
  }
54
78
  }
55
79
  exports.default = Config;
@@ -62,6 +86,11 @@ Config.flags = {
62
86
  description: 'Name of the build profile from eas.json. Defaults to "production" if defined in eas.json.',
63
87
  helpValue: 'PROFILE_NAME',
64
88
  }),
89
+ // This option is used only on EAS Build worker to read build profile from eas.json.
90
+ 'eas-json-only': core_1.Flags.boolean({
91
+ hidden: true,
92
+ }),
93
+ ...flags_1.EasNonInteractiveAndJsonFlags,
65
94
  };
66
95
  Config.contextDefinition = {
67
96
  ..._a.ContextOptions.DynamicProjectConfig,