config.mts 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. import { defineConfig } from 'vitepress'
  2. import { CustomAvatars } from './constant'
  3. // @ts-ignore
  4. import { getChangelogAndContributors } from 'vitepress-plugin-changelog'
  5. export default defineConfig({
  6. base: '/efe-docs/',
  7. outDir: './efe-docs',
  8. title: '文档',
  9. description: "剑鱼前端团队内部文档 - 探索前端世界,从文档开始",
  10. lang: 'zh-CN',
  11. srcExclude: [
  12. 'dist/**',
  13. 'node_modules/**',
  14. 'plugins/**',
  15. 'scripts/**',
  16. ],
  17. // sitemap: {
  18. // hostname: './'
  19. // },
  20. rewrites: {
  21. 'apps/(.*)/README.md': 'apps/(.*)/index.md',
  22. 'core/(.*)/README.md': 'core/(.*)/index.md',
  23. 'packages/(.*)/README.md': 'packages/(.*)/index.md',
  24. 'data/(.*)/README.md': 'data/(.*)/index.md',
  25. 'docs/:name.md': ':name.md',
  26. 'docs/:group/:name.md': ':group/:name.md',
  27. 'docs/:group/:group2/:name.md': ':group/:group2/:name.md',
  28. },
  29. themeConfig: {
  30. siteTitle: ' ',
  31. logo: {
  32. light: 'https://cdn-ali.jianyu360.com/images/index/logo_main.png',
  33. dark: 'https://cdn-ali.jianyu360.com/images/index/logo_white.png'
  34. },
  35. nav: [
  36. { text: '指南', link: '/guide/getting-started' },
  37. {
  38. text: '项目文档',
  39. items: [
  40. { text: 'bigmember_pc', link: '/apps/bigmember_pc/' },
  41. { text: '🚧 jy-pc', link: '/apps/jy-pc/' },
  42. { text: 'mobile', link: '/apps/mobile/' },
  43. { text: 'work-bench', link: '/apps/work-bench/' },
  44. ]
  45. },
  46. {
  47. text: 'data',
  48. items: [
  49. { text: '🚧 @jy/api', link: '/data/api/' },
  50. { text: '@jy/data-models', link: '/data/data-models/' }
  51. ]
  52. },
  53. {
  54. text: 'packages',
  55. items: [
  56. { text: '@jy/emiiter', link: '/core/emitter/' },
  57. { text: '@jy/plugin-login-auth', link: '/plugin-login-auth/introduce' },
  58. { text: '@jy/vue-anti', link: '/packages/vue-anti/' },
  59. { text: '@jy/work-bench-frame', link: '/packages/work-bench-frame/' },
  60. { text: '@jianyu/cli', link: '/cli/' },
  61. ]
  62. },
  63. {
  64. text: '知识库',
  65. items: [
  66. { text: 'monorepo', link: '/monorepo/introduce' },
  67. { text: '常见问题自检清单', link: '/check/' },
  68. { text: '通用埋点相关', link: '/track/index-new' },
  69. { text: 'go模板相关', link: '/go/go安装应用' }
  70. ]
  71. },
  72. { text: '资源', link: '/resource' },
  73. { text: '参与建设', link: '/to-do/' }
  74. ],
  75. sidebar: {
  76. '/guide/': {
  77. base: '/guide/',
  78. items: [
  79. {
  80. text: '开发指南',
  81. base: '/guide/',
  82. items: [
  83. { text: '项目简介', link: 'introduce' },
  84. { text: '环境配置', link: 'development' },
  85. { text: '快速上手', link: 'getting-started' },
  86. ]
  87. },
  88. {
  89. text: '代码风格',
  90. base: '/guide/style/',
  91. items: [
  92. { text: '前言', link: 'introduce' },
  93. { text: '文件命名规则', link: 'naming' },
  94. { text: '通用规则', link: 'base' },
  95. { text: 'HTML', link: 'html' },
  96. { text: 'CSS', link: 'css' },
  97. { text: 'JS', link: 'js' },
  98. { text: 'Vue', link: 'vue' },
  99. ]
  100. },
  101. ]
  102. },
  103. '/go/': {
  104. base: '/go/',
  105. items: [
  106. {
  107. text: 'go模板相关指南',
  108. base: '/go/',
  109. items: [
  110. { text: '安装应用', link: 'go安装应用' },
  111. { text: '常用语法', link: 'go模板常用语法' },
  112. ]
  113. }
  114. ]
  115. },
  116. '/data/data-models/': {
  117. base: '/data/data-models/',
  118. items: [
  119. {
  120. text: '业务模型',
  121. base: '/data/data-models/modules/',
  122. items: [
  123. { text: 'article 详情页', link: '/article/' },
  124. { text: 'quick-monitor<br>项目、企业、业主监控', link: '/quick-monitor/' },
  125. ]
  126. }
  127. ]
  128. },
  129. '/apps/bigmember_pc/': {
  130. base: '/apps/bigmember_pc/',
  131. items: [
  132. {
  133. text: '业务维护文档',
  134. base: '/apps/bigmember_pc/src/',
  135. items: [
  136. {
  137. text: 'article-content<br>详情页',
  138. link: '/views/article-content/composables/'
  139. }
  140. ]
  141. },
  142. {
  143. text: 'composables',
  144. base: '/apps/bigmember_pc/src/composables/',
  145. items: [
  146. { text: 'down-project-report<br>下载项目报告', link: '/down-project-report/' },
  147. { text: 'quick-join-bid<br>参标,取消参标相关', link: '/quick-join-bid/' },
  148. { text: 'quick-monitor<br>项目、企业、业主监控', link: '/quick-monitor/' }
  149. ]
  150. }
  151. ]
  152. },
  153. '/apps/mobile/': {
  154. base: '/apps/mobile/',
  155. items: [
  156. {
  157. text: 'composables',
  158. base: '/apps/mobile/src/composables/',
  159. items: [
  160. { text: 'quick-monitor<br>项目、企业、业主监控', link: '/quick-monitor/' }
  161. ]
  162. }
  163. ]
  164. }
  165. },
  166. outline: {
  167. label: '目录'
  168. },
  169. search: {
  170. provider: 'local'
  171. },
  172. lastUpdated: {
  173. text: '上次更新',
  174. formatOptions: {
  175. dateStyle: 'full',
  176. timeStyle: 'medium'
  177. }
  178. },
  179. editLink: {
  180. pattern: 'https://jygit.jydev.jianyu360.cn/jianyu/web/src/docs/docs/:path',
  181. text: '编辑'
  182. },
  183. docFooter: {
  184. prev: '返回',
  185. next: '继续阅读'
  186. }
  187. },
  188. async transformPageData ({ relativePath }) {
  189. const { contributors, changelog } = await getChangelogAndContributors(relativePath)
  190. const CustomContributors = contributors.map(contributor => {
  191. contributor.avatar = `https://jygit.jydev.jianyu360.cn/avatars/${CustomAvatars[contributor.name]}`
  192. return contributor
  193. })
  194. return {
  195. CommitData: {
  196. contributors: CustomContributors,
  197. changelog,
  198. commitURL: 'https://jygit.jydev.jianyu360.cn/jianyu/web/commit/',
  199. title: '更新记录'
  200. }
  201. }
  202. },
  203. // vite: {
  204. // build: {
  205. // rollupOptions: {
  206. // external: ["vue/server-renderer", "vue"]
  207. // }
  208. // }
  209. // }
  210. })