(filePath, category)
| 91 | } |
| 92 | |
| 93 | async function processFile(filePath, category) { |
| 94 | const rawContent = await readFile(filePath, 'utf-8'); |
| 95 | const name = basename(filePath, '.md'); |
| 96 | const slug = toSlug(name); |
| 97 | const title = toTitle(name); |
| 98 | const content = stripFrontmatter(rawContent); |
| 99 | |
| 100 | const description = extractDescription(content, `${title} - OctoBot tentacle documentation and configuration guide`); |
| 101 | |
| 102 | const frontmatter = `--- |
| 103 | title: "${escapeYaml(title)}" |
| 104 | description: "${escapeYaml(description)}" |
| 105 | keywords: [${category.keywords.map(k => `"${k}"`).join(', ')}, "${slug}"] |
| 106 | slug: /${category.slugBase}/${slug} |
| 107 | format: md |
| 108 | ---`; |
| 109 | |
| 110 | const output = `${frontmatter}\n\n${content}\n`; |
| 111 | const outputDir = join(CONTENT_DIR, category.audience, category.dir); |
| 112 | await mkdir(outputDir, {recursive: true}); |
| 113 | await writeFile(join(outputDir, `${slug}.md`), output, 'utf-8'); |
| 114 | } |
| 115 | |
| 116 | async function writeCategoryJson(dir, label, position) { |
| 117 | await mkdir(dir, {recursive: true}); |
no test coverage detected