refactor: migrate docs-dev from storybook to vitepress config and update devcontainer configuration
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
import { defineConfig } from 'vitepress'
|
||||
import { withMermaid } from 'vitepress-plugin-mermaid'
|
||||
|
||||
const config = withMermaid(
|
||||
defineConfig({
|
||||
title: "Frontend Monorepo Docs",
|
||||
description: "Centralized documentation for the Enterprise Frontend Monorepo",
|
||||
|
||||
themeConfig: {
|
||||
nav: [
|
||||
{ text: 'Docs', link: '/overview' },
|
||||
],
|
||||
|
||||
sidebar: [
|
||||
{
|
||||
text: 'Introduction',
|
||||
items: [
|
||||
{ text: 'Overview', link: '/overview' },
|
||||
{ text: 'Local Setup', link: '/setup' },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: 'Core Architecture & State',
|
||||
collapsed: false,
|
||||
items: [
|
||||
{ text: 'Core API Engine', link: '/packages/core-api/' },
|
||||
{ text: 'Core Events', link: '/packages/core-events/' },
|
||||
{ text: 'Core Storage', link: '/packages/core-storage/' },
|
||||
{ text: 'Core Internationalization', link: '/packages/core-i18n/' },
|
||||
{ text: 'IPC Architecture', link: '/apps/desktop/IPC_ARCHITECTURE' },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: 'UI System & Layouts',
|
||||
collapsed: false,
|
||||
items: [
|
||||
{ text: 'UI Components Overview', link: '/packages/ui/' },
|
||||
{ text: 'Core App Shell', link: '/packages/ui/CORE-APP-SHELL' },
|
||||
{ text: 'Form Components', link: '/packages/ui/FORM-COMPONENTS' },
|
||||
],
|
||||
},
|
||||
{
|
||||
text: 'Applications & Configuration',
|
||||
collapsed: false,
|
||||
items: [
|
||||
{ text: 'Desktop Application', link: '/apps/desktop/' },
|
||||
{ text: 'Desktop Configuration', link: '/apps/desktop/CONFIGURATION' },
|
||||
{ text: 'Desktop Auto Updater', link: '/apps/desktop/AUTO_UPDATER' },
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
outline: { level: [2, 3] },
|
||||
socialLinks: [],
|
||||
},
|
||||
|
||||
// Mermaid configuration
|
||||
mermaid: {
|
||||
theme: 'default',
|
||||
},
|
||||
|
||||
// Fix cascading CJS/ESM SyntaxErrors caused by Vite dynamically discovering mermaid
|
||||
vite: {
|
||||
optimizeDeps: {
|
||||
include: [
|
||||
'mermaid'
|
||||
]
|
||||
}
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
// Pnpm strict workspace workaround:
|
||||
// vitepress-plugin-mermaid aggressively injects sub-dependencies into optimizeDeps.include.
|
||||
// Because pnpm uses strict symlinks, Vite fails to resolve these sub-dependencies from the project root,
|
||||
// causing pre-bundling to fail and cascading CJS/ESM SyntaxErrors in the browser.
|
||||
// We strip them out so esbuild can naturally inline them into the 'mermaid' chunk instead.
|
||||
if (config.vite?.optimizeDeps?.include) {
|
||||
config.vite.optimizeDeps.include = config.vite.optimizeDeps.include.filter(
|
||||
(dep) => !['@braintree/sanitize-url', 'debug', 'cytoscape-cose-bilkent', 'cytoscape'].includes(dep)
|
||||
);
|
||||
}
|
||||
|
||||
export default config;
|
||||
Reference in New Issue
Block a user