@mongez/gnz
Version:
Generator Z, the next generation of scaffolding tools.
29 lines (28 loc) • 1.77 kB
JavaScript
;var commander=require('commander'),path=require('path'),index=require('../../index.js'),main=require('../../../../main.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var path__default=/*#__PURE__*/_interopDefault(path);const newMoonlightModuleCommand = new commander.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, 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 main.gnz.execute(index.generateMoonlightModule.execute({
name,
saveTo: path__default.default.resolve(process.cwd(), path || ""),
addToAppModules: addToAppModules !== "false",
updateUrls: updateUrls !== "false",
usingPages: usingPages !== "false",
inputs: inputsList,
}));
});exports.newMoonlightModuleCommand=newMoonlightModuleCommand;//# sourceMappingURL=new-react-moonlight-module-command.js.map