UNPKG

@sentry/wizard

Version:

Sentry wizard helping you to configure your project

54 lines 1.98 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.startWizard = exports.getCurrentIntegration = void 0; const BottomBar_1 = require("./BottomBar"); const Logging_1 = require("./Logging"); function sanitizeAndValidateArgs(argv) { if (argv.quiet === undefined) { argv.quiet = true; (0, Logging_1.dim)('will activate quiet mode for you'); } // @ts-ignore skip-connect does not exist on args if (argv['skip-connect']) { // @ts-ignore skip-connect does not exist on args argv.skipConnect = argv['skip-connect']; // @ts-ignore skip-connect does not exist on args delete argv['skip-connect']; } // @ts-ignore skip-connect does not exist on args argv.promoCode = argv['promo-code']; } function getCurrentIntegration(answers) { return answers.integration; } exports.getCurrentIntegration = getCurrentIntegration; async function startWizard(argv, ...steps) { try { sanitizeAndValidateArgs(argv); if (argv.debug) { (0, Logging_1.debug)(argv); } if (argv.quiet) { (0, Logging_1.dim)("Quiet mode On, DAMA, don't ask me anything"); } return await steps .map((step) => new step(argv)) .reduce(async (answer, step) => { const prevAnswer = await answer; const answers = await step.emit(prevAnswer); return { ...prevAnswer, ...answers }; }, Promise.resolve({})); } catch (e) { BottomBar_1.BottomBar.hide(); (0, Logging_1.nl)(); (0, Logging_1.red)('Sentry Wizard failed with:'); (0, Logging_1.red)(argv.debug ? e : e.message); (0, Logging_1.nl)(); (0, Logging_1.red)('Protip: Add --debug to see whats going on'); (0, Logging_1.red)('OR use --help to see your options'); process.exit(1); } } exports.startWizard = startWizard; //# sourceMappingURL=Wizard.js.map