From c631303be2b86f42b854b051066904edd754b8aa Mon Sep 17 00:00:00 2001 From: Yasutake Yohei <61961825+yasutakeyohei@users.noreply.github.com> Date: Fri, 2 Oct 2026 23:51:30 +0900 Subject: scripts/add-about-prop.mjs: タグ管理廃止に伴い削除 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/add-about-prop.mjs | 107 --------------------------------------------- 1 file changed, 107 deletions(-) delete mode 100644 scripts/add-about-prop.mjs diff --git a/scripts/add-about-prop.mjs b/scripts/add-about-prop.mjs deleted file mode 100644 index e519863..0000000 --- a/scripts/add-about-prop.mjs +++ /dev/null @@ -1,107 +0,0 @@ -import { readFileSync, writeFileSync } from "node:fs"; -import { readdir } from "node:fs/promises"; -import { join, extname, relative } from "node:path"; - -const DOCS_DIR = join(import.meta.dirname, "..", "src", "content", "docs"); - -/** - * Recursively collect all .mdx files. - */ -async function collectMdxFiles(dir) { - const entries = await readdir(dir, { withFileTypes: true }); - const files = []; - - for (const entry of entries) { - if (entry.name.startsWith("_")) continue; - const fullPath = join(dir, entry.name); - if (entry.isDirectory()) { - const subFiles = await collectMdxFiles(fullPath); - files.push(...subFiles); - } else if (extname(entry.name) === ".mdx") { - files.push(fullPath); - } - } - - return files; -} - -/** - * Extract tags from frontmatter. - */ -function extractTags(content) { - const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/); - if (!match) return []; - const fm = match[1]; - - // Match YAML-style tags array: tags:\n - tag1\n - tag2 - const tagSection = fm.match(/^tags:\s*\n((?:\s+-\s+.+\n?)*)/m); - if (!tagSection) return []; - - const tagLines = tagSection[1].match(/^\s+-\s+(.+)$/gm); - if (!tagLines) return []; - - return tagLines.map((line) => line.replace(/^\s+-\s+/, "").trim()); -} - -/** - * Infer `about` from tags. - * Uses the first tag that is not "一般質問". - */ -function inferAbout(tags) { - for (const tag of tags) { - if (tag !== "一般質問") return tag; - } - return null; -} - -async function main() { - const files = await collectMdxFiles(DOCS_DIR); - - let updated = 0; - let skipped = 0; - - for (const file of files) { - const content = readFileSync(file, "utf-8"); - - // Only process files that use QuestionSummary - if (!content.includes(" { - console.error("Error:", err); - process.exit(1); -}); -- cgit v1.3.1