fix(docs): contributors when other language (#7066)

This commit is contained in:
三咲智子
2022-04-09 11:08:54 +08:00
committed by GitHub
parent 2ca93aabd7
commit cea5fbd8e9

View File

@@ -1,8 +1,9 @@
import fs from 'fs'
import path from 'path'
import glob from 'fast-glob'
import { docRoot, docsDirName, projRoot } from '@element-plus/build-utils'
import { REPO_BRANCH, REPO_PATH } from '@element-plus/build-constants'
import { getLang } from '../utils/lang'
import { getLang, languages } from '../utils/lang'
import footerLocale from '../i18n/component/footer.json'
import type { Plugin } from 'vite'
@@ -27,8 +28,12 @@ export function MarkdownTransform(): Plugin {
code = transformVpScriptSetup(code, append)
const compPath = path.resolve(docRoot, 'en-US/component')
if (id.startsWith(compPath)) {
const compPaths = await glob(`{${languages.join(',')}}/component`, {
cwd: docRoot,
absolute: true,
onlyDirectories: true,
})
if (compPaths.some((compPath) => id.startsWith(compPath))) {
code = transformComponentMarkdown(id, componentId, code, append)
}