UNPKG

eas-cli

Version:
43 lines (42 loc) 2.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const eas_build_job_1 = require("@expo/eas-build-job"); const core_1 = require("@oclif/core"); const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand")); const SelectBuildProfileFromEasJson_1 = require("../../credentials/manager/SelectBuildProfileFromEasJson"); const SetUpBuildCredentialsCommandAction_1 = require("../../credentials/manager/SetUpBuildCredentialsCommandAction"); const platform_1 = require("../../platform"); class InitializeBuildCredentials extends EasCommand_1.default { static description = 'Set up credentials for building your project.'; static flags = { platform: core_1.Flags.enum({ char: 'p', options: [eas_build_job_1.Platform.ANDROID, eas_build_job_1.Platform.IOS], }), profile: core_1.Flags.string({ char: 'e', description: 'The name of the build profile in eas.json.', helpValue: 'PROFILE_NAME', }), }; static contextDefinition = { ...this.ContextOptions.LoggedIn, ...this.ContextOptions.ProjectConfig, ...this.ContextOptions.DynamicProjectConfig, ...this.ContextOptions.Analytics, ...this.ContextOptions.Vcs, }; async runAsync() { const { flags } = await this.parse(InitializeBuildCredentials); const { loggedIn: { actor, graphqlClient }, privateProjectConfig, getDynamicPrivateProjectConfigAsync, analytics, vcsClient, } = await this.getContextAsync(InitializeBuildCredentials, { nonInteractive: false, withServerSideEnvironment: null, }); const platform = await (0, platform_1.selectPlatformAsync)(flags.platform); const buildProfile = flags.profile ?? (await new SelectBuildProfileFromEasJson_1.SelectBuildProfileFromEasJson(privateProjectConfig.projectDir, eas_build_job_1.Platform.IOS).getProfileNameFromEasConfigAsync()); await new SetUpBuildCredentialsCommandAction_1.SetUpBuildCredentialsCommandAction(actor, graphqlClient, vcsClient, analytics, privateProjectConfig ?? null, getDynamicPrivateProjectConfigAsync, platform, buildProfile, process.cwd()).runAsync(); } } exports.default = InitializeBuildCredentials;