UNPKG

boil-cli-tool

Version:

CLI tool - boilerplate template manager and generator

25 lines (24 loc) 811 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.generateTemplateFunction = exports.templateExists = void 0; // packages const fs_1 = require("fs"); // utils const utils_1 = require("../utils"); const rootPath = "./.boilerplate"; exports.templateExists = (name) => { return fs_1.existsSync(`${rootPath}/${name}.js`); }; const successMsg = (msg) => { return console.log(`${utils_1.emoji(":white_check_mark:")} writing: ${msg}`); }; exports.generateTemplateFunction = (name) => { const content = `// usage in templates:___${name}(arg1, arg2, ...)___ module.exports = function (/* any args incl. local & global template args */) { // insert code here }; `; const path = `${rootPath}/${name}.js`; fs_1.writeFileSync(path, content); successMsg(path); };