(currentDir, tmpl, testResultsTable)
| 81 | ]; |
| 82 | |
| 83 | async function build(currentDir, tmpl, testResultsTable) { |
| 84 | const files = await readdir(currentDir); |
| 85 | for (const file of files) { |
| 86 | const filename = join(currentDir, file); |
| 87 | if (ignoredFiles.includes(filename)) { |
| 88 | continue; |
| 89 | } |
| 90 | const stats = await stat(filename); |
| 91 | const { mode } = stats; |
| 92 | if (stats.isDirectory()) { |
| 93 | await build(filename, tmpl); |
| 94 | } else { |
| 95 | let html = await readFile(filename, 'utf8'); |
| 96 | const parsed = parse(filename); |
| 97 | if (parsed.ext === '.md' && isUppercase(parsed.name)) { |
| 98 | const mdHtml = markedInstance.parse( |
| 99 | html.replace('<!--{{test-results-table}}-->', testResultsTable), |
| 100 | ); |
| 101 | html = tmpl |
| 102 | .replace('<!--{{title}}-->', getTitle(parsed.name)) |
| 103 | .replace('<!--{{content}}-->', mdHtml); |
| 104 | parsed.ext = '.html'; |
| 105 | parsed.name = parsed.name.toLowerCase(); |
| 106 | delete parsed.base; |
| 107 | } |
| 108 | parsed.dir = parsed.dir.replace(inputDir, outputDir); |
| 109 | const outfile = format(parsed); |
| 110 | await mkdir(dirname(outfile), { recursive: true }); |
| 111 | console.log('Writing file ' + outfile); |
| 112 | await writeFile(outfile, html, { mode }); |
| 113 | } |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | init().catch(console.error); |
no test coverage detected
searching dependent graphs…