UNPKG

@lenne.tech/cli

Version:

lenne.Tech CLI: lt

57 lines (56 loc) 2.07 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); /** * Create a new branch */ const NewCommand = { alias: ['pg'], description: 'Create TS playground', hidden: false, name: 'playground', run: (toolbox) => __awaiter(void 0, void 0, void 0, function* () { // Retrieve the tools we need const { print: { error }, prompt: { ask }, typescript, } = toolbox; const choices = ['StackBlitz (online)', 'Web-Maker (download)', 'Simple typescript project']; // Select type const { type } = yield ask({ choices: choices.slice(0), message: 'Select', name: 'type', type: 'select', }); switch (type) { case choices[0]: { yield typescript.stackblitz(); break; } case choices[1]: { yield typescript.webmaker(); break; } case choices[2]: { yield typescript.create(); break; } default: { error(`No option selected!${type}`); return; } } if (!toolbox.parameters.options.fromGluegunMenu) { process.exit(); } // For tests return 'typescript'; }), }; exports.default = NewCommand;