config.mts 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. import consola from 'consola'
  2. import { REPO_BRANCH, REPO_PATH } from '@kankan-components/build-constants'
  3. import { docsDirName } from '@kankan-components/build-utils'
  4. // import { languages } from './utils/lang'
  5. import { features, head, mdPlugin, nav, sidebars } from './config'
  6. import type { UserConfig } from 'vitepress'
  7. const buildTransformers = () => {
  8. const transformer = () => {
  9. return {
  10. props: [],
  11. needRuntime: true,
  12. }
  13. }
  14. const transformers = {}
  15. const directives = [
  16. 'infinite-scroll',
  17. 'loading',
  18. 'popover',
  19. 'click-outside',
  20. 'repeat-click',
  21. 'trap-focus',
  22. 'mousewheel',
  23. 'resize',
  24. ]
  25. directives.forEach((k) => {
  26. transformers[k] = transformer
  27. })
  28. return transformers
  29. }
  30. consola.debug(`DOC_ENV: ${process.env.DOC_ENV}`)
  31. const languages = ['zh-CN']
  32. const locales = {
  33. // '/en-US': { label: 'en-US', lang: 'en-US' },
  34. '/zh-CN': { label: 'zh-CN', lang: 'zh-CN' },
  35. }
  36. // languages.forEach(lang => {
  37. // locales[`/${lang}`] = {
  38. // label: lang,
  39. // lang,
  40. // }
  41. // })
  42. // consola.log('locales', locales)
  43. // consola.log('sidebars', sidebars)
  44. export const config: UserConfig = {
  45. title: '看看公共组件',
  46. description: '看看组件公共文档中心',
  47. lastUpdated: true,
  48. // base: "/kk-docs/",
  49. head,
  50. themeConfig: {
  51. repo: 'http://192.168.0.115:3000/4dkankan/4dkankan-components',
  52. docsBranch: REPO_BRANCH,
  53. docsDir: docsDirName,
  54. editLinks: true,
  55. editLinkText: 'Edit this page on GitHub',
  56. lastUpdated: 'Last Updated',
  57. logo: '/images/logo.png',
  58. logoSmall: '/images/kankan_icon.ico',
  59. sidebars,
  60. nav,
  61. // agolia: {
  62. // apiKey: '377f2b647a96d9b1d62e4780f2344da2',
  63. // appId: 'BH4D9OD16A',
  64. // },
  65. features,
  66. langs: languages,
  67. },
  68. locales,
  69. markdown: {
  70. config: (md) => mdPlugin(md),
  71. },
  72. vue: {
  73. template: {
  74. ssr: true,
  75. compilerOptions: {
  76. directiveTransforms: buildTransformers(),
  77. },
  78. },
  79. },
  80. }
  81. export default config