UNPKG

@7nohe/openapi-react-query-codegen

Version:
22 lines (21 loc) 805 B
import { IndentationText, NewLineKind, Project, QuoteKind } from "ts-morph"; export const formatOutput = async (outputPath) => { const project = new Project({ skipAddingFilesFromTsConfig: true, manipulationSettings: { indentationText: IndentationText.TwoSpaces, newLineKind: NewLineKind.LineFeed, quoteKind: QuoteKind.Double, usePrefixAndSuffixTextForRename: false, useTrailingCommas: true, }, }); const sourceFiles = project.addSourceFilesAtPaths(`${outputPath}/**/*`); const tasks = sourceFiles.map((sourceFile) => { sourceFile.formatText(); sourceFile.fixMissingImports(); sourceFile.organizeImports(); return sourceFile.save(); }); await Promise.all(tasks); };