UNPKG

@mongez/gnz

Version:

Generator Z, the next generation of scaffolding tools.

29 lines (28 loc) 1.61 kB
import {Command}from'commander';import path from'path';import {generateMoonlightModule}from'../../index.js';import {gnz}from'../../../../main.js';const newMoonlightModuleCommand = new Command("moonlight") .arguments("<name>") .option("-p, --path <path>", "Path to save the module to") .option("-wdp, --without-details-page", "Generate without details page") .option("-au, --add-to-app-modules", "Add the module to app-modules.json") .option("-i, --inputs <inputs>", "Inputs to add to the module") .option("-ur, --update-urls", "Update urls.ts file") .option("-up, --using-pages", "Separate components directory from pages directory") .action(async (name, options) => { const { path: path$1, addToAppModules, updateUrls, inputs, usingPages } = options; const inputsList = {}; if (inputs) { // input will be name.string.required,email.email.required // so we just need to split the name to be the key object and the rest of the string to be its value inputs.split(",").forEach((input) => { const [inputName, ...restOfTypes] = input.split("."); inputsList[inputName] = restOfTypes.join("."); }); } await gnz.execute(generateMoonlightModule.execute({ name, saveTo: path.resolve(process.cwd(), path$1 || ""), addToAppModules: addToAppModules !== "false", updateUrls: updateUrls !== "false", usingPages: usingPages !== "false", inputs: inputsList, })); });export{newMoonlightModuleCommand};//# sourceMappingURL=new-react-moonlight-module-command.js.map