UNPKG

eas-cli

Version:
82 lines (80 loc) 3.75 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 eas_json_1 = require("@expo/eas-json"); const core_1 = require("@oclif/core"); const chalk_1 = tslib_1.__importDefault(require("chalk")); const path_1 = tslib_1.__importDefault(require("path")); const configure_1 = require("../../build/configure"); const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand")); const context_1 = require("../../credentials/context"); const log_1 = tslib_1.__importStar(require("../../log")); const download_1 = require("../../metadata/download"); const errors_1 = require("../../metadata/errors"); const profiles_1 = require("../../utils/profiles"); class MetadataPull extends EasCommand_1.default { static description = 'generate the local store configuration from the app stores'; static flags = { profile: core_1.Flags.string({ char: 'e', description: 'Name of the submit profile from eas.json. Defaults to "production" if defined in eas.json.', }), }; static contextDefinition = { ...this.ContextOptions.ProjectConfig, ...this.ContextOptions.LoggedIn, ...this.ContextOptions.Analytics, ...this.ContextOptions.Vcs, }; async runAsync() { log_1.default.warn('EAS Metadata is in beta and subject to breaking changes.'); const { flags } = await this.parse(MetadataPull); const { loggedIn: { actor, graphqlClient }, privateProjectConfig: { exp, projectId, projectDir }, analytics, vcsClient, } = await this.getContextAsync(MetadataPull, { nonInteractive: false, withServerSideEnvironment: null, }); // this command is interactive (all nonInteractive flags passed to utility functions are false) await (0, configure_1.ensureProjectConfiguredAsync)({ projectDir, nonInteractive: false, vcsClient }); const submitProfiles = await (0, profiles_1.getProfilesAsync)({ type: 'submit', easJsonAccessor: eas_json_1.EasJsonAccessor.fromProjectPath(projectDir), platforms: [eas_build_job_1.Platform.IOS], profileName: flags.profile, projectDir, }); if (submitProfiles.length !== 1) { throw new Error('Metadata only supports iOS and a single submit profile.'); } const submitProfile = submitProfiles[0].profile; const credentialsCtx = new context_1.CredentialsContext({ projectInfo: { exp, projectId }, projectDir, user: actor, graphqlClient, analytics, nonInteractive: false, vcsClient, }); try { const filePath = await (0, download_1.downloadMetadataAsync)({ analytics, exp, credentialsCtx, projectDir, profile: submitProfile, }); const relativePath = path_1.default.relative(process.cwd(), filePath); log_1.default.addNewLineIfNone(); log_1.default.log(`🎉 Your store config is ready. - Update the ${chalk_1.default.bold(relativePath)} file to prepare the app information. - Run ${chalk_1.default.bold('eas submit')} or manually upload a new app version to the app stores. - Once the app is uploaded, run ${chalk_1.default.bold('eas metadata:push')} to sync the store config. - ${(0, log_1.learnMore)('https://docs.expo.dev/eas-metadata/introduction/')}`); } catch (error) { (0, errors_1.handleMetadataError)(error); } } } exports.default = MetadataPull;