VitePress migration complete, backup removed

This commit is contained in:
Meow
2026-01-23 21:52:44 +08:00
parent 9f03ee4dff
commit 7a43a57e8e
22 changed files with 0 additions and 19421 deletions
-19
View File
@@ -1,19 +0,0 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "monthly"
ignore:
- dependency-name: "vue" #https://github.com/XTLS/Xray-docs-next/pull/465
- dependency-name: "*"
update-types: ["version-update:semver-patch"]
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
-48
View File
@@ -1,48 +0,0 @@
name: Deploy Vuepress
on:
push:
branches:
- main
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version: "18"
- name: Install yarn and pnpm
run: |
npm install yarn@1.22.19 -g
npm install -g pnpm
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v5
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install
run: pnpm install
- name: Build for Main Repository
env:
NODE_OPTIONS: "--max_old_space_size=4096 --openssl-legacy-provider"
run: |
yarn docs:build
- name: Deploy to main Repository
if: github.event_name != 'pull_request'
uses: peaceiris/actions-gh-pages@v4
with:
personal_token: ${{ secrets.ACTION_PERSONAL_TOKEN }}
publish_dir: docs/.vuepress/dist
external_repository: XTLS/XTLS.github.io
publish_branch: gh-pages-next
-34
View File
@@ -1,34 +0,0 @@
name: Prettier Action
on:
pull_request:
branches: [main]
permissions:
contents: write
jobs:
prettier:
runs-on: ubuntu-latest
steps:
- name: Checkout
if: github.event.pull_request.head.repo.full_name == 'XTLS/Xray-docs-next'
uses: actions/checkout@v6
with:
ref: ${{ github.head_ref }}
- name: Checkout
if: github.event.pull_request.head.repo.full_name != 'XTLS/Xray-docs-next'
uses: actions/checkout@v6
with:
fetch-depth: 2
- name: Prettify code
if: github.event.pull_request.head.repo.full_name == 'XTLS/Xray-docs-next'
uses: creyD/prettier_action@v4.6
with:
prettier_options: --write **/*.{js,ts,md,vue}
- name: Prettify code dry run
if: github.event.pull_request.head.repo.full_name != 'XTLS/Xray-docs-next'
uses: creyD/prettier_action@v4.6
with:
prettier_options: --write **/*.{js,ts,md,vue}
only_changed: true
dry: true
-5
View File
@@ -1,5 +0,0 @@
node_modules/
.vuepress/dist
.cache/
.temp/
dist/
-10
View File
@@ -1,10 +0,0 @@
{
overrides: [
{
files: ['**/*.jsonc', '**/*.md'],
options: {
trailingComma: 'none',
}
}
]
}
-84
View File
@@ -1,84 +0,0 @@
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";
import i18nPlugin from "vuepress-plugin-i18n";
const __dirname = getDirname(import.meta.url);
console.log(">>> __dirname -> ", __dirname);
const isProduction = process.env.NODE_ENV === "production";
const useVite = process.env.XRAY_DOCS_USE_VITE === "true";
console.log(
"bundler:",
isProduction && !useVite ? "@vuepress/webpack" : "@vuepress/vite",
);
export default defineUserConfig(<UserConfig>{
plugins: [
i18nPlugin({
updatedTime: "git",
translationGuide: "https://github.com/XTLS/Xray-docs-next",
locales: {
en: {
lang: "en-US",
untranslated: {
title: "Untranslated",
},
outdated: {
title: "Outdated",
},
},
},
}),
searchPlugin({
locales: {
"/": {
placeholder: "搜索",
},
},
}),
registerComponentsPlugin({
componentsDir: path.resolve(__dirname, "./theme/components"),
}),
],
base: "/",
locales: {
"/": {
lang: "zh-CN",
title: "Project X",
description: "Xray 官方文档",
},
"/en/": {
lang: "en-US",
title: "Project X",
description: "Official document of Xray",
},
"/ru/": {
lang: "ru-RU",
title: "Project X",
description: "Официальная документация 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(),
});
-3
View File
@@ -1,3 +0,0 @@
// export * from './head'
export * from "./navbar/index.js";
export * from "./sidebar/index.js";
@@ -1,9 +0,0 @@
// FIXME: Should correct handle dark selector
export const getDarkmodeStatus = (): boolean => {
const html = document.documentElement;
return (
html.classList.contains("dark") ||
html.getAttribute("data-theme") === "dark"
);
};
@@ -1,68 +0,0 @@
import type { PluginSimple } from "markdown-it";
import type Renderer from "markdown-it/lib/renderer.js";
const mermaidRenderer: Renderer.RenderRule = (tokens: any, index: any) =>
`<Mermaid id="mermaid-${index}" code="${encodeURI(
tokens[index].content,
)}"></Mermaid>`;
interface MermaidOptions {
content: string;
diagram?: string;
title?: string;
}
export const getMermaidContent = ({
diagram = "mermaid",
content,
title = "",
}: MermaidOptions): string => `\
${
title
? `\
---
title: ${title}
---
`
: ""
}\
${
diagram === "mermaid"
? ""
: `\
${diagram}
`
}\
${
diagram === "mermaid" || diagram === "sankey-beta"
? content
: content
.split("\n")
.map((line) => (line ? ` ${line}` : ""))
.join("\n")
}\
`;
const getMermaid = (options: MermaidOptions, index: number): string =>
`<Mermaid id="mermaid-${index}" code="${encodeURI(getMermaidContent(options))}"${options.title ? ` title="${encodeURI(options.title)}"` : ""}></Mermaid>`;
export const MermaidPlugin: PluginSimple = (md) => {
// Handle ```mermaid blocks
const fence = md.renderer.rules.fence;
md.renderer.rules.fence = (...args): string => {
const [tokens, index] = args;
const { content, info } = tokens[index];
const fenceInfo = info.trim();
if (fenceInfo === "mermaid") return getMermaid({ content }, index);
const [name, ...rest] = fenceInfo.split(" ");
return fence!(...args);
};
md.renderer.rules["mermaid"] = mermaidRenderer;
};
-70
View File
@@ -1,70 +0,0 @@
:root {
--c-brand: #407ce8;
--c-brand-light: #2e73ea;
--c-text-accent: #2e73ea;
--c-brand-lighter: rgba(46, 115, 234, 0.75);
--c-bg-light: rgba(95, 101, 106, 0.1);
--c-badge-tip: #44c98d;
--c-warning-text-accent: var(--c-text-accent);
--c-danger-text-accent: var(--c-text-accent);
--x-nav-text-hover: #0a51bd;
}
html.dark {
--c-bg: #262a31;
--c-bg-light: #31353e;
--c-bg-lighter: #3a4049;
--c-brand: #407ce8;
--c-brand-light: #2e73ea;
--c-brand-lighter: rgba(46, 115, 234, 0.8);
--c-warning-bg: rgba(185, 174, 119, 0.3);
--c-warning-text: #c0bebe;
--c-warning-text-accent: var(--c-text-accent);
--c-danger-title: #b40505;
--c-danger-bg: rgba(72, 56, 57, 0.4);
--c-danger-text: #c0bebe;
--c-danger-text-accent: var(--c-text-accent);
--c-bg-light: rgba(255, 255, 255, 0.1);
--x-nav-text-hover: #7ca6f2;
.badge.tip > a {
color: #305bac;
& > span > svg.icon.outbound {
color: #7d57b0;
}
}
}
.badge.tip > a {
color: #3c71c0;
& > span > svg.icon.outbound {
color: #ad74e1;
}
}
blockquote {
color: var(--c-text);
background-color: var(--c-bg-lighter);
border-left: 4px solid #17a2b8;
}
* {
scroll-behavior: smooth;
transition: background-color 0.1s ease;
@media screen and (prefers-reduced-motion: reduce) {
scroll-behavior: auto;
}
}
.meta-item.edit-link > a.meta-item-label {
color: var(--c-text-accent);
}
.sidebar {
scrollbar-color: var(--c-brand-lighter) var(--c-border);
}
-98
View File
@@ -1,98 +0,0 @@
import { defaultTheme } from "@vuepress/theme-default";
// import { path, getDirname } from '@vuepress/utils'
import { path, getDirname } from "vuepress/utils";
import process from "node:process";
import {
navbarEn,
navbarZh,
navbarRu,
sidebarEn,
sidebarZh,
sidebarRu,
} from "./config/index.js";
let __dirname = getDirname(import.meta.url);
const isProduction = process.env.NODE_ENV === "production";
export default defaultTheme({
name: "vuepress-theme-xray",
smoothScroll: true,
repo: "xtls/xray-core",
docsDir: "docs",
docsRepo: "xtls/Xray-docs-next",
docsBranch: "main",
editLinks: true,
enableToggle: true,
locales: {
"/": {
navbar: navbarZh,
sidebar: sidebarZh,
repoLabel: "查看源码",
editLinkText: "帮助我们改善此页面!",
tip: "提示",
warning: "注意",
danger: "警告",
lastUpdatedText: "最近更改",
selectLanguageName: "简体中文",
selectLanguageText: "🌏 简体中文 / Change language",
selectLanguageAriaLabel: "简体中文 / Change language",
docsDir: "docs",
backToHome: "back to home",
openInNewWindow: "open in new tag",
toggleColorMode: "toggle color mode",
toggleSidebar: "toggle side bar",
},
"/en/": {
// TODO: translation
sidebar: sidebarEn,
navbar: navbarEn,
selectLanguageName: "English (WIP)",
selectLanguageText: "🌎 English / Change language",
selectLanguageAriaLabel: "English / Change language",
editLinkText: "Help us improve this page on GitHub!",
lastUpdatedText: "Last Updated",
contributorsText: "contributors",
// repoLabel: 'Source',
tip: "Tip",
warning: "Warning",
danger: "Danger",
// 404 page
notFound: [
"这里什么都没有",
"我们怎么到这来了?",
"这是一个 404 页面",
"看起来我们进入了错误的链接",
],
backToHome: "back to home",
openInNewWindow: "open in new tag",
toggleColorMode: "toggle color mode",
toggleSidebar: "toggle side bar",
},
"/ru/": {
navbar: navbarRu,
sidebar: sidebarRu,
repoLabel: "Посмотреть исходный код",
editLinkText: "Помогите нам улучшить эту страницу!",
tip: "Подсказка",
warning: "Внимание",
danger: "Предупреждение",
lastUpdatedText: "Последние изменения",
selectLanguageName: "Русский",
selectLanguageText: "🌍 Русский / Change language",
selectLanguageAriaLabel: "Русский / Change language",
docsDir: "docs",
backToHome: "На главную",
openInNewWindow: "Открыть в новой вкладке",
toggleColorMode: "Переключить цветовую схему",
toggleSidebar: "Переключить боковую панель",
},
// logo: '/logo.png',
// sidebar: 'auto',
themePlugins: {
git: isProduction,
},
},
});
-1
View File
@@ -1 +0,0 @@
# Xray-docs-next theme
@@ -1,11 +0,0 @@
// import { defineClientAppEnhance } from "@vuepress/client";
import { defineClientAppEnhance } from "vuepress/client";
import Tab from "./components/Tab.vue";
import Tabs from "./components/Tabs.vue";
import Mermaid from "./components/Mermaid.vue";
export default defineClientAppEnhance(({ app, router, siteData }) => {
app.component("Tab", Tab);
app.component("Tabs", Tabs);
app.component("Mermaid", Mermaid);
});
@@ -1,82 +0,0 @@
<template>
<div v-html="payload.innerHtml"></div>
</template>
<script lang="ts">
import { useMutationObserver } from "@vueuse/core";
import {
computed,
defineComponent,
h,
onMounted,
ref,
shallowRef,
watch,
reactive,
nextTick,
toRef,
} from "vue";
import { getDarkmodeStatus } from "../../plugins/mermaid/helpers/darkmode.js";
export default defineComponent({
name: "Mermaid",
props: {
id: { type: String, required: true },
code: { type: String, required: true },
},
setup(props) {
const html = reactive({ innerHtml: "" });
const chartID = toRef(props, "id");
const rawGraph = toRef(props, "code");
const isDarkmode = ref(false);
const renderMermaid = async (): Promise<void> => {
const mermaid = await import("mermaid");
mermaid.default.initialize({
theme: isDarkmode.value ? "dark" : "default",
startOnLoad: false,
});
mermaid.default
.render(chartID.value!, decodeURI(rawGraph.value!))
.then(({ svg, bindFunctions }) => {
html.innerHtml = svg;
});
};
onMounted(() => {
isDarkmode.value = getDarkmodeStatus();
nextTick(renderMermaid);
});
// watch darkmode change
if (typeof document !== "undefined") {
useMutationObserver(
document.documentElement,
() => {
isDarkmode.value = getDarkmodeStatus();
},
{
attributeFilter: ["class", "data-theme"],
attributes: true,
},
);
}
watch(isDarkmode, () => renderMermaid());
return {
tag: chartID,
payload: html,
};
},
});
</script>
<style scoped></style>
-41
View File
@@ -1,41 +0,0 @@
<template>
<div
class="tab-pane fade"
:id="tabID"
role="tabpanel"
:aria-labelledby="labelID"
>
<slot />
</div>
</template>
<script lang="ts">
import { defineComponent } from "vue";
export default defineComponent({
props: {
title: {
type: String,
},
},
data() {
let tag = this.title;
return {
tabID: tag,
};
},
mounted() {
this.tabID = "tab-" + Math.random().toString(36).substring(2);
this.$parent.$data.children.push({ id: this.tabID, title: this.title });
},
computed: {
labelID(): String {
return this.tabID + "-label";
},
},
});
</script>
<style lang="scss" scoped>
@import "node_modules/bootstrap/scss/bootstrap";
</style>
@@ -1,79 +0,0 @@
<template>
<div class="container">
<nav>
<div :id="tag" class="nav nav-pills" role="tablist">
<button
v-for="tab of children"
:id="tab.id + '-label'"
:aria-controls="tab.id"
:data-bs-target="'#' + tab.id"
aria-selected="false"
class="nav-link"
data-bs-toggle="tab"
role="tab"
type="button"
>
{{ tab.title }}
</button>
</div>
</nav>
<div :id="contentTag" class="tab-content">
<slot />
</div>
</div>
</template>
<script lang="ts">
import { defineComponent } from "vue";
export default defineComponent({
props: {
title: {
type: String,
},
},
data() {
return {
children: [],
};
},
beforeMount() {
this.children = [];
},
mounted() {
this.$nextTick(async function () {
const bootstrap = await import("bootstrap");
let triggerEl = document.getElementById(this.children["0"].id + "-label");
new bootstrap.Tab(triggerEl).show();
});
},
computed: {
tag: function () {
return "tabs-" + this.title;
},
contentTag: function () {
return "tabs-" + this.title + "-content";
},
},
});
</script>
<style lang="scss" scoped>
@import "node_modules/bootstrap/scss/bootstrap";
button.nav-link {
color: var(--c-text-accent);
&:hover,
&:focus {
color: var(--x-nav-text-hover);
}
}
nav {
padding-bottom: 0.5rem;
border-bottom: 1px solid var(--c-border);
}
div.tab-content {
border-bottom: 1px solid var(--c-border);
}
</style>
-15
View File
@@ -1,15 +0,0 @@
// import { Theme } from "@vuepress/core";
import { Theme } from "vuepress/core";
// import { path } from "@vuepress/utils";
import { path } from "vuepress/utils";
import { defaultTheme } from "vuepress";
export const docsPlugin: Theme = (options, app) => {
return defaultTheme({
name: "xray-docs-theme",
extends: "@vuepress/theme-default",
clientAppEnhanceFiles: path.resolve(__dirname, "clientAppEnhance.ts"),
});
};
export default docsPlugin;
-11935
View File
File diff suppressed because it is too large Load Diff
-46
View File
@@ -1,46 +0,0 @@
{
"name": "Xray-docs-next",
"version": "1.0.0",
"main": "index.js",
"repository": "https://github.com/XTLS/Xray-docs-next.git",
"author": "Arthur Morgan, Project X Community",
"license": "CC-BY-SA-4.0",
"devDependencies": {
"@types/bootstrap": "^5.2.0",
"@types/jquery": "^3.5.14",
"@types/node": "^24.10.1",
"@vuepress/bundler-vite": "2.0.0-rc.2",
"@vuepress/bundler-webpack": "2.0.0-rc.2",
"@vuepress/plugin-back-to-top": "^2.0.0-rc.3",
"@vuepress/plugin-search": "2.0.0-rc.3",
"postcss-loader": "^8.2.0",
"prettier": "^3.7.4",
"sass": "^1.51.0",
"sass-loader": "^14.2.0",
"typescript": "^5.9.2",
"vue-property-decorator": "^9.1.2",
"vuepress": "2.0.0-rc.2",
"vuepress-plugin-i18n": "https://codeload.github.com/XTLS/vuepress-plugin-i18n/tar.gz/5ae5b2d"
},
"scripts": {
"docs:dev": "vuepress dev docs --clean-temp --clean-cache",
"docs:build": "vuepress build docs --clean-temp --clean-cache",
"docs:serve": "anywhere -s -h localhost -d docs/.vuepress/dist",
"lint": "prettier --write ."
},
"dependencies": {
"@popperjs/core": "^2.11.5",
"@vuepress/plugin-google-analytics": "2.0.0-rc.3",
"@vuepress/plugin-register-components": "2.0.0-rc.3",
"@vuepress/plugin-shiki": "2.0.0-rc.3",
"@vuepress/theme-default": "2.0.0-rc.3",
"@vueuse/core": "^11.2.0",
"anywhere": "^1.7.0",
"bootstrap": "^5.2.0",
"esbuild": "^0.27.1",
"jquery": "^3.6.0",
"markdown-it-footnote": "^4.0.0",
"mermaid": "^11.4.0",
"vue": "3.3.13"
}
}
-6747
View File
File diff suppressed because it is too large Load Diff
-12
View File
@@ -1,12 +0,0 @@
{
"compilerOptions": {
"module": "ESNext",
"target": "ES2022",
"lib": ["DOM", "ES2022"],
"sourceMap": false,
"strict": true,
"moduleResolution": "Bundler"
},
"include": ["./docs/.vuepress/**/*.ts", "./docs/.vuepress/**/*.vue"],
"exclude": ["node_modules"]
}
-4
View File
@@ -1,4 +0,0 @@
import { splitVendorChunkPlugin } from "vite";
export default defineConfig({
plugins: [splitVendorChunkPlugin()],
});