eas-cli 3.2.0 → 3.3.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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserInputResourceClass = exports.BuildDistributionType = exports.BuildStatus = void 0;
3
+ exports.BuildDistributionType = exports.BuildStatus = void 0;
4
4
  var BuildStatus;
5
5
  (function (BuildStatus) {
6
6
  BuildStatus["NEW"] = "new";
@@ -16,13 +16,3 @@ var BuildDistributionType;
16
16
  BuildDistributionType["INTERNAL"] = "internal";
17
17
  BuildDistributionType["SIMULATOR"] = "simulator";
18
18
  })(BuildDistributionType = exports.BuildDistributionType || (exports.BuildDistributionType = {}));
19
- var UserInputResourceClass;
20
- (function (UserInputResourceClass) {
21
- UserInputResourceClass["DEFAULT"] = "default";
22
- UserInputResourceClass["LARGE"] = "large";
23
- /**
24
- * @experimental
25
- * This resource class is not yet ready to be used in production. For testing purposes only. Might be deprecated / deleted at any time.
26
- */
27
- UserInputResourceClass["M1_EXPERIMENTAL"] = "m1-experimental";
28
- })(UserInputResourceClass = exports.UserInputResourceClass || (exports.UserInputResourceClass = {}));
@@ -89,6 +89,8 @@ async function getProjectIdAsync(sessionManager, exp, options) {
89
89
  return user.username;
90
90
  case 'Robot':
91
91
  throw new Error('The "owner" manifest property is required when using robot users. See: https://docs.expo.dev/versions/latest/config/app/#owner');
92
+ case 'SSOUser':
93
+ throw new Error('SSO users are not supported yet.');
92
94
  }
93
95
  };
