UNPKG

node-ff

Version:
73 lines 2.78 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 }); exports.Processig = void 0; const utils_1 = require("../../utils"); const control_1 = require("./control"); class Processig { constructor(resultPrompt, initializers = [ 'json', 'code', 'initial', 'eslint', 'no_typing', ]) { this.resultPrompt = resultPrompt; this.initializers = initializers; const { project, typing, git, orm } = this.resultPrompt; this.name = project.replace(/\s/g, '-'); this.typing = typing; this.git = git; this.orm = orm; this.in_process(); } in_process() { return __awaiter(this, void 0, void 0, function* () { try { yield this.create_structure({ project: this.name }); } catch (err) { if (err instanceof Error) { console.error(err.message); } } }); } create_structure({ project }) { return __awaiter(this, void 0, void 0, function* () { utils_1.exeCommands.execute({ commands: ` mkdir ${project} && cd ${project} && mkdir src .vscode `, }); if (this.git) { this.initializers.push('git'); utils_1.exeCommands.execute({ commands: `cd ${this.name} && git init -q`, }); } if (this.typing) { this.initializers.pop(); this.initializers.push('with_typing'); } yield new control_1.Control(this.name, this.typing, this.initializers, this.orm ? this.orm : false, utils_1.writeFile).exec({ final_comands: utils_1.exeCommands, initial_msg: '\n✏️ processando...', final_msg: `✅ processo finalizado! \n\n- Não deixe de ver o readme :)`, }); }); } } exports.Processig = Processig; //# sourceMappingURL=processing.js.map