mirror of
https://github.com/alibaba/arthas.git
synced 2024-04-21 10:21:39 +00:00
fix(docs): adapted vuepress2 beta51 (#2270)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import oldContributorsData from "./oldContributorsData.json";
|
||||
|
||||
import { usePageData } from "@vuepress/client";
|
||||
import { defineClientConfig } from "@vuepress/client";
|
||||
import { usePageData, defineClientConfig } from "@vuepress/client";
|
||||
import CountTo from "vue-count-to/src/vue-countTo.vue";
|
||||
|
||||
const addOldDocsContributors = () => {
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
const { localTheme } = require("./theme/index");
|
||||
const { loadVersionPlugin } = require("./plugins/vuepress-plugin-loadVersion");
|
||||
import { localTheme } from "./theme/index";
|
||||
import { loadVersionPlugin } from "./plugins/vuepress-plugin-loadVersion";
|
||||
import { head, navbarEN, navbarZH, sidebarEN, sidebarZH } from "./configs";
|
||||
|
||||
const {
|
||||
activeHeaderLinksPlugin,
|
||||
} = require("@vuepress/plugin-active-header-links");
|
||||
const { docsearchPlugin } = require("@vuepress/plugin-docsearch");
|
||||
const { copyCodePlugin } = require("vuepress-plugin-copy-code2");
|
||||
const { redirectPlugin } = require("vuepress-plugin-redirect");
|
||||
const { searchPlugin } = require("@vuepress/plugin-search");
|
||||
import { activeHeaderLinksPlugin } from "@vuepress/plugin-active-header-links";
|
||||
import { copyCodePlugin } from "vuepress-plugin-copy-code2";
|
||||
import { docsearchPlugin } from "@vuepress/plugin-docsearch";
|
||||
import { redirectPlugin } from "vuepress-plugin-redirect";
|
||||
import { defineUserConfig } from "vuepress";
|
||||
|
||||
module.exports = {
|
||||
export default defineUserConfig({
|
||||
title: "arthas",
|
||||
description: "arthas user document",
|
||||
head: require("./configs/head"),
|
||||
head,
|
||||
locales: {
|
||||
"/": {
|
||||
lang: "zh-CN",
|
||||
@@ -31,6 +30,9 @@ module.exports = {
|
||||
repo: "alibaba/arthas",
|
||||
docsDir: "site/docs",
|
||||
docsBranch: "master",
|
||||
themePlugins: {
|
||||
activeHeaderLinks: false,
|
||||
},
|
||||
|
||||
locales: {
|
||||
"/": {
|
||||
@@ -51,20 +53,19 @@ module.exports = {
|
||||
"这是一个 404 页面",
|
||||
"看起来我们进入了错误的链接",
|
||||
],
|
||||
backToHome: "返回首页",
|
||||
openInNewWindow: "在新窗口打开",
|
||||
toggleColorMode: "切换颜色模式",
|
||||
toggleSidebar: "切换侧边栏",
|
||||
navbar: require("./configs/navbar/zh"),
|
||||
sidebar: require("./configs/sidebar/zh"),
|
||||
navbar: navbarZH,
|
||||
sidebar: sidebarZH,
|
||||
sidebarDepth: 0,
|
||||
},
|
||||
"/en/": {
|
||||
selectLanguageName: "English",
|
||||
selectLanguageText: "Languages",
|
||||
editLinkText: "Edit this page on GitHub",
|
||||
navbar: require("./configs/navbar/en"),
|
||||
sidebar: require("./configs/sidebar/en"),
|
||||
navbar: navbarEN,
|
||||
sidebar: sidebarEN,
|
||||
sidebarDepth: 0,
|
||||
},
|
||||
},
|
||||
@@ -82,16 +83,6 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
}),
|
||||
searchPlugin({
|
||||
locales: {
|
||||
"/": {
|
||||
placeholder: "搜索文档",
|
||||
},
|
||||
"/en/": {
|
||||
placeholder: "Search Docs",
|
||||
},
|
||||
},
|
||||
}),
|
||||
redirectPlugin({
|
||||
config: (app) => {
|
||||
const redirects = Object.fromEntries(
|
||||
@@ -165,4 +156,4 @@ module.exports = {
|
||||
// Local plugin
|
||||
loadVersionPlugin(),
|
||||
],
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module.exports = [
|
||||
export const head = [
|
||||
["link", { rel: "icon", href: "/images/favicon.ico" }],
|
||||
[
|
||||
"meta",
|
||||
@@ -0,0 +1 @@
|
||||
export * from "./head";
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from "./navbar";
|
||||
export * from "./sidebar";
|
||||
export * from "./head";
|
||||
@@ -1,4 +1,4 @@
|
||||
module.exports = [
|
||||
export const navbarEN = [
|
||||
{
|
||||
text: "HOME",
|
||||
link: "/en/",
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from "./zh";
|
||||
export * from "./en";
|
||||
@@ -1,4 +1,4 @@
|
||||
module.exports = [
|
||||
export const navbarZH = [
|
||||
{
|
||||
text: "首页",
|
||||
link: "/",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
export const sidebarEN = {
|
||||
"/en/doc": [
|
||||
{
|
||||
text: "DOCS",
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from "./zh";
|
||||
export * from "./en";
|
||||
@@ -1,4 +1,4 @@
|
||||
module.exports = {
|
||||
export const sidebarZH = {
|
||||
"/doc/": [
|
||||
{
|
||||
text: "文档",
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
const fs = require("fs");
|
||||
const fetch = require("node-fetch");
|
||||
const convert = require("xml-js");
|
||||
import { readFileSync } from "fs";
|
||||
import fetch from "node-fetch";
|
||||
import { xml2js } from "xml-js";
|
||||
|
||||
exports.loadVersionPlugin = () => {
|
||||
const data = fs.readFileSync("../pom.xml");
|
||||
const pom = convert.xml2js(data.toString(), { compact: true });
|
||||
export function loadVersionPlugin() {
|
||||
const data = readFileSync("../pom.xml");
|
||||
const pom = xml2js(data.toString(), { compact: true });
|
||||
|
||||
const getVersionByMaven = async () => {
|
||||
return await fetch(
|
||||
@@ -26,4 +26,4 @@ exports.loadVersionPlugin = () => {
|
||||
app.pages.map((page) => (page.data.version = version));
|
||||
},
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useThemeLocaleData } from "@vuepress/theme-default/lib/client/composables";
|
||||
import { useThemeLocaleData } from "@vuepress/plugin-theme-data/client";
|
||||
|
||||
const props = defineProps({
|
||||
comp: {
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
} from "@vuepress/client";
|
||||
import { isArray } from "@vuepress/shared";
|
||||
import { computed, h } from "vue";
|
||||
import { useDarkMode } from "@vuepress/theme-default/lib/client/composables";
|
||||
import { useDarkMode } from "@vuepress/theme-default/client";
|
||||
|
||||
const frontmatter = usePageFrontmatter();
|
||||
const siteLocale = useSiteLocaleData();
|
||||
|
||||
@@ -7,10 +7,8 @@ import {
|
||||
withBase,
|
||||
} from "@vuepress/client";
|
||||
import { computed, h, ref } from "vue";
|
||||
import {
|
||||
useDarkMode,
|
||||
useThemeLocaleData,
|
||||
} from "@vuepress/theme-default/lib/client";
|
||||
import { useThemeLocaleData } from "@vuepress/plugin-theme-data/client";
|
||||
import { useDarkMode } from "@vuepress/theme-default/client";
|
||||
|
||||
const pageData = usePageData();
|
||||
const isDarkMode = useDarkMode();
|
||||
|
||||
@@ -51,7 +51,7 @@ SRC: https://github.com/xugaoyi/vuepress-theme-vdoing/blob/master/vdoing/compone
|
||||
import { useRoute } from "vue-router";
|
||||
import { onMounted, watch, ref } from "vue";
|
||||
import { usePageData } from "@vuepress/client";
|
||||
import { useThemeLocaleData } from "@vuepress/theme-default/lib/client/composables/useThemeData";
|
||||
import { useThemeLocaleData } from "@vuepress/plugin-theme-data/client";
|
||||
|
||||
const pages = usePageData();
|
||||
const theme = useThemeLocaleData();
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
const { defaultTheme } = require("@vuepress/theme-default");
|
||||
const { path } = require("@vuepress/utils");
|
||||
import { defaultTheme } from "@vuepress/theme-default";
|
||||
import { getDirname, path } from "@vuepress/utils";
|
||||
|
||||
exports.localTheme = (options) => {
|
||||
const __dirname = getDirname(import.meta.url);
|
||||
|
||||
export function localTheme(options) {
|
||||
return {
|
||||
name: "vuepress-theme-arthas",
|
||||
extends: defaultTheme(options),
|
||||
@@ -20,4 +22,4 @@ exports.localTheme = (options) => {
|
||||
),
|
||||
},
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Generated
+1627
-1960
File diff suppressed because it is too large
Load Diff
+8
-9
@@ -1,8 +1,7 @@
|
||||
{
|
||||
"name": "site",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"description": "Arthas user documentation site",
|
||||
"scripts": {
|
||||
"docs:dev": "vuepress dev docs",
|
||||
"docs:build": "vuepress build docs",
|
||||
@@ -11,16 +10,16 @@
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@vuepress/plugin-active-header-links": "^2.0.0-beta.49",
|
||||
"@vuepress/plugin-docsearch": "^2.0.0-beta.49",
|
||||
"@vuepress/plugin-search": "^2.0.0-beta.48",
|
||||
"@vuepress/plugin-active-header-links": "^2.0.0-beta.51",
|
||||
"@vuepress/plugin-docsearch": "^2.0.0-beta.51",
|
||||
"@vuepress/plugin-theme-data": "^2.0.0-beta.51",
|
||||
"prettier": "2.7.1",
|
||||
"vuepress": "^2.0.0-beta.48",
|
||||
"vuepress-plugin-copy-code2": "^2.0.0-beta.84",
|
||||
"vuepress-plugin-redirect": "^2.0.0-beta.86"
|
||||
"vuepress": "^2.0.0-beta.51",
|
||||
"vuepress-plugin-copy-code2": "^2.0.0-beta.97",
|
||||
"vuepress-plugin-redirect": "^2.0.0-beta.97"
|
||||
},
|
||||
"dependencies": {
|
||||
"node-fetch": "^2.6.7",
|
||||
"node-fetch": "^3.2.10",
|
||||
"vue-count-to": "^1.0.13",
|
||||
"xml-js": "^1.6.11"
|
||||
}
|
||||
|
||||
+665
-717
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user