|
| 1 | +// @ts-check |
| 2 | +import { defineConfig } from 'astro/config' |
| 3 | +import starlight from '@astrojs/starlight' |
| 4 | +import starlightImageZoom from 'starlight-image-zoom' |
| 5 | + |
| 6 | +const locales = { |
| 7 | + root: { |
| 8 | + label: 'English', |
| 9 | + lang: 'en', // lang 是 root 语言必须的 |
| 10 | + }, |
| 11 | + 'zh-cn': { |
| 12 | + label: '简体中文', |
| 13 | + lang: 'zh-CN', |
| 14 | + }, |
| 15 | +} |
| 16 | + |
| 17 | +// https://astro.build/config |
| 18 | +export default defineConfig({ |
| 19 | + integrations: [ |
| 20 | + starlight({ |
| 21 | + plugins: [starlightImageZoom()], |
| 22 | + title: 'CafeScraper', |
| 23 | + logo: { |
| 24 | + src: './src/assets/logo.png', |
| 25 | + }, |
| 26 | + defaultLocale: 'root', |
| 27 | + locales, |
| 28 | + components: { |
| 29 | + Header: './src/components/Header.astro', |
| 30 | + MobileMenuFooter: './src/components/MobileMenuFooter.astro', |
| 31 | + TableOfContents: './src/components/TableOfContents.astro', |
| 32 | + }, |
| 33 | + customCss: [ |
| 34 | + './src/styles/common.css', |
| 35 | + '@fontsource-variable/ibm-plex-sans/index.css', |
| 36 | + ], |
| 37 | + favicon: '/favicon.jpg', |
| 38 | + sidebar: [ |
| 39 | + { |
| 40 | + label: 'About CafeScraper', |
| 41 | + slug: 'about-cafe-scraper', |
| 42 | + translations: { |
| 43 | + 'zh-CN': '关于 CafeScraper', |
| 44 | + }, |
| 45 | + }, |
| 46 | + { |
| 47 | + label: 'User Guide', |
| 48 | + collapsed: true, |
| 49 | + translations: { |
| 50 | + 'zh-CN': '用户指南', |
| 51 | + }, |
| 52 | + autogenerate: { directory: 'user-guide' }, |
| 53 | + }, |
| 54 | + { |
| 55 | + label: 'Developer Guide', |
| 56 | + collapsed: true, |
| 57 | + translations: { |
| 58 | + 'zh-CN': '开发者指南', |
| 59 | + }, |
| 60 | + items: [ |
| 61 | + { |
| 62 | + label: 'Web Unlocker', |
| 63 | + translations: { |
| 64 | + 'zh-CN': '网页解锁器', |
| 65 | + }, |
| 66 | + autogenerate: { |
| 67 | + directory: 'developer-guide/web-unlocker', |
| 68 | + }, |
| 69 | + }, |
| 70 | + { |
| 71 | + label: 'Script', |
| 72 | + translations: { |
| 73 | + 'zh-CN': '脚本', |
| 74 | + }, |
| 75 | + autogenerate: { |
| 76 | + directory: 'developer-guide/script', |
| 77 | + }, |
| 78 | + }, |
| 79 | + { |
| 80 | + label: 'Framework', |
| 81 | + translations: { |
| 82 | + 'zh-CN': '数据采集框架', |
| 83 | + }, |
| 84 | + autogenerate: { |
| 85 | + directory: 'developer-guide/framework', |
| 86 | + }, |
| 87 | + }, |
| 88 | + ], |
| 89 | + }, |
| 90 | + { |
| 91 | + label: 'API', |
| 92 | + translations: { |
| 93 | + 'zh-CN': 'API', |
| 94 | + }, |
| 95 | + collapsed: true, |
| 96 | + autogenerate: { |
| 97 | + directory: 'api', |
| 98 | + }, |
| 99 | + }, |
| 100 | + { |
| 101 | + label: 'Partnership & Promotion', |
| 102 | + collapsed: true, |
| 103 | + translations: { |
| 104 | + 'zh-CN': '推广合作', |
| 105 | + }, |
| 106 | + autogenerate: { directory: 'partnership-promotion' }, |
| 107 | + }, |
| 108 | + { |
| 109 | + label: 'Platform Policies', |
| 110 | + collapsed: true, |
| 111 | + translations: { |
| 112 | + 'zh-CN': '平台政策', |
| 113 | + }, |
| 114 | + autogenerate: { |
| 115 | + directory: 'platform-policies', |
| 116 | + }, |
| 117 | + }, |
| 118 | + { |
| 119 | + label: 'FAQ', |
| 120 | + collapsed: true, |
| 121 | + translations: { |
| 122 | + 'zh-CN': '常见问题', |
| 123 | + }, |
| 124 | + items: [ |
| 125 | + { |
| 126 | + label: 'Payment Problem', |
| 127 | + translations: { |
| 128 | + 'zh-CN': '支付问题', |
| 129 | + }, |
| 130 | + autogenerate: { |
| 131 | + directory: 'faq/payment-problem', |
| 132 | + }, |
| 133 | + }, |
| 134 | + ], |
| 135 | + }, |
| 136 | + { |
| 137 | + label: 'Changelog', |
| 138 | + slug: 'changelog', |
| 139 | + translations: { |
| 140 | + 'zh-CN': '更新日志', |
| 141 | + }, |
| 142 | + }, |
| 143 | + ], |
| 144 | + }), |
| 145 | + ], |
| 146 | + |
| 147 | + vite: { |
| 148 | + build: { |
| 149 | + rollupOptions: { |
| 150 | + output: { |
| 151 | + hashCharacters: 'hex', |
| 152 | + entryFileNames: 'js/[hash].js', |
| 153 | + chunkFileNames: 'js/chunks/[hash].js', |
| 154 | + assetFileNames: 'static/css/[hash][extname]', |
| 155 | + }, |
| 156 | + }, |
| 157 | + }, |
| 158 | + }, |
| 159 | + build: { |
| 160 | + assets: 'static', |
| 161 | + }, |
| 162 | +}) |
0 commit comments