@mongez/gnz
Version:
Generator Z, the next generation of scaffolding tools.
26 lines (25 loc) • 1.38 kB
JavaScript
import {trim}from'@mongez/reinforcements';import {Command}from'commander';import path from'path';import {generateWarlockModule}from'../../index.js';import {gnz}from'../../../../../main.js';const newWarlockModuleCommand = new 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: path$1, columns, withLocales, withEvents, subModule } = options;
const columnList = columns
? columns.split(",").reduce((prev, current) => {
const [key, value] = current.split(":");
prev[trim(key)] = trim(value);
return prev;
}, {})
: {};
await gnz.execute(generateWarlockModule.execute({
name,
saveTo: path.resolve(process.cwd(), path$1 || ""),
columns: columnList,
withEvents: withEvents !== "false",
withLocales: withLocales !== "false",
subModule,
}));
});export{newWarlockModuleCommand};//# sourceMappingURL=new-warlock-module-command.js.map