UNPKG

@vxrn/takeout-cli

Version:

CLI tools for Takeout starter kit - interactive onboarding and project setup

79 lines (78 loc) 2.61 kB
import * as p from "@clack/prompts"; import pc from "picocolors"; function displayWelcome() { var projectName = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "Takeout"; console.info(), p.intro(pc.bgCyan(pc.black(` ${projectName} Starter Kit `))); } function displayOutro(message) { p.outro(pc.green(message)); } function displayPrerequisites(checks) { var items = checks.map(function (check) { var icon = check.installed ? pc.green("\u2713") : pc.red("\u2717"), message = check.message || ""; return `${icon} ${pc.bold(check.name)}: ${message}`; }); p.note(items.join(` `), "Prerequisites"); } function displayPortConflicts(conflicts) { if (conflicts.length !== 0) { var items = conflicts.map(function (conflict) { var pid = conflict.pid ? ` (PID: ${conflict.pid})` : ""; return `${pc.yellow("\u26A0")} Port ${conflict.port} (${conflict.name})${pid}`; }); p.note(items.join(` `), pc.yellow("Port Conflicts Detected")); } } async function confirmContinue(message) { var defaultValue = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, result = await p.confirm({ message, initialValue: defaultValue }); return p.isCancel(result) && (p.cancel("Operation cancelled."), process.exit(0)), result; } async function promptText(message, defaultValue, placeholder) { var result = await p.text({ message, defaultValue, placeholder }); return p.isCancel(result) && (p.cancel("Operation cancelled."), process.exit(0)), result; } async function promptPassword(message) { var result = await p.password({ message }); return p.isCancel(result) && (p.cancel("Operation cancelled."), process.exit(0)), result; } async function promptSelect(message, options) { var result = await p.select({ message, options }); return p.isCancel(result) && (p.cancel("Operation cancelled."), process.exit(0)), result; } function showSpinner(message) { var s = p.spinner(); return s.start(message), s; } function showError(message) { p.log.error(pc.red(message)); } function showWarning(message) { p.log.warning(pc.yellow(message)); } function showSuccess(message) { p.log.success(pc.green(message)); } function showInfo(message) { p.log.info(pc.blue(message)); } function showStep(message) { p.log.step(message); } export { confirmContinue, displayOutro, displayPortConflicts, displayPrerequisites, displayWelcome, promptPassword, promptSelect, promptText, showError, showInfo, showSpinner, showStep, showSuccess, showWarning }; //# sourceMappingURL=prompts.native.js.map