UNPKG

@mongez/gnz

Version:

Generator Z, the next generation of scaffolding tools.

37 lines (34 loc) 1.29 kB
'use strict';var converters=require('../../../utils/converters.js');require('os');var prettifier=require('../../../utils/prettifier.js');async function gnWarlockOutput(options) { // const { name, withExtend, outputKeys, baseOutputDetailsPath, withBaseOutputDetails, withBaseOutputDetailsFunctionName, } = options; const imports = [ 'import { type FinalOutput, Output } from "@warlock.js/core"', ]; if (withBaseOutputDetails) { imports.push(`import { ${withBaseOutputDetailsFunctionName} } from "${baseOutputDetailsPath}"`); } const withExtendContent = withExtend ? ` /** * Extend the resource output * Called after transforming the resource output */ protected async extend() { // }` : ""; let output = converters.toJson(outputKeys); if (withBaseOutputDetails) output = `${withBaseOutputDetailsFunctionName}(${output})`; const content = ` ${imports.join("\n")} export class ${name} extends Output { /** * {@inheritdoc} */ protected output: FinalOutput = ${output}; ${withExtendContent} } `; return await prettifier.format.typescript(content); }exports.gnWarlockOutput=gnWarlockOutput;//# sourceMappingURL=template.js.map