(outputDir: string)
| 74 | } |
| 75 | |
| 76 | async function trimTrailingWhitespaceInMarkdown(outputDir: string) { |
| 77 | const entries = await readdir(outputDir, { withFileTypes: true }) |
| 78 | |
| 79 | await Promise.all( |
| 80 | entries.map(async (entry) => { |
| 81 | const path = resolve(outputDir, entry.name) |
| 82 | |
| 83 | if (entry.isDirectory()) { |
| 84 | await trimTrailingWhitespaceInMarkdown(path) |
| 85 | return |
| 86 | } |
| 87 | |
| 88 | if (!entry.isFile() || !path.endsWith('.md')) { |
| 89 | return |
| 90 | } |
| 91 | |
| 92 | const markdown = await readFile(path, 'utf8') |
| 93 | const trimmed = markdown.replace(/[ \t]+$/gm, '') |
| 94 | |
| 95 | if (trimmed !== markdown) { |
| 96 | await writeFile(path, trimmed) |
| 97 | } |
| 98 | }), |
| 99 | ) |
| 100 | } |
| 101 | |
| 102 | async function generatePackageReferenceDocs(pkg: PackageReferenceDocsConfig) { |
| 103 | const outputDir = pkg.outputDir |
no test coverage detected