mirror of
https://github.com/XTLS/Xray-docs-next.git
synced 2025-01-20 01:31:40 +03:00
66 lines
1.9 KiB
TypeScript
66 lines
1.9 KiB
TypeScript
import { viteBundler } from "@vuepress/bundler-vite";
|
|
import { webpackBundler } from "@vuepress/bundler-webpack";
|
|
// import { UserConfig, defineUserConfig } from "@vuepress/cli";
|
|
import { UserConfig, defineUserConfig } from "vuepress/cli";
|
|
import { searchPlugin } from "@vuepress/plugin-search";
|
|
import markdownItFootnote from "markdown-it-footnote";
|
|
import theme from './theme.js'
|
|
import { registerComponentsPlugin } from '@vuepress/plugin-register-components'
|
|
import process from 'node:process'
|
|
// import { getDirname, path } from '@vuepress/utils'
|
|
import { getDirname, path } from 'vuepress/utils'
|
|
import { MermaidPlugin } from './plugins/mermaid/node/mermaid'
|
|
|
|
const __dirname = getDirname(import.meta.url)
|
|
console.log('>>> __dirname -> ', __dirname)
|
|
const isProduction = process.env.NODE_ENV === "production";
|
|
const forMainRepo = process.env.XRAY_DOCS_MAIN_REPO === "true";
|
|
const useVite = process.env.XRAY_DOCS_USE_VITE === "true";
|
|
|
|
console.log("base:", forMainRepo ? "/" : "/Xray-docs-next/");
|
|
console.log(
|
|
"bundler:",
|
|
isProduction && !useVite ? "@vuepress/webpack" : "@vuepress/vite"
|
|
);
|
|
|
|
export default defineUserConfig(<UserConfig>{
|
|
plugins: [
|
|
searchPlugin({
|
|
locales: {
|
|
"/": {
|
|
placeholder: "搜索",
|
|
},
|
|
},
|
|
}),
|
|
registerComponentsPlugin({
|
|
componentsDir: path.resolve(__dirname, './theme/components'),
|
|
}),
|
|
],
|
|
base: forMainRepo ? "/" : "/Xray-docs-next/",
|
|
locales: {
|
|
"/": {
|
|
lang: "zh-CN",
|
|
title: "Project X",
|
|
description: "Xray 官方文档",
|
|
},
|
|
"/en/": {
|
|
lang: "en-US",
|
|
title: "Project X",
|
|
description: "Official document of Xray",
|
|
},
|
|
},
|
|
theme,
|
|
head: [["link", { rel: "icon", href: `/logo.png` }]],
|
|
markdown: {
|
|
toc: {
|
|
level: [2],
|
|
},
|
|
},
|
|
extendsMarkdown: (md) => {
|
|
md.use(markdownItFootnote);
|
|
md.use(MermaidPlugin);
|
|
},
|
|
bundler:
|
|
process.env.DOCS_BUNDLER === "webpack" ? webpackBundler() : viteBundler(),
|
|
});
|