UNPKG

@sentry/wizard

Version:

Sentry wizard helping you to configure your project

58 lines 2.34 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MobileProject = void 0; const inquirer_1 = require("inquirer"); const Constants_1 = require("../../Constants"); const Logging_1 = require("../../Helper/Logging"); const BaseIntegration_1 = require("./BaseIntegration"); class MobileProject extends BaseIntegration_1.BaseIntegration { _platforms; getPlatforms(answers) { if (!answers.shouldConfigurePlatforms) { throw new Error('No platform selected'); } const shouldConfigurePlatforms = answers.shouldConfigurePlatforms; return Object.entries(shouldConfigurePlatforms) .filter((pair) => pair[1]) .map((pair) => pair[0]); // only return the keys } async shouldConfigure(answers) { let { shouldConfigurePlatforms } = answers; if (shouldConfigurePlatforms) { return { shouldConfigurePlatforms }; } const isPlatformSet = this._argv.platform && Array.isArray(this._argv.platform) && !!this._argv.platform.length; this._platforms = isPlatformSet ? this._argv.platform : (await this._platformSelector()).platform; shouldConfigurePlatforms = {}; // eslint-disable-next-line @typescript-eslint/no-misused-promises for (const platform of Object.values(Constants_1.Platform)) { shouldConfigurePlatforms[platform] = this._platforms.includes(platform) ? await this._shouldConfigurePlatform(platform) : false; if (shouldConfigurePlatforms[platform] === false && this._argv.uninstall === false) { (0, Logging_1.dim)(`will not configure ${platform}`); } } return { shouldConfigurePlatforms }; } _platformSelector() { if (this._argv.quiet) { throw new Error('You need to choose a platform'); } return (0, inquirer_1.prompt)([ { choices: (0, Constants_1.getPlatformChoices)(), message: 'Select the platforms you like to set up:', name: 'platform', type: 'checkbox', }, ]); } } exports.MobileProject = MobileProject; //# sourceMappingURL=MobileProject.js.map