eas-cli 16.26.0 → 16.28.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.
@@ -0,0 +1,5 @@
1
+ import { ExpoGraphqlClient } from '../commandUtils/context/contextUtils/createGraphqlClient';
2
+ import { BackgroundJobReceiptDataFragment } from '../graphql/generated';
3
+ export declare function scheduleBranchDeletionAsync(graphqlClient: ExpoGraphqlClient, { branchId, }: {
4
+ branchId: string;
5
+ }): Promise<BackgroundJobReceiptDataFragment>;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.scheduleBranchDeletionAsync = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
6
+ const client_1 = require("../graphql/client");
7
+ const BackgroundJobReceipt_1 = require("../graphql/types/BackgroundJobReceipt");
8
+ async function scheduleBranchDeletionAsync(graphqlClient, { branchId, }) {
9
+ const result = await (0, client_1.withErrorHandlingAsync)(graphqlClient
10
+ .mutation((0, graphql_tag_1.default) `
11
+ mutation ScheduleBranchDeletion($branchId: ID!) {
12
+ updateBranch {
13
+ scheduleUpdateBranchDeletion(branchId: $branchId) {
14
+ id
15
+ ...BackgroundJobReceiptData
16
+ }
17
+ }
18
+ }
19
+ ${BackgroundJobReceipt_1.BackgroundJobReceiptNode}
20
+ `, { branchId })
21
+ .toPromise());
22
+ return result.updateBranch.scheduleUpdateBranchDeletion;
23
+ }
24
+ exports.scheduleBranchDeletionAsync = scheduleBranchDeletionAsync;
@@ -28,6 +28,7 @@ export interface IosBuildContext {
28
28
  buildNumberOverride?: string;
29
29
  }
