UNPKG

@mongez/gnz

Version:

Generator Z, the next generation of scaffolding tools.

32 lines (31 loc) 1.85 kB
'use strict';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 newReactComponentCommand = new commander.Command("reactive:form") .arguments("<name>") .option("-p, --path <path>", "Path to save the component to") .option("-m, --memo <memo>", "Whether to use memo or not") .option("-n, --inputs <inputs>", "Inputs to add to the component") .option("-sn, --single-name <singleName>", "Single name for the component") .option("-sp, --service-path <servicePath>", "Path to the service") .option("-s, --service-name <serviceName>", "Name of the service") .option("-i, --index <withIndex>", "Whether to generate an index file or not") .action(async (name, options) => { const { memo, index: index$1, path, inputs, singleName, servicePath, serviceName } = 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.generateReactiveFormComponent.execute({ name, saveTo: path__default.default.resolve(process.cwd(), path || ""), memo: memo !== "false", withIndex: index$1 !== "false", inputs: inputsList, singleName, serviceName, servicePath, })); });exports.newReactComponentCommand=newReactComponentCommand;//# sourceMappingURL=new-reactive-form-command.js.map