@mongez/gnz
Version:
Generator Z, the next generation of scaffolding tools.
26 lines (25 loc) • 1.58 kB
JavaScript
;var reinforcements=require('@mongez/reinforcements'),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 newWarlockModuleCommand = new commander.Command("warlock:module")
.arguments("<name>")
.requiredOption("-p, --path <path>", "Path to save the file to, relative to the project root")
.option(".e, --withEvents <withEvents>", "Generate events file")
.option("-sb, --subModule", "Generate sub module")
.option("-l, --withLocales <withLocales>", "Generate locales file")
.option("-c, --columns <columns>", "Columns types: column=type,column2=type2...")
.action(async (name, options) => {
const { path, columns, withLocales, withEvents, subModule } = options;
const columnList = columns
? columns.split(",").reduce((prev, current) => {
const [key, value] = current.split(":");
prev[reinforcements.trim(key)] = reinforcements.trim(value);
return prev;
}, {})
: {};
await main.gnz.execute(index.generateWarlockModule.execute({
name,
saveTo: path__default.default.resolve(process.cwd(), path || ""),
columns: columnList,
withEvents: withEvents !== "false",
withLocales: withLocales !== "false",
subModule,
}));
});exports.newWarlockModuleCommand=newWarlockModuleCommand;//# sourceMappingURL=new-warlock-module-command.js.map