UNPKG

@expressots/cli

Version:

Expressots CLI - modern, fast, lightweight nodejs web framework (@cli)

67 lines (66 loc) 1.98 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.generateProject = void 0; const form_1 = require("./form"); const coerceSchematicAliases = (arg) => { switch (arg) { case "u": return "usecase"; case "c": return "controller"; case "d": return "dto"; case "s": return "service"; case "p": return "provider"; case "e": return "entity"; case "mo": return "module"; case "mi": return "middleware"; default: return arg; } }; const generateProject = () => { return { command: "generate [schematic] [path] [method]", describe: "Generate ExpressoTS resource.", aliases: ["g"], builder: (yargs) => { yargs.positional("schematic", { choices: [ "usecase", "controller", "dto", "service", "provider", "entity", "module", "middleware", ], describe: "The schematic to generate", type: "string", coerce: coerceSchematicAliases, }); yargs.positional("path", { describe: "The path to generate the schematic", type: "string", alias: "d", }); yargs.positional("method", { choices: ["get", "post", "put", "patch", "delete"], describe: "HTTP method", type: "string", alias: "m", }); return yargs; }, handler: async ({ schematic, path, method }) => { await (0, form_1.createTemplate)({ schematic, path, method }); }, }; }; exports.generateProject = generateProject;