#424 一時コミット

このコミットが含まれているのは:
2026-10-08 02:24:39 +09:00
コミット a219cc350b
6個のファイルの変更、126行の追加、43行の削除
+2
ファイルの表示
@@ -22,3 +22,5 @@ dist-ssr
*.njsproj
*.sln
*.sw?
/help
生成ファイル
+4 -43
ファイルの表示
@@ -38,6 +38,7 @@
"remark-gfm": "^4.0.1",
"tailwind-merge": "^3.3.0",
"unist-util-visit-parents": "^6.0.1",
"yaml": "^2.9.1",
"zustand": "^5.0.8"
},
"devDependencies": {
@@ -2060,9 +2061,6 @@
"arm"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2077,9 +2075,6 @@
"arm"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2094,9 +2089,6 @@
"arm64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2111,9 +2103,6 @@
"arm64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2128,9 +2117,6 @@
"loong64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2145,9 +2131,6 @@
"loong64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2162,9 +2145,6 @@
"ppc64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2179,9 +2159,6 @@
"ppc64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2196,9 +2173,6 @@
"riscv64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2213,9 +2187,6 @@
"riscv64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2230,9 +2201,6 @@
"s390x"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2247,9 +2215,6 @@
"x64"
],
"dev": true,
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2264,9 +2229,6 @@
"x64"
],
"dev": true,
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -9114,10 +9076,9 @@
"license": "ISC"
},
"node_modules/yaml": {
"version": "2.8.3",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.3.tgz",
"integrity": "sha512-AvbaCLOO2Otw/lW5bmh9d/WEdcDFdQp2Z2ZUH3pX9U2ihyUY0nvLv7J6TrWowklRGPYbB/IuIMfYgxaCPg5Bpg==",
"dev": true,
"version": "2.9.1",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.9.1.tgz",
"integrity": "sha512-3NxN8+78OdzbT7C/WjGsyfPAtJaN3FNDsWxv7Y7mcDsT/oOmgW8BpyQQFFBnvZE3j9Y2Sdz1ULFLezL7Eb2yFw==",
"license": "ISC",
"bin": {
"yaml": "bin.mjs"
+1
ファイルの表示
@@ -42,6 +42,7 @@
"remark-gfm": "^4.0.1",
"tailwind-merge": "^3.3.0",
"unist-util-visit-parents": "^6.0.1",
"yaml": "^2.9.1",
"zustand": "^5.0.8"
},
"devDependencies": {
+75
ファイルの表示
@@ -0,0 +1,75 @@
import { parse } from 'yaml'
import type { ComponentType } from 'react'
type ArticleLanguage = {
title: string
currentEdition: string }
type ArticleMeta = {
identifier: string
canonicalLanguage: string
languages: Record<string, ArticleLanguage> }
type MdxModule = { default: ComponentType }
const articleFiles = import.meta.glob<string> (
'../../help/*/article.yml',
{ query: '?raw', import: 'default', eager: true, })
const editionFiles = import.meta.glob<MdxModule> ('../../help/*/editions/*/*.mdx')
const cameliseArticle = (value: {
identifier: string
canonical_language: string
languages: Record<string, {
title: string
current_edition: string }> }): ArticleMeta => (
{ identifier: value.identifier,
canonicalLanguage: value.canonical_language,
languages: Object.fromEntries (
Object.entries (value.languages).map (([language, data]) => [
language,
{ title: data.title,
currentEdition: data.current_edition, }])) })
export const getHelpArticle = (identifier: string): ArticleMeta | undefined => {
const path = `../../help/${identifier}/article.yml`
const source = articleFiles[path]
if (!(source))
return undefined
return cameliseArticle (parse (source))
}
export const getHelpEditions = (
identifier: string,
language: string,
): string[] => {
const prefix = `../../help/${identifier}/editions/${language}/`
return (Object.keys (editionFiles)
.filter (path => path.startsWith (prefix))
.map (path => path.slice (prefix.length, -'.mdx'.length))
.sort ())
}
export const getHelpEdition = async (
identifier: string,
language: string,
edition: string,
): Promise<ComponentType | undefined> => {
const path = `../../help/${identifier}/editions/${language}/${edition}.mdx`
const loader = editionFiles[path]
if (!(loader))
return undefined
return (await loader ()).default
}
ファイルの表示