-
-
Notifications
You must be signed in to change notification settings - Fork 680
/
theme-wrapper.ts
65 lines (51 loc) · 1.52 KB
/
theme-wrapper.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { hopeTheme } from "vuepress-theme-hope";
import type { ThemeFunction } from "@vuepress/core";
import type { ThemeOptions } from "vuepress-theme-hope";
const IS_GITEE = "GITEE" in process.env;
const IS_NETLIFY = "NETLIFY" in process.env;
const IS_GITHUB = !IS_GITEE && !IS_NETLIFY;
export const theme = (
name: string,
{ plugins = {}, ...options }: ThemeOptions
): ThemeFunction => {
const canonical = `https://${
name === "theme"
? "theme-hope"
: name === "shared"
? "shared"
: `plugin-${name}`
}.vuejs.press`;
const hostname = IS_GITHUB
? "https://vuepress-theme-hope.github.io"
: IS_GITEE
? "https://vuepress-theme-hope.gitee.io"
: canonical;
return hopeTheme({
hostname,
author: {
name: "Mr.Hope",
url: "https://mrhope.site",
},
iconAssets: "iconfont",
repo: `vuepress-theme-hope/vuepress-theme-hope/tree/main/packages/${name}/`,
docsRepo: "vuepress-theme-hope/vuepress-theme-hope",
docsDir: `docs/${name}/src`,
logo: "/logo.svg",
footer: "MIT Licensed | Copyright © 2019-present Mr.Hope",
copyright: false,
displayFooter: true,
pageInfo: ["Category", "Tag", "ReadingTime"],
plugins: {
comment: {
provider: "Giscus",
repo: "vuepress-theme-hope/giscus-discussions",
repoId: "R_kgDOG_Pt2A",
category: "Announcements",
categoryId: "DIC_kwDOG_Pt2M4COD69",
},
seo: hostname === canonical ? {} : { canonical },
...plugins,
},
...options,
});
};