30
30
  export interface BuildContext<T extends Platform> {
31
+ accountId: string;
31
32
  accountName: string;
32
33
  easJsonCliConfig: EasJson['cli'];
33
34
  buildProfile: BuildProfile<T>;
@@ -63,6 +63,7 @@ async function createBuildContextAsync({ buildProfileName, buildProfile, easJson
63
63
  analytics.logEvent(AnalyticsManager_1.BuildEvent.BUILD_COMMAND, analyticsEventProperties);
64
64
  const resourceClass = await (0, resourceClass_1.resolveBuildResourceClassAsync)(buildProfile, platform, resourceClassFlag);
65
65
  const commonContext = {
66
+ accountId,
66
67
  accountName: account.name,
67
68
  buildProfile,
68
69
  buildProfileName,
@@ -41,8 +41,10 @@ const download_1 = require("../utils/download");
41
41
  const filter_1 = require("../utils/expodash/filter");
42
42
  const json_1 = require("../utils/json");
43
43
  const profiles_1 = require("../utils/profiles");
44
+ const checkForOverages_1 = require("../utils/usage/checkForOverages");
44
45
  let metroConfigValidated = false;
45
46
  let sdkVersionChecked = false;
47
+ let hasWarnedAboutUsageOverages = false;
46
48
  async function runBuildAndSubmitAsync({ graphqlClient, analytics, vcsClient, projectDir, flags, actor, getDynamicPrivateProjectConfigAsync, downloadSimBuildAutoConfirm, envOverride, }) {
47
49
  await vcsClient.ensureRepoExistsAsync();
48
50
  await (0, repository_1.ensureRepoIsCleanAsync)(vcsClient, flags.nonInteractive);
@@ -241,6 +243,14 @@ async function prepareAndStartBuildAsync({ projectDir, flags, moreBuilds, buildP
241
243
  whatToTest: flags.whatToTest,
242
244
  env,
243
245
  });
246
+ if (!hasWarnedAboutUsageOverages && !flags.localBuildOptions.localBuildMode) {
247
+ hasWarnedAboutUsageOverages = true;
248
+ log_1.default.newLine();
249
+ await (0, checkForOverages_1.maybeWarnAboutUsageOveragesAsync)({ graphqlClient, accountId: buildCtx.accountId });
250
+ if (!moreBuilds) {
251
+ log_1.default.newLine();
252
+ }
253
+ }
244
254
  if (moreBuilds) {
245
255
  log_1.default.newLine();
246
256
  const appPlatform = (0, AppPlatform_1.toAppPlatform)(buildProfile.platform);
@@ -79,12 +79,15 @@ async function promptForProjectAccountAsync(actor) {
79
79
  exports.promptForProjectAccountAsync = promptForProjectAccountAsync;
80
80
  function getAccountChoices(actor, permissionsMap) {
81
81
  const permissions = permissionsMap ?? getAccountPermissionsMap(actor);
82
- const sortedAccounts = [...actor.accounts].sort((a, _b) => actor.__typename === 'User' ? (a.name === actor.username ? -1 : 1) : 0);
82
+ const sortedAccounts = [...actor.accounts].sort((a, _b) => (a.ownerUserActor ? 1 : -1));
83
83
  return sortedAccounts.map(account => {
84
- const isPersonalAccount = actor.__typename === 'User' && account.name === actor.username;
84
+ const isPersonalAccount = !!account.ownerUserActor && account.ownerUserActor.id === actor.id;
85
+ const isTeamAccount = !!account.ownerUserActor && account.ownerUserActor.id !== actor.id;
85
86
  const accountDisplayName = isPersonalAccount
86
- ? `${account.name} (personal account)`
87
- : account.name;
87
+ ? `${account.name} (Limited - Personal Account)`
88
+ : isTeamAccount
89
+ ? `${account.name} (Limited - Team Account)`
90
+ : account.name;
88
91
  const disabled = !permissions.get(account.name);
89
92
  return {
90
93
  title: accountDisplayName,
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
5
5
  const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
6
+ const delete_1 = require("../../branch/delete");
6
7
  const queries_1 = require("../../branch/queries");
7
8
  const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
8
9
  const flags_1 = require("../../commandUtils/flags");
@@ -12,6 +13,7 @@ const log_1 = tslib_1.__importDefault(require("../../log"));
12
13
  const projectUtils_1 = require("../../project/projectUtils");
13
14
  const prompts_1 = require("../../prompts");
14
15
  const json_1 = require("../../utils/json");
16
+ const pollForBackgroundJobReceiptAsync_1 = require("../../utils/pollForBackgroundJobReceiptAsync");
15
17
  async function getBranchInfoAsync(graphqlClient, { appId, name }) {
16
18
  const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
17
19
  .query((0, graphql_tag_1.default) `
@@ -33,22 +35,6 @@ async function getBranchInfoAsync(graphqlClient, { appId, name }) {
33
35
  .toPromise());
34
36
  return data;
35
37
  }
36
- async function deleteBranchOnAppAsync(graphqlClient, { branchId }) {
37
- const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
38
- .mutation((0, graphql_tag_1.default) `
39
- mutation DeleteUpdateBranch($branchId: ID!) {
40
- updateBranch {
41
- deleteUpdateBranch(branchId: $branchId) {
42
- id
43
- }
44
- }
45
- }
46
- `, {
47
- branchId,
48
- })
49
- .toPromise());
50
- return data.updateBranch.deleteUpdateBranch;
51
- }
52
38
  class BranchDelete extends EasCommand_1.default {
53
39
  static description = 'delete a branch';
54
40
  static contextDefinition = {
@@ -102,11 +88,11 @@ class BranchDelete extends EasCommand_1.default {
102
88
  process.exit(1);
103
89
  }
104
90
  }
105
- const deletionResult = await deleteBranchOnAppAsync(graphqlClient, {
106
- branchId,
107
- });
91
+ const receipt = await (0, delete_1.scheduleBranchDeletionAsync)(graphqlClient, { branchId });
92
+ const successfulReceipt = await (0, pollForBackgroundJobReceiptAsync_1.pollForBackgroundJobReceiptAsync)(graphqlClient, receipt);
93
+ log_1.default.debug('Deletion result', { successfulReceipt });
108
94
  if (jsonFlag) {
109
- (0, json_1.printJsonOnlyOutput)(deletionResult);
95
+ (0, json_1.printJsonOnlyOutput)({ id: branchId });
110
96
  }
111
97
  else {
112
98
  log_1.default.withTick(`️Deleted branch "${branchName}" and all of its updates on project ${chalk_1.default.bold(projectDisplayName)}.`);
@@ -17,12 +17,10 @@ const flags_1 = require("../../commandUtils/flags");
17
17
  const generated_1 = require("../../graphql/generated");
18
18
  const log_1 = tslib_1.__importStar(require("../../log"));
19
19
  const platform_1 = require("../../platform");
20
- const projectUtils_1 = require("../../project/projectUtils");
21
20
  const prompts_1 = require("../../prompts");
22
21
  const uniq_1 = tslib_1.__importDefault(require("../../utils/expodash/uniq"));
23
22
  const json_1 = require("../../utils/json");
24
23
  const statuspageService_1 = require("../../utils/statuspageService");
25
- const checkForOverages_1 = require("../../utils/usage/checkForOverages");
26
24
  class Build extends EasCommand_1.default {
27
25
  static description = 'start a build';
28
26
  static flags = {
@@ -122,12 +120,6 @@ class Build extends EasCommand_1.default {
122
120
  await (0, statuspageService_1.maybeWarnAboutEasOutagesAsync)(graphqlClient, flags.autoSubmit
123
121
  ? [generated_1.StatuspageServiceName.EasBuild, generated_1.StatuspageServiceName.EasSubmit]
124
122
  : [generated_1.StatuspageServiceName.EasBuild]);
125
- const { projectId } = await getDynamicPrivateProjectConfigAsync();
126
- const account = await (0, projectUtils_1.getOwnerAccountForProjectIdAsync)(graphqlClient, projectId);
127
- await (0, checkForOverages_1.maybeWarnAboutUsageOveragesAsync)({
128
- graphqlClient,
129
- accountId: account.id,
130
- });
131
123
  }
132
124
  const flagsWithPlatform = await this.ensurePlatformSelectedAsync(flags);
133
125
  const { buildProfiles } = await (0, runBuildAndSubmit_1.runBuildAndSubmitAsync)({
@@ -173,15 +173,6 @@ class EnvUpdate extends EasCommand_1.default {
173
173
  newType = undefined;
174
174
  }
175
175
  }
176
- let environmentFilePath;
177
- if ((newType ?? selectedVariable.type) === generated_1.EnvironmentSecretType.FileBase64 && value) {
178
- environmentFilePath = path_1.default.resolve(value);
179
- if (!(await fs_extra_1.default.pathExists(environmentFilePath))) {
180
- throw new Error(`File "${value}" does not exist`);
181
- }
182
- fileName = path_1.default.basename(environmentFilePath);
183
- }
184
- value = environmentFilePath ? await fs_extra_1.default.readFile(environmentFilePath, 'base64') : value;
185
176
  if (!environments || environments.length === 0) {
186
177
  environments = await (0, prompts_2.promptVariableEnvironmentAsync)({
187
178
  nonInteractive,
@@ -204,6 +195,23 @@ class EnvUpdate extends EasCommand_1.default {
204
195
  }
205
196
  }
206
197
  }
198
+ // If value is provided but type is not explicitly set, preserve the existing type
199
+ if (value && !newType) {
200
+ newType = selectedVariable.type;
201
+ }
202
+ if (newType === generated_1.EnvironmentSecretType.FileBase64 && value) {
203
+ const environmentFilePath = path_1.default.resolve(value);
204
+ if (!(await fs_extra_1.default.pathExists(environmentFilePath))) {
205
+ if (type === 'file') {
206
+ throw new Error(`File "${value}" does not exist`);
207
+ }
208
+ else {
209
+ throw new Error(`Variable "${selectedVariable.name}" is a file type, but "${value}" does not exist as a file. If you want to convert it to a string, pass --type string.`);
210
+ }
211
+ }
212
+ fileName = path_1.default.basename(environmentFilePath);
213
+ value = await fs_extra_1.default.readFile(environmentFilePath, 'base64');
214
+ }
207
215
  if (visibility) {
208
216
  newVisibility = (0, prompts_2.parseVisibility)(visibility);
209
217
  }
@@ -382,6 +382,9 @@ class UpdatePublish extends EasCommand_1.default {
382
382
  publishSpinner.fail('Failed to publish updates');
383
383
  throw e;
384
384
  }
385
+ if ((0, utils_1.isBundleDiffingEnabled)(exp)) {
386
+ await (0, utils_1.prewarmDiffingAsync)(graphqlClient, projectId, newUpdates);
387
+ }
385
388
  if (!skipBundler && emitMetadata) {
386
389
  log_1.default.log('Generating eas-update-metadata.json');
387
390
  await (0, publish_1.generateEasMetadataAsync)(distRoot, (0, utils_1.getUpdateJsonInfosForUpdates)(newUpdates));
@@ -103,7 +103,9 @@ class WorkflowRun extends EasCommand_1.default {
103
103
  nonInteractive: flags['non-interactive'],
104
104
  withServerSideEnvironment: null,
105
105
  });
106
- const { projectId, exp: { slug: projectName }, } = await getDynamicPrivateProjectConfigAsync();
106
+ const { projectId, exp: { slug: projectName }, } = await getDynamicPrivateProjectConfigAsync({
107
+ skipPlugins: true,
108
+ });
107
109
  const account = await (0, projectUtils_1.getOwnerAccountForProjectIdAsync)(graphqlClient, projectId);
108
110
  let yamlConfig;
109
111
  let workflowRunId;
@@ -60,7 +60,7 @@ class WorkflowStatus extends EasCommand_1.default {
60
60
  });
61
61
  const { projectId, exp: { slug: projectName }, } = await getDynamicPrivateProjectConfigAsync();
62
62
  const account = await (0, projectUtils_1.getOwnerAccountForProjectIdAsync)(graphqlClient, projectId);
63
- let workflowRunId = args.workflowRunId;
63
+ let workflowRunId = args.WORKFLOW_RUN_ID;
64
64
  if (!workflowRunId && flags['non-interactive']) {
65
65
  throw new Error('Workflow run ID is required in non-interactive mode');
66
66
  }