eas-cli
Version:
EAS command line tool
46 lines (45 loc) • 1.78 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const graphql_tag_1 = tslib_1.__importDefault(require("graphql-tag"));
const EasCommand_1 = tslib_1.__importDefault(require("../../commandUtils/EasCommand"));
const client_1 = require("../../graphql/client");
const log_1 = tslib_1.__importDefault(require("../../log"));
const formatFields_1 = tslib_1.__importDefault(require("../../utils/formatFields"));
async function projectInfoByIdAsync(graphqlClient, appId) {
const data = await (0, client_1.withErrorHandlingAsync)(graphqlClient
.query((0, graphql_tag_1.default) `
query AppInfo($appId: String!) {
app {
byId(appId: $appId) {
id
fullName
}
}
}
`, { appId }, { additionalTypenames: ['App'] })
.toPromise());
return data;
}
class ProjectInfo extends EasCommand_1.default {
static description = 'information about the current project';
static contextDefinition = {
...this.ContextOptions.ProjectId,
...this.ContextOptions.LoggedIn,
};
async runAsync() {
const { projectId, loggedIn: { graphqlClient }, } = await this.getContextAsync(ProjectInfo, {
nonInteractive: true,
});
const { app } = await projectInfoByIdAsync(graphqlClient, projectId);
if (!app) {
throw new Error(`Could not find project with id: ${projectId}`);
}
log_1.default.addNewLineIfNone();
log_1.default.log((0, formatFields_1.default)([
{ label: 'fullName', value: app.byId.fullName },
{ label: 'ID', value: projectId },
]));
}
}
exports.default = ProjectInfo;
;