shard.mts 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. import type { PwaOptions } from '@vite-pwa/vitepress';
  2. import { resolve } from 'node:path';
  3. import {
  4. GitChangelog,
  5. GitChangelogMarkdownSection,
  6. } from '@nolebase/vitepress-plugin-git-changelog/vite';
  7. import { defineConfig, type HeadConfig } from 'vitepress';
  8. import { search as zhSearch } from './zh.mts';
  9. export const shard = defineConfig({
  10. head: head(),
  11. pwa: pwa(),
  12. srcDir: 'src',
  13. themeConfig: {
  14. i18nRouting: true,
  15. logo: 'https://unpkg.com/@vbenjs/static-source@0.1.6/source/logo-v1.webp',
  16. search: {
  17. options: {
  18. locales: {
  19. ...zhSearch,
  20. },
  21. },
  22. provider: 'local',
  23. },
  24. siteTitle: 'Vben Admin',
  25. socialLinks: [
  26. { icon: 'github', link: 'https://github.com/vbenjs/vue-vben-admin' },
  27. ],
  28. },
  29. title: 'Vben Admin',
  30. vite: {
  31. build: {
  32. chunkSizeWarningLimit: Infinity,
  33. minify: 'terser',
  34. },
  35. json: {
  36. stringify: true,
  37. },
  38. plugins: [
  39. GitChangelog({
  40. repoURL: () => 'https://github.com/vbenjs/vue-vben-admin',
  41. }),
  42. GitChangelogMarkdownSection(),
  43. ],
  44. server: {
  45. fs: {
  46. allow: ['../..'],
  47. },
  48. host: true,
  49. port: 6173,
  50. },
  51. ssr: {
  52. external: ['@vue/repl'],
  53. },
  54. },
  55. });
  56. function head(): HeadConfig[] {
  57. return [
  58. ['meta', { content: 'Vbenjs Team', name: 'author' }],
  59. [
  60. 'meta',
  61. {
  62. content: 'vben, vitejs, vite, shacdn-ui, vue',
  63. name: 'keywords',
  64. },
  65. ],
  66. ['link', { href: '/favicon.ico', rel: 'icon', type: 'image/svg+xml' }],
  67. [
  68. 'meta',
  69. {
  70. content:
  71. 'width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no',
  72. name: 'viewport',
  73. },
  74. ],
  75. ['meta', { content: 'vben admin docs', name: 'keywords' }],
  76. ['link', { href: '/favicon.ico', rel: 'icon' }],
  77. // [
  78. // 'script',
  79. // {
  80. // src: 'https://cdn.tailwindcss.com',
  81. // },
  82. // ],
  83. ];
  84. }
  85. function pwa(): PwaOptions {
  86. return {
  87. includeManifestIcons: false,
  88. manifest: {
  89. description:
  90. 'Vben Admin is a modern admin dashboard template based on Vue 3. ',
  91. icons: [
  92. {
  93. sizes: '192x192',
  94. src: 'https://unpkg.com/@vbenjs/static-source@0.1.6/source/pwa-icon-192.png',
  95. type: 'image/png',
  96. },
  97. {
  98. sizes: '512x512',
  99. src: 'https://unpkg.com/@vbenjs/static-source@0.1.6/source/pwa-icon-512.png',
  100. type: 'image/png',
  101. },
  102. ],
  103. id: '/',
  104. name: 'Vben Admin Doc',
  105. short_name: 'vben_admin_doc',
  106. theme_color: '#ffffff',
  107. },
  108. outDir: resolve(process.cwd(), '.vitepress/dist'),
  109. registerType: 'autoUpdate',
  110. workbox: {
  111. globPatterns: ['**/*.{css,js,html,svg,png,ico,txt,woff2}'],
  112. },
  113. };
  114. }