eas-cli 7.6.2 → 7.7.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 (40) hide show
  1. package/README.md +81 -60
  2. package/build/build/android/prepareJob.d.ts +2 -2
  3. package/build/build/android/prepareJob.js +1 -1
  4. package/build/build/build.d.ts +4 -4
  5. package/build/build/build.js +33 -3
  6. package/build/build/graphql.js +1 -0
  7. package/build/build/ios/prepareJob.d.ts +2 -2
  8. package/build/build/ios/prepareJob.js +1 -1
  9. package/build/build/local.js +1 -1
  10. package/build/build/runBuildAndSubmit.js +1 -0
  11. package/build/build/utils/repository.d.ts +4 -2
  12. package/build/build/utils/repository.js +37 -1
  13. package/build/commands/credentials/configure-build.d.ts +18 -0
  14. package/build/commands/credentials/configure-build.js +43 -0
  15. package/build/commands/credentials/index.d.ts +16 -0
  16. package/build/commands/{credentials.js → credentials/index.js} +2 -2
  17. package/build/commands/submit.d.ts +1 -0
  18. package/build/commands/submit.js +7 -1
  19. package/build/credentials/manager/Actions.d.ts +2 -1
  20. package/build/credentials/manager/Actions.js +1 -0
  21. package/build/credentials/manager/CheckBuildProfileFlagAgainstEasJson.d.ts +10 -0
  22. package/build/credentials/manager/CheckBuildProfileFlagAgainstEasJson.js +35 -0
  23. package/build/credentials/manager/ManageAndroid.d.ts +9 -5
  24. package/build/credentials/manager/ManageAndroid.js +4 -0
  25. package/build/credentials/manager/ManageIos.d.ts +17 -8
  26. package/build/credentials/manager/SetUpAndroidBuildCredentials.d.ts +7 -0
  27. package/build/credentials/manager/SetUpAndroidBuildCredentials.js +48 -0
  28. package/build/credentials/manager/SetUpBuildCredentialsCommandAction.d.ts +19 -0
  29. package/build/credentials/manager/SetUpBuildCredentialsCommandAction.js +25 -0
  30. package/build/credentials/manager/SetUpIosBuildCredentials.d.ts +7 -0
  31. package/build/credentials/manager/SetUpIosBuildCredentials.js +58 -0
  32. package/build/graphql/generated.d.ts +5 -0
  33. package/build/graphql/generated.js +1 -0
  34. package/build/submit/android/AndroidSubmitter.js +1 -0
  35. package/build/submit/context.d.ts +2 -0
  36. package/build/submit/ios/IosSubmitter.d.ts +1 -0
  37. package/build/submit/ios/IosSubmitter.js +2 -0
  38. package/oclif.manifest.json +77 -32
  39. package/package.json +6 -6
  40. package/build/commands/credentials.d.ts +0 -16
@@ -55,9 +55,10 @@ async function prepareBuildRequestForPlatformAsync(builder) {
55
55
  }
56
56
  let projectArchive;
57
57
  if (ctx.localBuildOptions.localBuildMode === local_1.LocalBuildMode.LOCAL_BUILD_PLUGIN) {
58
+ const projectPath = (await (0, repository_1.makeProjectTarballAsync)(ctx.vcsClient)).path;
58
59
  projectArchive = {
59
60
  type: eas_build_job_1.ArchiveSourceType.PATH,
60
- path: (await (0, repository_1.makeProjectTarballAsync)(ctx.vcsClient)).path,
61
+ path: projectPath,
61
62
  };
62
63
  }
63
64
  else if (ctx.localBuildOptions.localBuildMode === local_1.LocalBuildMode.INTERNAL) {
@@ -69,7 +70,7 @@ async function prepareBuildRequestForPlatformAsync(builder) {
69
70
  else if (!ctx.localBuildOptions.localBuildMode) {
70
71
  projectArchive = {
71
72
  type: eas_build_job_1.ArchiveSourceType.GCS,
72
- bucketKey: await uploadProjectAsync(ctx),
73
+ ...(await uploadProjectAsync(ctx)),
73
74
  };
74
75
  }
75
76
  (0, assert_1.default)(projectArchive);
@@ -168,7 +169,11 @@ async function uploadProjectAsync(ctx) {
168
169
  message: ratio => `Uploading to EAS Build (${(0, files_1.formatBytes)(projectTarball.size * ratio)} / ${(0, files_1.formatBytes)(projectTarball.size)})`,
169
170
  completedMessage: (duration) => `Uploaded to EAS ${chalk_1.default.dim(duration)}`,
170
171
  }));
171
- return bucketKey;
172
+ const { metadataLocation } = await uploadMetadataFileAsync(projectTarball, ctx);
173
+ if (metadataLocation) {
174
+ return { bucketKey, metadataLocation };
175
+ }
176
+ return { bucketKey };
172
177
  }, {
173
178
  attemptEvent: AnalyticsManager_1.BuildEvent.PROJECT_UPLOAD_ATTEMPT,
174
179
  successEvent: AnalyticsManager_1.BuildEvent.PROJECT_UPLOAD_SUCCESS,
@@ -189,6 +194,31 @@ async function uploadProjectAsync(ctx) {
189
194
  }
190
195
  }
