UNPKG

@roeeyn/challenge-generator

Version:

Fetches a code challenge from the backend, and creates the necessary files to run locally.

21 lines (20 loc) 848 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.generateQuestion = exports.QuestionType = void 0; const tslib_1 = require("tslib"); const inquirer_1 = tslib_1.__importDefault(require("inquirer")); var QuestionType; (function (QuestionType) { QuestionType["INPUT"] = "input"; QuestionType["NUMBER"] = "number"; QuestionType["LIST"] = "list"; QuestionType["CONFIRM"] = "confirm"; })(QuestionType = exports.QuestionType || (exports.QuestionType = {})); const generateQuestion = async (cliParam, skipConfirmation, questionParams) => { return skipConfirmation ? { [questionParams.name]: cliParam } : cliParam === undefined ? inquirer_1.default.prompt([questionParams]) : { [questionParams.name]: cliParam }; }; exports.generateQuestion = generateQuestion;