UNPKG

@mongez/gnz

Version:

Generator Z, the next generation of scaffolding tools.

30 lines (29 loc) 1.74 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 newSuperTableCommand = new commander.Command("reactive:table") .arguments("<name>") .option("-p, --path <path>", "Path to save the component to") .option("-m, --memo <memo>", "Whether to use memo or not") .option("-c, --columns <columns>", "Inputs to add to 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, columns, servicePath, serviceName } = options; const columnsList = {}; if (columns) { // 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 columns.split(",").forEach((input) => { const [inputName, ...restOfTypes] = input.split("."); columnsList[inputName] = restOfTypes.join("."); }); } await main.gnz.execute(index.generateSuperTableComponent.execute({ name, saveTo: path__default.default.resolve(process.cwd(), path || ""), memo: memo !== "false", withIndex: index$1 !== "false", columns: columnsList, serviceName, servicePath, })); });exports.newSuperTableCommand=newSuperTableCommand;//# sourceMappingURL=new-super-table-command.js.map