UNPKG

@veecode-platform/safira-cli

Version:

Generate a microservice project from your spec.

59 lines (58 loc) 2.31 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const color_1 = tslib_1.__importDefault(require("@oclif/color")); const inquirer_1 = tslib_1.__importDefault(require("inquirer")); const constants_1 = require("../../constants"); const safira_license_1 = require("../../safira-globals/safira-license"); const constants_2 = require("../../utils/commands/constants"); const email_validator_1 = require("../../validator/email-validator"); const safiraColors = tslib_1.__importStar(require("../../colors.json")); const signupHook = async (opts) => { try { const license = safira_license_1.SafiraLicense.instance.getLicense(); if (license.email || license.name) { return; } } catch { } const neonGreen = color_1.default.hex(safiraColors["neon-green"]); console.log(constants_1.asciiSafira); console.log(neonGreen("Welcome to Safira CLI!")); console.log(color_1.default.bold("Please, fill the following form to sign up for the free trial:")); const register = await inquirer_1.default .prompt([ { name: "name", message: "What is your name?", validate(value) { if (value.length > 0) { return true; } return "Please enter your name"; }, }, { name: "email", message: "What is your email?", validate: function (email) { if (!email_validator_1.EmailValidator.validateEmail(email)) { console.log(". Please enter a valid email"); return false; } return true; }, }, { type: "list", name: "statics", message: `Do you allow the use anonymously of your statics? ➥ ${color_1.default.underline("To help us improve Safira-CLI, you can let your CLI send us information about how you use it and how it’s working.")}`, choices: constants_2.yesNoList, }, ]); register.statics = register.statics === "yes"; safira_license_1.SafiraLicense.instance.updateLicense(register); console.log(register); }; exports.default = signupHook;