eas-cli
Version:
EAS command line tool
76 lines (74 loc) • 3.29 kB
JavaScript
"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 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 errors_1 = require("../../metadata/errors");
const upload_1 = require("../../metadata/upload");
const profiles_1 = require("../../utils/profiles");
class MetadataPush extends EasCommand_1.default {
static description = 'sync the local store configuration to 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(MetadataPush);
const { loggedIn: { actor, graphqlClient }, privateProjectConfig: { exp, projectId, projectDir }, analytics, vcsClient, } = await this.getContextAsync(MetadataPush, {
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 { appleLink } = await (0, upload_1.uploadMetadataAsync)({
analytics,
exp,
credentialsCtx,
projectDir,
profile: submitProfile,
});
log_1.default.addNewLineIfNone();
log_1.default.log(`🎉 Store configuration is synced with the app stores.
${(0, log_1.learnMore)(appleLink, { learnMoreMessage: 'See the changes in App Store Connect' })}`);
}
catch (error) {
(0, errors_1.handleMetadataError)(error);
}
}
}
exports.default = MetadataPush;