@expressots/cli
Version:
Expressots CLI - modern, fast, lightweight nodejs web framework (@cli)
31 lines (30 loc) • 1.28 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createTemplate = void 0;
const compiler_1 = __importDefault(require("../utils/compiler"));
const command_utils_1 = require("./utils/command-utils");
const nonopininated_cmd_1 = require("./utils/nonopininated-cmd");
const opinionated_cmd_1 = require("./utils/opinionated-cmd");
/**
* Create a template based on the schematic
* @param schematic - the schematic to create
* @param path - the path to create the schematic
* @param method - the http method
* @returns the file created
*/
const createTemplate = async ({ schematic, path: target, method, }) => {
const config = await compiler_1.default.loadConfig();
const pathStyle = (0, command_utils_1.checkPathStyle)(target);
let returnFile = "";
if (config.opinionated) {
returnFile = await (0, opinionated_cmd_1.opinionatedProcess)(schematic, target, method, config, pathStyle);
}
else {
returnFile = await (0, nonopininated_cmd_1.nonOpinionatedProcess)(schematic, target, method, config);
}
return returnFile;
};
exports.createTemplate = createTemplate;