Skip to content

Always pass formatters when rendering files to ensure generated code matches your project's style:

ts
await renderToFile(
  outputPath,
  template,
  templateData,
  { formatters } // <-- Include formatters from plugin options
);

If you generate code without templates, apply formatters manually:

ts
import { applyFormatters } from "@kosmojs/devlib";

let code = generateCodeSomehow();
code = await applyFormatters(code, outputPath, formatters);
await fs.writeFile(outputPath, code);

Released under the MIT License.