191
196
  }
197
+ async function uploadMetadataFileAsync(projectTarball, ctx) {
198
+ let projectMetadataFile = null;
199
+ try {
200
+ projectMetadataFile = await (0, repository_1.makeProjectMetadataFileAsync)(projectTarball.path);
201
+ const metadataLocation = await (0, uploads_1.uploadFileAtPathToGCSAsync)(ctx.graphqlClient, generated_1.UploadSessionType.EasBuildGcsProjectMetadata, projectMetadataFile.path, (0, progress_1.createProgressTracker)({
202
+ total: projectMetadataFile.size,
203
+ message: ratio => `Uploading metadata to EAS Build (${(0, files_1.formatBytes)(projectMetadataFile.size * ratio)} / ${(0, files_1.formatBytes)(projectMetadataFile.size)})`,
204
+ completedMessage: (duration) => `Uploaded to EAS ${chalk_1.default.dim(duration)}`,
205
+ }));
206
+ return { metadataLocation };
207
+ }
208
+ catch (err) {
209
+ let errMessage = 'Failed to upload metadata to EAS Build';
210
+ if (err.message) {
211
+ errMessage += `\n\nReason: ${err.message}`;
212
+ }
213
+ log_1.default.warn(errMessage);
214
+ return { metadataLocation: null };
215
+ }
216
+ finally {
217
+ if (projectMetadataFile) {
218
+ await fs_extra_1.default.remove(projectMetadataFile.path);
219
+ }
220
+ }
221
+ }
192
222
  async function sendBuildRequestAsync(builder, job, metadata, buildParams) {
193
223
  const { ctx } = builder;
194
224
  return await (0, common_1.withAnalyticsAsync)(ctx.analytics, async () => {
@@ -10,6 +10,7 @@ function transformProjectArchive(archiveSource) {
10
10
  return {
11
11
  type: generated_1.ProjectArchiveSourceType.Gcs,
12
12
  bucketKey: archiveSource.bucketKey,
13
+ metadataLocation: archiveSource.metadataLocation,
13
14
  };
14
15
  }
15
16
  else if (archiveSource.type === eas_build_job_1.ArchiveSourceType.URL) {
@@ -1,4 +1,4 @@
1
- import { ArchiveSource, Job, Platform } from '@expo/eas-build-job';
1
+ import { ArchiveSource, Ios, Platform } from '@expo/eas-build-job';
2
2
  import { IosCredentials } from '../../credentials/ios/types';
3
3
  import { IosJobSecretsInput } from '../../graphql/generated';
4
4
  import { BuildContext } from '../context';
@@ -7,6 +7,6 @@ interface JobData {
7
7
  credentials?: IosCredentials;
8
8
  buildScheme: string;
9
9
  }
10
- export declare function prepareJobAsync(ctx: BuildContext<Platform.IOS>, jobData: JobData): Promise<Job>;
10
+ export declare function prepareJobAsync(ctx: BuildContext<Platform.IOS>, jobData: JobData): Promise<Ios.Job>;
11
11
  export declare function prepareCredentialsToResign(credentials: IosCredentials): IosJobSecretsInput;
12
12
  export {};
@@ -77,7 +77,7 @@ async function prepareJobAsync(ctx, jobData) {
77
77
  },
78
78
  }),
79
79
  };
80
- return (0, eas_build_job_1.sanitizeJob)(job);
80
+ return (0, eas_build_job_1.sanitizeBuildJob)(job);
81
81
  }
82
82
  exports.prepareJobAsync = prepareJobAsync;
