UNPKG

@mongez/gnz

Version:

Generator Z, the next generation of scaffolding tools.

37 lines (34 loc) 1.23 kB
import {toJson}from'../../../utils/converters.js';import'os';import {format}from'../../../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 = 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 format.typescript(content); }export{gnWarlockOutput};//# sourceMappingURL=template.js.map