config.mts 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 = ['infinite-scroll', 'loading', 'popover', 'click-outside', 'repeat-click', 'trap-focus', 'mousewheel', 'resize']
  16. directives.forEach(k => {
  17. transformers[k] = transformer
  18. })
  19. return transformers
  20. }
  21. consola.debug(`DOC_ENV: ${process.env.DOC_ENV}`)
  22. const languages = ['zh-CN']
  23. const locales = {
  24. // '/en-US': { label: 'en-US', lang: 'en-US' },
  25. '/zh-CN': { label: 'zh-CN', lang: 'zh-CN' },
  26. }
  27. // languages.forEach(lang => {
  28. // locales[`/${lang}`] = {
  29. // label: lang,
  30. // lang,
  31. // }
  32. // })
  33. // consola.log('locales', locales)
  34. // consola.log('sidebars', sidebars)
  35. export const config: UserConfig = {
  36. title: '看看公共组件',
  37. description: '看看组件公共文档中心',
  38. lastUpdated: true,
  39. head,
  40. themeConfig: {
  41. repo: 'http://192.168.0.115:3000/4dkankan/4dkankan-components',
  42. docsBranch: REPO_BRANCH,
  43. docsDir: docsDirName,
  44. editLinks: true,
  45. editLinkText: 'Edit this page on GitHub',
  46. lastUpdated: 'Last Updated',
  47. logo: '/images/logo.png',
  48. logoSmall: '/images/kankan_icon.ico',
  49. sidebars,
  50. nav,
  51. agolia: {
  52. apiKey: '377f2b647a96d9b1d62e4780f2344da2',
  53. appId: 'BH4D9OD16A',
  54. },
  55. features,
  56. langs: languages,
  57. },
  58. locales,
  59. markdown: {
  60. config: md => mdPlugin(md),
  61. },
  62. vue: {
  63. template: {
  64. ssr: true,
  65. compilerOptions: {
  66. directiveTransforms: buildTransformers(),
  67. },
  68. },
  69. },
  70. }
  71. export default config