83
83
  function prepareCredentialsToResign(credentials) {
@@ -6,7 +6,7 @@ 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
- const PLUGIN_PACKAGE_VERSION = '1.0.89';
9
+ const PLUGIN_PACKAGE_VERSION = '1.0.95';
10
10
  var LocalBuildMode;
11
11
  (function (LocalBuildMode) {
12
12
  /**
@@ -278,6 +278,7 @@ async function prepareAndStartSubmissionAsync({ build, buildCtx, moreBuilds, pro
278
278
  projectId: buildCtx.projectId,
279
279
  exp: buildCtx.exp,
280
280
  vcsClient: buildCtx.vcsClient,
281
+ isVerboseFastlaneEnabled: false,
281
282
  });
282
283
  if (moreBuilds) {
283
284
  log_1.default.newLine();
@@ -5,10 +5,12 @@ export declare function commitPromptAsync(vcsClient: Client, { initialCommitMess
5
5
  initialCommitMessage?: string;
6
6
  commitAllFiles?: boolean;
7
7
  }): Promise<void>;
8
- export declare function makeProjectTarballAsync(vcsClient: Client): Promise<{
8
+ export type LocalFile = {
9
9
  path: string;
10
10
  size: number;
11
- }>;
11
+ };
12
+ export declare function makeProjectMetadataFileAsync(archivePath: string): Promise<LocalFile>;
13
+ export declare function makeProjectTarballAsync(vcsClient: Client): Promise<LocalFile>;
12
14
  export declare function reviewAndCommitChangesAsync(vcsClient: Client, initialCommitMessage: string, { nonInteractive, askedFirstTime }: {
13
15
  nonInteractive: boolean;
14
16
  askedFirstTime?: boolean;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.reviewAndCommitChangesAsync = exports.makeProjectTarballAsync = exports.commitPromptAsync = exports.ensureRepoIsCleanAsync = exports.maybeBailOnRepoStatusAsync = void 0;
3
+ exports.reviewAndCommitChangesAsync = exports.makeProjectTarballAsync = exports.makeProjectMetadataFileAsync = exports.commitPromptAsync = exports.ensureRepoIsCleanAsync = exports.maybeBailOnRepoStatusAsync = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
6
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
@@ -70,6 +70,42 @@ async function commitPromptAsync(vcsClient, { initialCommitMessage, commitAllFil
70
70
  });
71
71
  }
72
72
  exports.commitPromptAsync = commitPromptAsync;
73
+ async function makeProjectMetadataFileAsync(archivePath) {
74
+ const spinner = (0, ora_1.ora)('Creating project metadata file');
75
+ const timerLabel = 'makeProjectMetadataFileAsync';
76
+ const timer = setTimeout(() => {
77
+ spinner.start();
78
+ }, log_1.default.isDebug ? 1 : 1000);
79
+ (0, timer_1.startTimer)(timerLabel);
80
+ const metadataLocation = path_1.default.join((0, paths_1.getTmpDirectory)(), `${(0, uuid_1.v4)()}-eas-build-metadata.json`);
81
+ const archiveContent = [];
82
+ try {
83
+ await tar_1.default.list({
84
+ file: archivePath,
85
+ onentry: (entry) => {
86
+ if (entry.type === 'File' && !entry.path.includes('.git/')) {
87
+ archiveContent.push(entry.path);
88
+ }
89
+ },
90
+ });
91
+ await fs_extra_1.default.writeJSON(metadataLocation, {
92
+ archiveContent,
93
+ });
94
+ }
95
+ catch (e) {
96
+ clearTimeout(timer);
97
+ if (spinner.isSpinning) {
98
+ spinner.fail();
99
+ }
100
+ throw e;
101
+ }
102
+ clearTimeout(timer);
103
+ const duration = (0, timer_1.endTimer)(timerLabel);
104
+ const prettyTime = (0, timer_1.formatMilliseconds)(duration);
105
+ spinner.succeed(`Created project metadata file ${chalk_1.default.dim(prettyTime)}`);
106
+ return { path: metadataLocation, size: await fs_extra_1.default.stat(metadataLocation).then(stat => stat.size) };
107
+ }
108
+ exports.makeProjectMetadataFileAsync = makeProjectMetadataFileAsync;
73
109
  async function makeProjectTarballAsync(vcsClient) {
74
110
  const spinner = (0, ora_1.ora)('Compressing project files');
75
111
  await fs_extra_1.default.mkdirp((0, paths_1.getTmpDirectory)());
@@ -0,0 +1,18 @@
1
+ import { Platform } from '@expo/eas-build-job';
2
+ import EasCommand from '../../commandUtils/EasCommand';
3
+ export default class InitializeBuildCredentials extends EasCommand {
4
+ static description: string;
5
+ static flags: {
6
+ platform: import("@oclif/core/lib/interfaces").OptionFlag<Platform | undefined>;
7
+ profile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
8
+ };
9
+ static contextDefinition: {
10
+ vcsClient: import("../../commandUtils/context/VcsClientContextField").default;
11
+ analytics: import("../../commandUtils/context/AnalyticsContextField").default;
12
+ getDynamicPublicProjectConfigAsync: import("../../commandUtils/context/DynamicProjectConfigContextField").DynamicPublicProjectConfigContextField;
13
+ getDynamicPrivateProjectConfigAsync: import("../../commandUtils/context/DynamicProjectConfigContextField").DynamicPrivateProjectConfigContextField;
14
+ loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
15
+ privateProjectConfig: import("../../commandUtils/context/PrivateProjectConfigContextField").PrivateProjectConfigContextField;
16
+ };
17
+ runAsync(): Promise<void>;
18
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const tslib_1 = require("tslib");
5
+ const eas_build_job_1 = require("@expo/eas-build-job");
6
+ const core_1 = require("@oclif/core");
7
+ const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
8
+ const SelectBuildProfileFromEasJson_1 = require("../../credentials/manager/SelectBuildProfileFromEasJson");
9
+ const SetUpBuildCredentialsCommandAction_1 = require("../../credentials/manager/SetUpBuildCredentialsCommandAction");
10
+ const platform_1 = require("../../platform");
11
+ class InitializeBuildCredentials extends EasCommand_1.default {
12
+ async runAsync() {
13
+ var _b;
14
+ const { flags } = await this.parse(_a);
15
+ const { loggedIn: { actor, graphqlClient }, privateProjectConfig, getDynamicPrivateProjectConfigAsync, analytics, vcsClient, } = await this.getContextAsync(_a, {
16
+ nonInteractive: false,
17
+ });
18
+ const platform = await (0, platform_1.selectPlatformAsync)(flags.platform);
19
+ const buildProfile = (_b = flags.profile) !== null && _b !== void 0 ? _b : (await new SelectBuildProfileFromEasJson_1.SelectBuildProfileFromEasJson(privateProjectConfig.projectDir, eas_build_job_1.Platform.IOS).getProfileNameFromEasConfigAsync());
20
+ await new SetUpBuildCredentialsCommandAction_1.SetUpBuildCredentialsCommandAction(actor, graphqlClient, vcsClient, analytics, privateProjectConfig !== null && privateProjectConfig !== void 0 ? privateProjectConfig : null, getDynamicPrivateProjectConfigAsync, platform, buildProfile).runAsync();
21
+ }
22
+ }
23
+ _a = InitializeBuildCredentials;
24
+ InitializeBuildCredentials.description = 'Set up credentials for building your project.';
25
+ InitializeBuildCredentials.flags = {
26
+ platform: core_1.Flags.enum({
27
+ char: 'p',
28
+ options: [eas_build_job_1.Platform.ANDROID, eas_build_job_1.Platform.IOS],
29
+ }),
30
+ profile: core_1.Flags.string({
31
+ char: 'e',
32
+ description: 'The name of the build profile in eas.json.',
33
+ helpValue: 'PROFILE_NAME',
34
+ }),
35
+ };
36
+ InitializeBuildCredentials.contextDefinition = {
37
+ ..._a.ContextOptions.LoggedIn,
38
+ ..._a.ContextOptions.ProjectConfig,
39
+ ..._a.ContextOptions.DynamicProjectConfig,
40
+ ..._a.ContextOptions.Analytics,
41
+ ..._a.ContextOptions.Vcs,
42
+ };
43
+ exports.default = InitializeBuildCredentials;
@@ -0,0 +1,16 @@
1
+ import EasCommand from '../../commandUtils/EasCommand';
2
+ export default class Credentials extends EasCommand {
3
+ static description: string;
4
+ static flags: {
5
+ platform: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
6
+ };
7
+ static contextDefinition: {
8
+ vcsClient: import("../../commandUtils/context/VcsClientContextField").default;
9
+ analytics: import("../../commandUtils/context/AnalyticsContextField").default;
10
+ getDynamicPublicProjectConfigAsync: import("../../commandUtils/context/DynamicProjectConfigContextField").DynamicPublicProjectConfigContextField;
11
+ getDynamicPrivateProjectConfigAsync: import("../../commandUtils/context/DynamicProjectConfigContextField").DynamicPrivateProjectConfigContextField;
12
+ privateProjectConfig: import("../../commandUtils/context/OptionalPrivateProjectConfigContextField").OptionalPrivateProjectConfigContextField;
13
+ loggedIn: import("../../commandUtils/context/LoggedInContextField").default;
14
+ };
15
+ runAsync(): Promise<void>;
16
+ }
@@ -3,8 +3,8 @@ var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const tslib_1 = require("tslib");
5
5
  const core_1 = require("@oclif/core");
6
- const EasCommand_1 = tslib_1.__importDefault(require("../commandUtils/EasCommand"));
7
- const SelectPlatform_1 = require("../credentials/manager/SelectPlatform");
6
+ const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
7
+ const SelectPlatform_1 = require("../../credentials/manager/SelectPlatform");
8
8
  class Credentials extends EasCommand_1.default {
9
9
  async runAsync() {
10
10
  const { flags } = await this.parse(_a);
@@ -11,6 +11,7 @@ export default class Submit extends EasCommand {
11
11
  url: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>;
12
12
  verbose: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
13
13
  wait: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
14
+ 'verbose-fastlane': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
14
15
  'non-interactive': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
15
16
  };
16
17
  static contextDefinition: {
@@ -41,6 +41,7 @@ class Submit extends EasCommand_1.default {
41
41
  profile: submissionProfile.profile,
42
42
  archiveFlags: flagsWithPlatform.archiveFlags,
43
43
  nonInteractive: flagsWithPlatform.nonInteractive,
44
+ isVerboseFastlaneEnabled: flagsWithPlatform.isVerboseFastlaneEnabled,
44
45
  actor,
45
46
  graphqlClient,
46
47
  analytics,
@@ -67,7 +68,7 @@ class Submit extends EasCommand_1.default {
67
68
  }
68
69
  }
69
70
  sanitizeFlags(flags) {
70
- const { platform, verbose, wait, profile, 'non-interactive': nonInteractive, ...archiveFlags } = flags;
71
+ const { platform, verbose, wait, profile, 'non-interactive': nonInteractive, 'verbose-fastlane': isVerboseFastlaneEnabled, ...archiveFlags } = flags;
71
72
  if (!flags.platform && nonInteractive) {
72
73
  core_1.Errors.error('--platform is required when building in non-interactive mode', { exit: 1 });
73
74
  }
@@ -82,6 +83,7 @@ class Submit extends EasCommand_1.default {
82
83
  wait,
83
84
  profile,
84
85
  nonInteractive,
86
+ isVerboseFastlaneEnabled,
85
87
  };
86
88
  }
87
89
  async ensurePlatformSelectedAsync(flags) {
@@ -134,6 +136,10 @@ Submit.flags = {
134
136
  default: true,
135
137
  allowNo: true,
136
138
  }),
139
+ 'verbose-fastlane': core_1.Flags.boolean({
140
+ default: false,
141
+ description: 'Enable verbose logging for the submission process',
142
+ }),
137
143
  'non-interactive': core_1.Flags.boolean({
138
144
  default: false,
139
145
  description: 'Run command in non-interactive mode',
@@ -32,7 +32,8 @@ export declare enum AndroidActionType {
32
32
  RemoveGsaKeyForFcmV1 = 20,
33
33
  SetUpGsaKeyForFcmV1 = 21,
34
34
  UpdateCredentialsJson = 22,
35
- SetUpBuildCredentialsFromCredentialsJson = 23
35
+ SetUpBuildCredentialsFromCredentialsJson = 23,
36
+ SetUpBuildCredentials = 24
36
37
  }
37
38
  export declare enum IosActionType {
38
39
  ManageCredentialsJson = 0,
@@ -33,6 +33,7 @@ var AndroidActionType;
33
33
  AndroidActionType[AndroidActionType["SetUpGsaKeyForFcmV1"] = 21] = "SetUpGsaKeyForFcmV1";
34
34
  AndroidActionType[AndroidActionType["UpdateCredentialsJson"] = 22] = "UpdateCredentialsJson";
35
35
  AndroidActionType[AndroidActionType["SetUpBuildCredentialsFromCredentialsJson"] = 23] = "SetUpBuildCredentialsFromCredentialsJson";
36
+ AndroidActionType[AndroidActionType["SetUpBuildCredentials"] = 24] = "SetUpBuildCredentials";
36
37
  })(AndroidActionType || (exports.AndroidActionType = AndroidActionType = {}));
37
38
  var IosActionType;
38
39
  (function (IosActionType) {
@@ -0,0 +1,10 @@
1
+ import { Platform } from '@expo/eas-build-job';
2
+ import { BuildProfile } from '@expo/eas-json';
3
+ export declare class CheckBuildProfileFlagAgainstEasJson<T extends Platform> {
4
+ private platform;
5
+ private profileNameFromFlag;
6
+ private easJsonAccessor;
7
+ constructor(projectDir: string, platform: T, profileNameFromFlag: string);
8
+ runAsync(): Promise<BuildProfile<T>>;
9
+ getProfileNameFromEasConfigAsync(): Promise<string>;
10
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CheckBuildProfileFlagAgainstEasJson = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const eas_json_1 = require("@expo/eas-json");
6
+ const log_1 = tslib_1.__importDefault(require("../../log"));
7
+ class CheckBuildProfileFlagAgainstEasJson {
8
+ constructor(projectDir, platform, profileNameFromFlag) {
9
+ this.platform = platform;
10
+ this.profileNameFromFlag = profileNameFromFlag;
11
+ this.easJsonAccessor = eas_json_1.EasJsonAccessor.fromProjectPath(projectDir);
12
+ }
13
+ async runAsync() {
14
+ const profileName = await this.getProfileNameFromEasConfigAsync();
15
+ const easConfig = await eas_json_1.EasJsonUtils.getBuildProfileAsync(this.easJsonAccessor, this.platform, profileName);
16
+ log_1.default.succeed(`Using build profile: ${profileName}`);
17
+ return easConfig;
18
+ }
19
+ async getProfileNameFromEasConfigAsync() {
20
+ const buildProfileNames = await eas_json_1.EasJsonUtils.getBuildProfileNamesAsync(this.easJsonAccessor);
21
+ if (buildProfileNames.length === 0) {
22
+ throw new Error('You need at least one iOS build profile declared in eas.json. Go to https://docs.expo.dev/build/eas-json/ for more details');
23
+ }
24
+ else if (buildProfileNames.length === 1) {
25
+ return buildProfileNames[0];
26
+ }
27
+ if (buildProfileNames.includes(this.profileNameFromFlag)) {
28
+ return this.profileNameFromFlag;
29
+ }
30
+ else {
31
+ throw new Error(`Build profile ${this.profileNameFromFlag} does not exist in eas.json. Go to https://docs.expo.dev/build/eas-json/ for more details`);
32
+ }
33
+ }
34
+ }
35
+ exports.CheckBuildProfileFlagAgainstEasJson = CheckBuildProfileFlagAgainstEasJson;
@@ -1,10 +1,14 @@
1
- import { ActionInfo } from './Actions';
1
+ import { Platform } from '@expo/eas-build-job';
2
+ import { BuildProfile } from '@expo/eas-json';
3
+ import { ActionInfo, AndroidActionType } from './Actions';
2
4
  import { Action } from './HelperActions';
5
+ import { GradleBuildContext } from '../../project/android/gradle';
6
+ import { CredentialsContext } from '../context';
3
7
  export declare class ManageAndroid {
4
- private callingAction;
5
- private projectDir;
8
+ protected callingAction: Action;
9
+ protected projectDir: string;
6
10
  constructor(callingAction: Action, projectDir: string);
7
11
  runAsync(currentActions?: ActionInfo[]): Promise<void>;
8
- private createProjectContextAsync;
9
- private runProjectSpecificActionAsync;
12
+ protected createProjectContextAsync(ctx: CredentialsContext, buildProfile: BuildProfile<Platform.ANDROID>): Promise<GradleBuildContext | undefined>;
13
+ protected runProjectSpecificActionAsync(ctx: CredentialsContext, action: AndroidActionType, gradleContext?: GradleBuildContext): Promise<void>;
10
14
  }
@@ -24,6 +24,7 @@ const DownloadKeystore_1 = require("../android/actions/DownloadKeystore");
24
24
  const RemoveFcm_1 = require("../android/actions/RemoveFcm");
25
25
  const RemoveGoogleServiceAccountKey_1 = require("../android/actions/RemoveGoogleServiceAccountKey");
26
26
  const RemoveKeystore_1 = require("../android/actions/RemoveKeystore");
27
+ const SetUpBuildCredentials_1 = require("../android/actions/SetUpBuildCredentials");
27
28
  const SetUpBuildCredentialsFromCredentialsJson_1 = require("../android/actions/SetUpBuildCredentialsFromCredentialsJson");
28
29
  const SetUpGoogleServiceAccountKeyForFcmV1_1 = require("../android/actions/SetUpGoogleServiceAccountKeyForFcmV1");
29
30
  const SetUpGoogleServiceAccountKeyForSubmissions_1 = require("../android/actions/SetUpGoogleServiceAccountKeyForSubmissions");
@@ -208,6 +209,9 @@ class ManageAndroid {
208
209
  else if (action === Actions_1.AndroidActionType.SetUpBuildCredentialsFromCredentialsJson) {
209
210
  await new SetUpBuildCredentialsFromCredentialsJson_1.SetUpBuildCredentialsFromCredentialsJson(appLookupParams).runAsync(ctx);
210
211
  }
212
+ else if (action === Actions_1.AndroidActionType.SetUpBuildCredentials) {
213
+ await new SetUpBuildCredentials_1.SetUpBuildCredentials({ app: appLookupParams }).runAsync(ctx);
214
+ }
211
215
  }
212
216
  }
213
217
  exports.ManageAndroid = ManageAndroid;
@@ -1,13 +1,22 @@
1
- import { ActionInfo } from './Actions';
1
+ import { Platform } from '@expo/eas-build-job';
2
+ import { BuildProfile } from '@expo/eas-json';
3
+ import { ActionInfo, IosActionType } from './Actions';
2
4
  import { Action } from './HelperActions';
5
+ import { AccountFragment, AppleDistributionCertificateFragment, IosAppBuildCredentialsFragment, IosDistributionType as IosDistributionTypeGraphql } from '../../graphql/generated';
6
+ import { CredentialsContext } from '../context';
7
+ import { AppLookupParams } from '../ios/api/graphql/types/AppLookupParams';
8
+ import { App, Target } from '../ios/types';
3
9
  export declare class ManageIos {
4
- private callingAction;
5
- private projectDir;
10
+ protected callingAction: Action;
11
+ protected projectDir: string;
6
12
  constructor(callingAction: Action, projectDir: string);
7
13
  runAsync(currentActions?: ActionInfo[]): Promise<void>;
8
- private createProjectContextAsync;
9
- private runAccountSpecificActionAsync;
10
- private runProjectSpecificActionAsync;
11
- private setupProvisioningProfileWithSpecificDistCertAsync;
12
- private selectTargetAsync;
14
+ protected createProjectContextAsync(ctx: CredentialsContext, account: AccountFragment, buildProfile: BuildProfile<Platform.IOS>): Promise<{
15
+ app: App;
16
+ targets: Target[];
17
+ }>;
18
+ protected runAccountSpecificActionAsync(ctx: CredentialsContext, account: AccountFragment, action: IosActionType): Promise<void>;
19
+ protected runProjectSpecificActionAsync(ctx: CredentialsContext, app: App, targets: Target[], buildProfile: BuildProfile<Platform.IOS>, action: IosActionType): Promise<void>;
20
+ protected setupProvisioningProfileWithSpecificDistCertAsync(ctx: CredentialsContext, target: Target, appLookupParams: AppLookupParams, distCert: AppleDistributionCertificateFragment, distributionType: IosDistributionTypeGraphql): Promise<IosAppBuildCredentialsFragment>;
21
+ protected selectTargetAsync(targets: Target[]): Promise<Target>;
13
22
  }
@@ -0,0 +1,7 @@
1
+ import { Action } from './HelperActions';
2
+ import { ManageAndroid } from './ManageAndroid';
3
+ export declare class SetUpAndroidBuildCredentials extends ManageAndroid {
4
+ private setUpBuildCredentialsWithProfileNameFromFlag;
5
+ constructor(callingAction: Action, projectDir: string, setUpBuildCredentialsWithProfileNameFromFlag: string);
6
+ runAsync(): Promise<void>;
7
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SetUpAndroidBuildCredentials = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const eas_build_job_1 = require("@expo/eas-build-job");
6
+ const assert_1 = tslib_1.__importDefault(require("assert"));
7
+ const Actions_1 = require("./Actions");
8
+ const CheckBuildProfileFlagAgainstEasJson_1 = require("./CheckBuildProfileFlagAgainstEasJson");
9
+ const ManageAndroid_1 = require("./ManageAndroid");
10
+ const context_1 = require("../context");
11
+ class SetUpAndroidBuildCredentials extends ManageAndroid_1.ManageAndroid {
12
+ constructor(callingAction, projectDir, setUpBuildCredentialsWithProfileNameFromFlag) {
13
+ super(callingAction, projectDir);
14
+ this.setUpBuildCredentialsWithProfileNameFromFlag = setUpBuildCredentialsWithProfileNameFromFlag;
15
+ }
16
+ async runAsync() {
17
+ const hasProjectContext = !!this.callingAction.projectInfo;
18
+ const buildProfile = hasProjectContext
19
+ ? await new CheckBuildProfileFlagAgainstEasJson_1.CheckBuildProfileFlagAgainstEasJson(this.projectDir, eas_build_job_1.Platform.ANDROID, this.setUpBuildCredentialsWithProfileNameFromFlag).runAsync()
20
+ : null;
21
+ let projectInfo = null;
22
+ if (hasProjectContext) {
23
+ const { exp, projectId } = await this.callingAction.getDynamicPrivateProjectConfigAsync({
24
+ env: buildProfile === null || buildProfile === void 0 ? void 0 : buildProfile.env,
25
+ });
26
+ projectInfo = { exp, projectId };
27
+ }
28
+ const ctx = new context_1.CredentialsContext({
29
+ projectDir: process.cwd(),
30
+ projectInfo,
31
+ user: this.callingAction.actor,
32
+ graphqlClient: this.callingAction.graphqlClient,
33
+ analytics: this.callingAction.analytics,
34
+ env: buildProfile === null || buildProfile === void 0 ? void 0 : buildProfile.env,
35
+ nonInteractive: false,
36
+ vcsClient: this.callingAction.vcsClient,
37
+ });
38
+ let gradleContext;
39
+ if (ctx.hasProjectContext) {
40
+ (0, assert_1.default)(buildProfile, 'buildProfile must be defined in a project context');
41
+ gradleContext = await this.createProjectContextAsync(ctx, buildProfile);
42
+ }
43
+ if (this.setUpBuildCredentialsWithProfileNameFromFlag) {
44
+ await this.runProjectSpecificActionAsync(ctx, Actions_1.AndroidActionType.SetUpBuildCredentials, gradleContext);
45
+ }
46
+ }
47
+ }
48
+ exports.SetUpAndroidBuildCredentials = SetUpAndroidBuildCredentials;
@@ -0,0 +1,19 @@
1
+ import { Platform } from '@expo/eas-build-job';
2
+ import { Analytics } from '../../analytics/AnalyticsManager';
3
+ import { DynamicConfigContextFn } from '../../commandUtils/context/DynamicProjectConfigContextField';
4
+ import { ExpoGraphqlClient } from '../../commandUtils/context/contextUtils/createGraphqlClient';
5
+ import { Actor } from '../../user/User';
6
+ import { Client } from '../../vcs/vcs';
7
+ import { CredentialsContextProjectInfo } from '../context';
8
+ export declare class SetUpBuildCredentialsCommandAction {
9
+ readonly actor: Actor;
10
+ readonly graphqlClient: ExpoGraphqlClient;
11
+ readonly vcsClient: Client;
12
+ readonly analytics: Analytics;
13
+ readonly projectInfo: CredentialsContextProjectInfo | null;
14
+ readonly getDynamicPrivateProjectConfigAsync: DynamicConfigContextFn;
15
+ private readonly platform;
16
+ private readonly profileName;
17
+ constructor(actor: Actor, graphqlClient: ExpoGraphqlClient, vcsClient: Client, analytics: Analytics, projectInfo: CredentialsContextProjectInfo | null, getDynamicPrivateProjectConfigAsync: DynamicConfigContextFn, platform: Platform, profileName: string);
18
+ runAsync(): Promise<void>;
19
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SetUpBuildCredentialsCommandAction = void 0;
4
+ const eas_build_job_1 = require("@expo/eas-build-job");
5
+ const SetUpAndroidBuildCredentials_1 = require("../manager/SetUpAndroidBuildCredentials");
6
+ const SetUpIosBuildCredentials_1 = require("../manager/SetUpIosBuildCredentials");
7
+ class SetUpBuildCredentialsCommandAction {
8
+ constructor(actor, graphqlClient, vcsClient, analytics, projectInfo, getDynamicPrivateProjectConfigAsync, platform, profileName) {
9
+ this.actor = actor;
10
+ this.graphqlClient = graphqlClient;
11
+ this.vcsClient = vcsClient;
12
+ this.analytics = analytics;
13
+ this.projectInfo = projectInfo;
14
+ this.getDynamicPrivateProjectConfigAsync = getDynamicPrivateProjectConfigAsync;
15
+ this.platform = platform;
16
+ this.profileName = profileName;
17
+ }
18
+ async runAsync() {
19
+ if (this.platform === eas_build_job_1.Platform.IOS) {
20
+ return await new SetUpIosBuildCredentials_1.SetUpIosBuildCredentials(this, process.cwd(), this.profileName).runAsync();
21
+ }
22
+ return await new SetUpAndroidBuildCredentials_1.SetUpAndroidBuildCredentials(this, process.cwd(), this.profileName).runAsync();
23
+ }
24
+ }
25
+ exports.SetUpBuildCredentialsCommandAction = SetUpBuildCredentialsCommandAction;
@@ -0,0 +1,7 @@
1
+ import { Action } from './HelperActions';
2
+ import { ManageIos } from './ManageIos';
3
+ export declare class SetUpIosBuildCredentials extends ManageIos {
4
+ private setUpBuildCredentialsWithProfileNameFromFlag;
5
+ constructor(callingAction: Action, projectDir: string, setUpBuildCredentialsWithProfileNameFromFlag: string);
6
+ runAsync(): Promise<void>;
7
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SetUpIosBuildCredentials = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const eas_build_job_1 = require("@expo/eas-build-job");
6
+ const assert_1 = tslib_1.__importDefault(require("assert"));
7
+ const nullthrows_1 = tslib_1.__importDefault(require("nullthrows"));
8
+ const Actions_1 = require("./Actions");
9
+ const CheckBuildProfileFlagAgainstEasJson_1 = require("./CheckBuildProfileFlagAgainstEasJson");
10
+ const ManageIos_1 = require("./ManageIos");
11
+ const projectUtils_1 = require("../../project/projectUtils");
12
+ const actions_1 = require("../../user/actions");
13
+ const context_1 = require("../context");
14
+ class SetUpIosBuildCredentials extends ManageIos_1.ManageIos {
15
+ constructor(callingAction, projectDir, setUpBuildCredentialsWithProfileNameFromFlag) {
16
+ super(callingAction, projectDir);
17
+ this.setUpBuildCredentialsWithProfileNameFromFlag = setUpBuildCredentialsWithProfileNameFromFlag;
18
+ }
19
+ async runAsync() {
20
+ const buildProfile = this.callingAction.projectInfo
21
+ ? await new CheckBuildProfileFlagAgainstEasJson_1.CheckBuildProfileFlagAgainstEasJson(this.projectDir, eas_build_job_1.Platform.IOS, this.setUpBuildCredentialsWithProfileNameFromFlag).runAsync()
22
+ : null;
23
+ let projectInfo = null;
24
+ if (this.callingAction.projectInfo) {
25
+ const { exp, projectId } = await this.callingAction.getDynamicPrivateProjectConfigAsync({
26
+ env: buildProfile === null || buildProfile === void 0 ? void 0 : buildProfile.env,
27
+ });
28
+ projectInfo = { exp, projectId };
29
+ }
30
+ const ctx = new context_1.CredentialsContext({
31
+ projectDir: process.cwd(),
32
+ projectInfo,
33
+ user: this.callingAction.actor,
34
+ graphqlClient: this.callingAction.graphqlClient,
35
+ analytics: this.callingAction.analytics,
36
+ env: buildProfile === null || buildProfile === void 0 ? void 0 : buildProfile.env,
37
+ nonInteractive: false,
38
+ vcsClient: this.callingAction.vcsClient,
39
+ });
40
+ await ctx.bestEffortAppStoreAuthenticateAsync();
41
+ const getAccountForProjectAsync = async (projectId) => {
42
+ return await (0, projectUtils_1.getOwnerAccountForProjectIdAsync)(ctx.graphqlClient, projectId);
43
+ };
44
+ const account = ctx.hasProjectContext
45
+ ? await getAccountForProjectAsync(ctx.projectId)
46
+ : (0, actions_1.ensureActorHasPrimaryAccount)(ctx.user);
47
+ let app = null;
48
+ let targets = null;
49
+ if (ctx.hasProjectContext) {
50
+ (0, assert_1.default)(buildProfile, 'buildProfile must be defined in project context');
51
+ const projectContext = await this.createProjectContextAsync(ctx, account, buildProfile);
52
+ app = projectContext.app;
53
+ targets = projectContext.targets;
54
+ }
55
+ await this.runProjectSpecificActionAsync(ctx, (0, nullthrows_1.default)(app, 'app must be defined in project context'), (0, nullthrows_1.default)(targets, 'targets must be defined in project context'), (0, nullthrows_1.default)(buildProfile, 'buildProfile must be defined in project context'), Actions_1.IosActionType.SetUpBuildCredentials);
56
+ }
57
+ }
58
+ exports.SetUpIosBuildCredentials = SetUpIosBuildCredentials;