config.mts 6.6 KB

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