UNPKG

create-dolittle-microservice

Version:

In Norse mythology, the Vanir are a group of gods associated with health, fertility, wisdom, and the ability to see the future.

50 lines 2.36 kB
"use strict"; // Copyright (c) Dolittle. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. 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()); }); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.createMicroservice = exports.launchWizard = exports.argv = void 0; const path_1 = __importDefault(require("path")); const plop_1 = require("plop"); const args = process.argv.slice(2); exports.argv = require('minimist')(args); const vanir_cli_1 = require("@dolittle/vanir-cli"); const plopfile_1 = __importDefault(require("./plopfile")); const cwd = process.cwd(); const plopFile = path_1.default.join(__dirname, 'plopfile.js'); function launchWizard() { plop_1.Plop.launch({ cwd, configPath: plopFile, require: exports.argv.require, completion: exports.argv.completion }, env => plop_1.run(env, undefined, false)); } exports.launchWizard = launchWizard; function createMicroservice({ name, ui = true, portal = false, targetDirectory, id }) { return __awaiter(this, void 0, void 0, function* () { const helper = new vanir_cli_1.PlopHelper(plopfile_1.default); const answers = { name, ui, id }; if (portal) { answers.hasUIPrefix = false; } else { answers.hasUIPrefix = true; } const result = yield helper.runGenerator('microservice', answers, targetDirectory); return result; }); } exports.createMicroservice = createMicroservice; //# sourceMappingURL=creation.js.map