94
96
  const projectId = await (0, fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync_1.fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync)(graphqlClient, {
@@ -1,4 +1,4 @@
1
- import { UserInputResourceClass } from '../../build/types';
1
+ import { ResourceClass } from '@expo/eas-json';
2
2
  import EasCommand from '../../commandUtils/EasCommand';
3
3
  export default class Build extends EasCommand {
4
4
  static description: string;
@@ -15,7 +15,7 @@ export default class Build extends EasCommand {
15
15
  'clear-cache': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
16
16
  'auto-submit': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
17
17
  'auto-submit-with-profile': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
18
- 'resource-class': import("@oclif/core/lib/interfaces").OptionFlag<UserInputResourceClass | undefined>;
18
+ 'resource-class': import("@oclif/core/lib/interfaces").OptionFlag<ResourceClass | undefined>;
19
19
  message: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
20
20
  };
21
21
  static contextDefinition: {
@@ -11,7 +11,6 @@ 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
13
  const runBuildAndSubmit_1 = require("../../build/runBuildAndSubmit");
14
- const types_1 = require("../../build/types");
15
14
  const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
16
15
  const flags_1 = require("../../commandUtils/flags");
17
16
  const generated_1 = require("../../graphql/generated");
@@ -41,7 +40,7 @@ class Build extends EasCommand_1.default {
41
40
  await (0, runBuildAndSubmit_1.runBuildAndSubmitAsync)(graphqlClient, analytics, projectDir, flagsWithPlatform, actor, getDynamicProjectConfigAsync);
42
41
  }
43
42
  sanitizeFlags(flags) {
44
- var _b, _c;
43
+ var _b;
45
44
  const nonInteractive = flags['non-interactive'];
46
45
  if (!flags.local && flags.output) {
47
46
  core_1.Errors.error('--output is allowed only for local builds', { exit: 1 });
@@ -52,12 +51,6 @@ class Build extends EasCommand_1.default {
52
51
  if (flags.json && !nonInteractive) {
53
52
  core_1.Errors.error('--json is allowed only when building in non-interactive mode', { exit: 1 });
54
53
  }
55
- if (flags['resource-class'] === types_1.UserInputResourceClass.M1_EXPERIMENTAL &&
56
- flags.platform !== eas_build_job_1.Platform.IOS) {
57
- core_1.Errors.error(`Resource class ${types_1.UserInputResourceClass.M1_EXPERIMENTAL} is only available for iOS builds`, {
58
- exit: 1,
59
- });
60
- }
61
54
  const requestedPlatform = flags.platform &&
62
55
  Object.values(platform_1.RequestedPlatform).includes(flags.platform.toLowerCase())
63
56
  ? flags.platform.toLowerCase()
@@ -93,7 +86,7 @@ class Build extends EasCommand_1.default {
93
86
  json: flags['json'],
94
87
  autoSubmit: flags['auto-submit'] || flags['auto-submit-with-profile'] !== undefined,
95
88
  submitProfile: (_b = flags['auto-submit-with-profile']) !== null && _b !== void 0 ? _b : profile,
96
- userInputResourceClass: (_c = flags['resource-class']) !== null && _c !== void 0 ? _c : types_1.UserInputResourceClass.DEFAULT,
89
+ resourceClass: flags['resource-class'],
97
90
  message,
98
91
  };
99
92
  }
@@ -167,8 +160,11 @@ Build.flags = {
167
160
  exclusive: ['auto-submit'],
168
161
  }),
169
162
  'resource-class': core_1.Flags.enum({
170
- options: Object.values(types_1.UserInputResourceClass),
163
+ options: Object.values(eas_json_1.ResourceClass),
171
164
  hidden: true,
165
+ deprecated: {
166
+ message: chalk_1.default.yellow('The --resource-class flag has been deprecated. Define the resource class in eas.json.\nLearn more: https://docs.expo.dev/build-reference/eas-json/'),
167
+ },
172
168
  description: 'The instance type that will be used to run this build [experimental]',
173
169
  }),
174
170
  message: core_1.Flags.string({
@@ -12,6 +12,7 @@ const pagination_1 = require("../../commandUtils/pagination");
12
12
  const generated_1 = require("../../graphql/generated");
13
13
  const BuildQuery_1 = require("../../graphql/queries/BuildQuery");
14
14
  const log_1 = tslib_1.__importDefault(require("../../log"));
15
+ const platform_1 = require("../../platform");
15
16
  const projectUtils_1 = require("../../project/projectUtils");
16
17
  const prompts_1 = require("../../prompts");
17
18
  const run_1 = require("../../run/run");
@@ -103,10 +104,26 @@ async function resolvePlatformAsync(platform) {
103
104
  });
104
105
  return selectedPlatform;
105
106
  }
107
+ function validateChosenBuild(maybeBuild, selectedPlatform) {
108
+ if (!maybeBuild) {
109
+ throw new Error('There are no simulator/emulator builds that can be run for this project.');
110
+ }
111
+ if (selectedPlatform !== maybeBuild.platform) {
112
+ throw new Error(`The selected build is for ${platform_1.appPlatformDisplayNames[maybeBuild.platform]}, but you selected ${platform_1.appPlatformDisplayNames[selectedPlatform]}`);
113
+ }
114
+ if (maybeBuild.status !== generated_1.BuildStatus.Finished) {
115
+ throw new Error('The selected build is not finished.');
116
+ }
117
+ if (!(0, utils_1.isRunnableOnSimulatorOrEmulator)(maybeBuild)) {
118
+ throw new Error('Artifacts for the latest build have expired and are no longer available, or this is not a simulator/emulator build.');
119
+ }
120
+ return maybeBuild;
121
+ }
106
122
  async function maybeGetBuildAsync(graphqlClient, flags, projectId, paginatedQueryOptions) {
107
123
  const distributionType = flags.selectedPlatform === generated_1.AppPlatform.Ios ? generated_1.DistributionType.Simulator : undefined;
108
124
  if (flags.runArchiveFlags.id) {
109
- return BuildQuery_1.BuildQuery.byIdAsync(graphqlClient, flags.runArchiveFlags.id);
125
+ const build = await BuildQuery_1.BuildQuery.byIdAsync(graphqlClient, flags.runArchiveFlags.id);
126
+ return validateChosenBuild(build, flags.selectedPlatform);
110
127
  }
111
128
  else if (!flags.runArchiveFlags.id &&
112
129
  !flags.runArchiveFlags.path &&
@@ -114,7 +131,7 @@ async function maybeGetBuildAsync(graphqlClient, flags, projectId, paginatedQuer
114
131
  !flags.runArchiveFlags.latest) {
115
132
  const build = await (0, queries_1.listAndSelectBuildOnAppAsync)(graphqlClient, {
116
133
  projectId,
117
- title: `Select ${flags.selectedPlatform === generated_1.AppPlatform.Ios ? 'iOS' : 'Android'} ${flags.selectedPlatform === generated_1.AppPlatform.Ios ? 'simulator' : 'emulator'} build to run for ${await (0, projectUtils_1.getDisplayNameForProjectIdAsync)(graphqlClient, projectId)} app`,
134
+ title: `Select ${platform_1.appPlatformDisplayNames[flags.selectedPlatform]} ${flags.selectedPlatform === generated_1.AppPlatform.Ios ? 'simulator' : 'emulator'} build to run for ${await (0, projectUtils_1.getDisplayNameForProjectIdAsync)(graphqlClient, projectId)} app`,
118
135
  filter: {
119
136
  platform: flags.selectedPlatform,
120
137
  distribution: distributionType,
@@ -124,10 +141,10 @@ async function maybeGetBuildAsync(graphqlClient, flags, projectId, paginatedQuer
124
141
  selectPromptDisabledFunction: build => !(0, utils_1.isRunnableOnSimulatorOrEmulator)(build),
125
142
  selectPromptWarningMessage: 'Artifacts for this build have expired and are no longer available, or this is not a simulator/emulator build.',
126
143
  });
127
- return build !== null && build !== void 0 ? build : null;
144
+ return validateChosenBuild(build, flags.selectedPlatform);
128
145
  }
129
146
  else if (flags.runArchiveFlags.latest) {
130
- return await (0, queries_1.getLatestBuildAsync)(graphqlClient, {
147
+ const latestBuild = await (0, queries_1.getLatestBuildAsync)(graphqlClient, {
131
148
  projectId,
132
149
  filter: {
133
150
  platform: flags.selectedPlatform,
@@ -135,6 +152,7 @@ async function maybeGetBuildAsync(graphqlClient, flags, projectId, paginatedQuer
135
152
  status: generated_1.BuildStatus.Finished,
136
153
  },
137
154
  });
155
+ return validateChosenBuild(latestBuild, flags.selectedPlatform);
138
156
  }
139
157
  else {
140
158
  return null;
@@ -154,7 +154,7 @@ class ProjectInit extends EasCommand_1.default {
154
154
  // if regular user, put primary account first
155
155
  const sortedAccounts = actor.__typename === 'Robot'
156
156
  ? allAccounts
157
- : [...allAccounts].sort((a, _b) => (a.name === actor.username ? -1 : 1));
157
+ : [...allAccounts].sort((a, _b) => actor.__typename === 'User' ? (a.name === actor.username ? -1 : 1) : 0);
158
158
  const choices = sortedAccounts.map(account => ({
159
159
  title: account.name,
160
160
  value: account,
@@ -256,7 +256,7 @@ class UpdatePublish extends EasCommand_1.default {
256
256
  throw e;
257
257
  }
258
258
  if (jsonFlag) {
259
- (0, json_1.printJsonOnlyOutput)(newUpdates);
259
+ (0, json_1.printJsonOnlyOutput)((0, utils_2.getUpdateGroupJsonInfo)(newUpdates));
260
260
  }
261
261
  else {
262
262
  if (new Set(newUpdates.map(update => update.group)).size > 1) {
@@ -17,11 +17,11 @@ class UpdateView extends EasCommand_1.default {
17
17
  (0, json_1.enableJsonOutput)();
18
18
  }
19
19
  const updatesByGroup = await UpdateQuery_1.UpdateQuery.viewUpdateGroupAsync(graphqlClient, { groupId });
20
- const [updateGroupDescription] = (0, utils_1.getUpdateGroupDescriptions)([updatesByGroup]);
21
20
  if (jsonFlag) {
22
- (0, json_1.printJsonOnlyOutput)(updateGroupDescription);
21
+ (0, json_1.printJsonOnlyOutput)((0, utils_1.getUpdateGroupJsonInfo)(updatesByGroup));
23
22
  }
24
23
  else {
24
+ const [updateGroupDescription] = (0, utils_1.getUpdateGroupDescriptions)([updatesByGroup]);
25
25
  log_1.default.log(chalk_1.default.bold('Update group:'));
26
26
  log_1.default.log((0, utils_1.formatUpdateGroup)(updateGroupDescription));
27
27
  }