@mongez/gnz
Version:
Generator Z, the next generation of scaffolding tools.
31 lines (30 loc) • 1.72 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 newWarlockOutputCommand = new commander.Command("warlock:output")
.arguments("<name>")
.option("-p, --path <path>", "Path to save the file to, relative to the project root")
.option("-we, --withExtend <withExtend>", "Whether add extend method or not")
.option("-wo, --withBaseOutputDetails <withBaseOutputDetails>", "Whether to merge output keys with base output")
.option("-o, --outputKeys <outputKeys>", 'Output keys, separated by comma, e.g. "name:string,age:number"')
.option("-f, --fileName <fileName>", "File name")
.action(async (name, options) => {
const { withExtend, path, withBaseOutputDetails, fileName, outputKeys } = options;
const outputKeysList = {};
if (outputKeys) {
const keys = outputKeys.split(",");
keys.forEach(key => {
const [keyName, keyType] = key.split(":");
if (!keyName)
return;
if (!keyType)
return;
outputKeysList[keyName] = keyType;
});
}
await main.gnz.execute(index.generateWarlockOutput.execute({
name,
saveTo: path__default.default.resolve(process.cwd(), path || ""),
withExtend: withExtend !== "false",
withBaseOutputDetails: withBaseOutputDetails !== "false",
fileName,
outputKeys: outputKeysList,
}));
});exports.newWarlockOutputCommand=newWarlockOutputCommand;//# sourceMappingURL=new-warlock-output-command.js.map