microsoft/hve-core
Publicmirrored fromhttps://github.com/microsoft/hve-coreAvailable
docs/docusaurus/docusaurus.config.js
198lines · modecode
| 1 | // @ts-check |
| 2 | import { themes as prismThemes } from 'prism-react-renderer'; |
| 3 | import remarkGithubAlert from 'remark-github-blockquote-alert'; |
| 4 | import * as fs from 'fs'; |
| 5 | import * as path from 'path'; |
| 6 | |
| 7 | const collectionsDir = path.resolve(__dirname, '../../collections'); |
| 8 | |
| 9 | /** |
| 10 | * @param {string} name |
| 11 | */ |
| 12 | function countYamlPaths(name) { |
| 13 | const yamlPath = path.join(collectionsDir, `${name}.collection.yml`); |
| 14 | let content; |
| 15 | try { |
| 16 | content = fs.readFileSync(yamlPath, 'utf-8'); |
| 17 | } catch { |
| 18 | throw new Error( |
| 19 | `[docusaurus.config.js] Cannot read collection manifest: ${yamlPath}\n` + |
| 20 | `Ensure "${name}" exists in the collections/ directory.`, |
| 21 | ); |
| 22 | } |
| 23 | return (content.match(/^\s*- path:/gm) || []).length; |
| 24 | } |
| 25 | |
| 26 | const collectionNames = [ |
| 27 | 'ado', 'coding-standards', 'data-science', 'design-thinking', |
| 28 | 'experimental', 'github', 'gitlab', 'hve-core', 'jira', |
| 29 | 'project-planning', 'security', 'hve-core-all', |
| 30 | ]; |
| 31 | const collectionCounts = Object.fromEntries( |
| 32 | collectionNames.map((n) => [n, countYamlPaths(n)]), |
| 33 | ); |
| 34 | |
| 35 | /** @type {import('@docusaurus/types').Config} */ |
| 36 | const config = { |
| 37 | title: 'HVE Core', |
| 38 | tagline: 'AI-Driven Software Development Across the Full Lifecycle', |
| 39 | favicon: 'img/microsoft-logo.svg', |
| 40 | |
| 41 | future: { |
| 42 | v4: true, |
| 43 | }, |
| 44 | |
| 45 | url: 'https://microsoft.github.io', |
| 46 | baseUrl: '/hve-core/', |
| 47 | |
| 48 | organizationName: 'microsoft', |
| 49 | projectName: 'hve-core', |
| 50 | |
| 51 | onBrokenLinks: 'throw', |
| 52 | |
| 53 | customFields: { |
| 54 | collectionCounts, |
| 55 | }, |
| 56 | |
| 57 | markdown: { |
| 58 | format: 'detect', |
| 59 | hooks: { |
| 60 | onBrokenMarkdownLinks: 'throw', |
| 61 | }, |
| 62 | }, |
| 63 | |
| 64 | i18n: { |
| 65 | defaultLocale: 'en', |
| 66 | locales: ['en'], |
| 67 | }, |
| 68 | |
| 69 | presets: [ |
| 70 | [ |
| 71 | 'classic', |
| 72 | /** @type {import('@docusaurus/preset-classic').Options} */ |
| 73 | ({ |
| 74 | docs: { |
| 75 | path: '../', |
| 76 | exclude: [ |
| 77 | 'docusaurus/**', |
| 78 | 'announcements/**', |
| 79 | '**/_*.{js,jsx,ts,tsx,md,mdx}', |
| 80 | '**/_*/**', |
| 81 | '**/*.test.{js,jsx,ts,tsx}', |
| 82 | '**/__tests__/**', |
| 83 | ], |
| 84 | sidebarPath: './sidebars.js', |
| 85 | showLastUpdateTime: true, |
| 86 | showLastUpdateAuthor: true, |
| 87 | editUrl: ({ docPath }) => |
| 88 | `https://github.com/microsoft/hve-core/tree/main/docs/${docPath}`, |
| 89 | remarkPlugins: [remarkGithubAlert], |
| 90 | }, |
| 91 | blog: false, |
| 92 | theme: { |
| 93 | customCss: './src/css/custom.css', |
| 94 | }, |
| 95 | }), |
| 96 | ], |
| 97 | ], |
| 98 | |
| 99 | themes: [ |
| 100 | [ |
| 101 | '@easyops-cn/docusaurus-search-local', |
| 102 | /** @type {import("@easyops-cn/docusaurus-search-local").PluginOptions} */ |
| 103 | ({ |
| 104 | hashed: true, |
| 105 | language: ['en'], |
| 106 | highlightSearchTermsOnTargetPage: true, |
| 107 | explicitSearchResultPath: true, |
| 108 | }), |
| 109 | ], |
| 110 | ], |
| 111 | |
| 112 | themeConfig: |
| 113 | /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ |
| 114 | ({ |
| 115 | image: 'img/microsoft-logo.svg', |
| 116 | colorMode: { |
| 117 | respectPrefersColorScheme: true, |
| 118 | }, |
| 119 | docs: { |
| 120 | sidebar: { |
| 121 | hideable: true, |
| 122 | autoCollapseCategories: true, |
| 123 | }, |
| 124 | }, |
| 125 | navbar: { |
| 126 | title: 'HVE Core', |
| 127 | logo: { |
| 128 | alt: 'Microsoft', |
| 129 | src: 'img/microsoft-logo.svg', |
| 130 | width: 26, |
| 131 | height: 26, |
| 132 | }, |
| 133 | items: [ |
| 134 | { |
| 135 | type: 'docSidebar', |
| 136 | sidebarId: 'docsSidebar', |
| 137 | position: 'left', |
| 138 | label: 'Documentation', |
| 139 | }, |
| 140 | { |
| 141 | type: 'dropdown', |
| 142 | label: 'Topics', |
| 143 | position: 'left', |
| 144 | items: [ |
| 145 | { label: 'Get Started', to: '/docs/getting-started/' }, |
| 146 | { label: 'Workflows', to: '/docs/rpi/' }, |
| 147 | { label: 'Customize', to: '/docs/customization/' }, |
| 148 | { label: 'Reference', to: '/docs/architecture/' }, |
| 149 | ], |
| 150 | }, |
| 151 | { |
| 152 | href: 'https://github.com/microsoft/hve-core', |
| 153 | label: 'GitHub', |
| 154 | position: 'right', |
| 155 | }, |
| 156 | ], |
| 157 | }, |
| 158 | footer: { |
| 159 | style: 'dark', |
| 160 | links: [ |
| 161 | { |
| 162 | title: 'Documentation', |
| 163 | items: [ |
| 164 | { label: 'Getting Started', to: '/docs/getting-started/' }, |
| 165 | { label: 'HVE Guide', to: '/docs/hve-guide/' }, |
| 166 | { label: 'RPI Workflow', to: '/docs/rpi/' }, |
| 167 | { label: 'Agents', to: '/docs/agents/' }, |
| 168 | { label: 'Architecture', to: '/docs/architecture/' }, |
| 169 | ], |
| 170 | }, |
| 171 | { |
| 172 | title: 'Resources', |
| 173 | items: [ |
| 174 | { label: 'Contributing', to: '/docs/contributing/' }, |
| 175 | { label: 'Security', to: '/docs/security/' }, |
| 176 | { label: 'Templates', to: '/docs/templates/' }, |
| 177 | ], |
| 178 | }, |
| 179 | { |
| 180 | title: 'Community', |
| 181 | items: [ |
| 182 | { |
| 183 | label: 'GitHub', |
| 184 | href: 'https://github.com/microsoft/hve-core', |
| 185 | }, |
| 186 | ], |
| 187 | }, |
| 188 | ], |
| 189 | copyright: `© Microsoft ${new Date().getFullYear()}. Built with HVE.`, |
| 190 | }, |
| 191 | prism: { |
| 192 | theme: prismThemes.github, |
| 193 | darkTheme: prismThemes.dracula, |
| 194 | }, |
| 195 | }), |
| 196 | }; |
| 197 | |
| 198 | export default config; |
| 199 | |