import { defineConfig } from 'vitepress' import { CustomAvatars } from './constant' import { getChangelogAndContributors } from 'vitepress-plugin-changelog' export default defineConfig({ base: '/efe-docs/', outDir: './efe-docs', title: '文档', description: "剑鱼前端团队内部文档 - 探索前端世界,从文档开始", lang: 'zh-CN', themeConfig: { siteTitle: ' ', logo: { light: 'https://cdn-ali.jianyu360.com/images/index/logo_main.png', dark: 'https://cdn-ali.jianyu360.com/images/index/logo_white.png' }, nav: [ { text: '指南', link: '/guide/getting-started' }, { text: '组件', link: '/component/' }, { text: '知识库', items: [ { text: 'monorepo', link: '/monorepo/introduce' }, { text: '常见问题自检清单', link: '/check/' }, { text: '通用埋点相关', link: '/track/index-new' }, { text: 'go模板相关', link: '/go/go安装应用' } ] }, { text: 'packages', items: [ { text: '@jy/emiiter', link: '/core-emitter/introduce' }, { text: '@jy/plugin-login-auth', link: '/plugin-login-auth/introduce' }, { text: '@jianyu/cli', link: '/cli/' }, ] }, { text: '资源', link: '/resource' }, { text: '参与建设', link: '/to-do/' } ], sidebar: { '/guide/': { base: '/guide/', items: [ { text: '开发指南', base: '/guide/', items: [ { text: '项目简介', link: 'introduce' }, { text: '环境配置', link: 'development' }, { text: '快速上手', link: 'getting-started' }, ] }, { text: '代码风格', base: '/guide/style/', items: [ { text: '前言', link: 'introduce' }, { text: '文件命名规则', link: 'naming' }, { text: '通用规则', link: 'base' }, { text: 'HTML', link: 'html' }, { text: 'CSS', link: 'css' }, { text: 'JS', link: 'js' }, { text: 'Vue', link: 'vue' }, ] }, ] }, '/go/': { base: '/go/', items: [ { text: 'go模板相关指南', base: '/go/', items: [ { text: '安装应用', link: 'go安装应用' }, { text: '常用语法', link: 'go模板常用语法' }, ] } ] } }, outline: { label: '目录' }, search: { provider: 'local' }, lastUpdated: { text: '上次更新', formatOptions: { dateStyle: 'full', timeStyle: 'medium' } }, editLink: { pattern: 'https://jygit.jydev.jianyu360.cn/jianyu/web/src/docs/docs/:path', text: '编辑' }, docFooter: { prev: '返回', next: '继续阅读' } }, async transformPageData ({ relativePath }) { const { contributors, changelog } = await getChangelogAndContributors(relativePath) const CustomContributors = contributors.map(contributor => { contributor.avatar = `https://jygit.jydev.jianyu360.cn/avatars/${CustomAvatars[contributor.name]}` return contributor }) return { CommitData: { contributors: CustomContributors, changelog, commitURL: 'https://jygit.jydev.jianyu360.cn/jianyu/web/commit/', title: '更新记录' } } } })