config.mts 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. import { defineConfig } from 'vitepress'
  2. import { CustomAvatars } from './constant'
  3. import { getChangelogAndContributors } from 'vitepress-plugin-changelog'
  4. export default defineConfig({
  5. base: '/efe-docs/',
  6. outDir: './efe-docs',
  7. title: '文档',
  8. description: "剑鱼前端团队内部文档 - 探索前端世界,从文档开始",
  9. lang: 'zh-CN',
  10. themeConfig: {
  11. siteTitle: ' ',
  12. logo: {
  13. light: 'https://cdn-ali.jianyu360.com/images/index/logo_main.png',
  14. dark: 'https://cdn-ali.jianyu360.com/images/index/logo_white.png'
  15. },
  16. nav: [
  17. { text: '指南', link: '/guide/getting-started' },
  18. { text: '组件', link: '/component/' },
  19. {
  20. text: '知识库',
  21. items: [
  22. { text: 'monorepo', link: '/monorepo/introduce' },
  23. { text: '常见问题自检清单', link: '/check/' },
  24. { text: '通用埋点相关', link: '/track/index-new' },
  25. { text: 'go模板相关', link: '/go/go安装应用' }
  26. ]
  27. },
  28. {
  29. text: 'packages',
  30. items: [
  31. { text: '@jy/emiiter', link: '/core-emitter/introduce' },
  32. { text: '@jy/plugin-login-auth', link: '/plugin-login-auth/introduce' },
  33. { text: '@jianyu/cli', link: '/cli/' },
  34. ]
  35. },
  36. { text: '资源', link: '/resource' },
  37. { text: '参与建设', link: '/to-do/' }
  38. ],
  39. sidebar: {
  40. '/guide/': {
  41. base: '/guide/',
  42. items: [
  43. {
  44. text: '开发指南',
  45. base: '/guide/',
  46. items: [
  47. { text: '项目简介', link: 'introduce' },
  48. { text: '环境配置', link: 'development' },
  49. { text: '快速上手', link: 'getting-started' },
  50. ]
  51. },
  52. {
  53. text: '代码风格',
  54. base: '/guide/style/',
  55. items: [
  56. { text: '前言', link: 'introduce' },
  57. { text: '文件命名规则', link: 'naming' },
  58. { text: '通用规则', link: 'base' },
  59. { text: 'HTML', link: 'html' },
  60. { text: 'CSS', link: 'css' },
  61. { text: 'JS', link: 'js' },
  62. { text: 'Vue', link: 'vue' },
  63. ]
  64. },
  65. ]
  66. },
  67. '/go/': {
  68. base: '/go/',
  69. items: [
  70. {
  71. text: 'go模板相关指南',
  72. base: '/go/',
  73. items: [
  74. { text: '安装应用', link: 'go安装应用' },
  75. { text: '常用语法', link: 'go模板常用语法' },
  76. ]
  77. }
  78. ]
  79. }
  80. },
  81. outline: {
  82. label: '目录'
  83. },
  84. search: {
  85. provider: 'local'
  86. },
  87. lastUpdated: {
  88. text: '上次更新',
  89. formatOptions: {
  90. dateStyle: 'full',
  91. timeStyle: 'medium'
  92. }
  93. },
  94. editLink: {
  95. pattern: 'https://jygit.jydev.jianyu360.cn/jianyu/web/src/docs/docs/:path',
  96. text: '编辑'
  97. },
  98. docFooter: {
  99. prev: '返回',
  100. next: '继续阅读'
  101. }
  102. },
  103. async transformPageData ({ relativePath }) {
  104. const { contributors, changelog } = await getChangelogAndContributors(relativePath)
  105. const CustomContributors = contributors.map(contributor => {
  106. contributor.avatar = `https://jygit.jydev.jianyu360.cn/avatars/${CustomAvatars[contributor.name]}`
  107. return contributor
  108. })
  109. return {
  110. CommitData: {
  111. contributors: CustomContributors,
  112. changelog,
  113. commitURL: 'https://jygit.jydev.jianyu360.cn/jianyu/web/commit/',
  114. title: '更新记录'
  115. }
  116. }
  117. }
  118. })