Skip to content

Commit 4512c55

Browse files
committed
docs: 完善web-docs config,添加logo(抽卡获得)
1 parent 9078721 commit 4512c55

27 files changed

+7221
-32
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,4 @@ build/
3838
/document/web-docs/node_modules/
3939
/document/web-docs/docs/.vuepress/.cache/
4040
/document/web-docs/docs/.vuepress/.temp/
41-
/document/web-docs/pnpm-lock.yaml
4241
/document/web-docs/docs/.vuepress/dist/

document/web-docs/docs/.vuepress/config.js

-17
This file was deleted.
+178
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
import {createRequire} from 'node:module'
2+
import process from 'node:process'
3+
import {viteBundler} from '@vuepress/bundler-vite'
4+
import {docsearchPlugin} from '@vuepress/plugin-docsearch'
5+
import {baiduAnalyticsPlugin} from '@vuepress/plugin-baidu-analytics'
6+
import {registerComponentsPlugin} from '@vuepress/plugin-register-components'
7+
import {sitemapPlugin} from '@vuepress/plugin-sitemap'
8+
import {shikiPlugin} from '@vuepress/plugin-shiki'
9+
import {defaultTheme} from '@vuepress/theme-default'
10+
import {defineUserConfig} from 'vuepress'
11+
import {getDirname, path} from 'vuepress/utils'
12+
import {head, navbarZh, sidebarZh,} from './configs'
13+
14+
const __dirname = getDirname(import.meta.url)
15+
const require = createRequire(import.meta.url)
16+
const isProd = process.env.NODE_ENV === 'production'
17+
18+
// noinspection JSUnusedGlobalSymbols
19+
export default defineUserConfig({
20+
// set site base to default value
21+
base: '/',
22+
23+
// extra tags in `<head>`
24+
head,
25+
26+
lang: 'zh-CN',
27+
28+
title: 'SpEL Validator',
29+
description: '一个强大的 Java 参数校验包,基于 SpEL 实现,扩展自 javax.validation 包,几乎支持所有场景下的参数校验。',
30+
31+
// specify bundler via environment variable
32+
bundler: viteBundler(),
33+
34+
// configure default theme
35+
theme: defaultTheme({
36+
hostname: 'https://spel-validator.sticki.cn/',
37+
logo: '/images/hero.png',
38+
repo: 'stick-i/spel-validator',
39+
docsRepo: 'stick-i/spel-validator',
40+
docsDir: 'document/web-docs/docs',
41+
docsBranch: 'docs',
42+
43+
// theme-level locales config
44+
locales: {
45+
46+
/**
47+
* Chinese locale config
48+
*/
49+
'/': {
50+
// navbar
51+
navbar: navbarZh,
52+
selectLanguageName: '简体中文',
53+
selectLanguageText: '选择语言',
54+
selectLanguageAriaLabel: '选择语言',
55+
// sidebar
56+
sidebar: sidebarZh,
57+
// page meta
58+
editLinkText: '在 GitHub 上编辑此页',
59+
lastUpdatedText: '上次更新',
60+
contributorsText: '贡献者',
61+
// custom containers
62+
tip: '提示',
63+
warning: '注意',
64+
danger: '警告',
65+
// 404 page
66+
notFound: [
67+
'这里什么都没有',
68+
'我们怎么到这来了?',
69+
'这是一个 404 页面',
70+
'看起来我们进入了错误的链接',
71+
],
72+
backToHome: '返回首页',
73+
// a11y
74+
openInNewWindow: '在新窗口打开',
75+
toggleColorMode: '切换颜色模式',
76+
toggleSidebar: '切换侧边栏',
77+
},
78+
},
79+
80+
themePlugins: {
81+
// only enable git plugin in production mode
82+
git: isProd,
83+
// use shiki plugin in production mode instead
84+
prismjs: !isProd,
85+
},
86+
}),
87+
88+
// configure markdown
89+
markdown: {
90+
importCode: {
91+
handleImportPath: (importPath) => {
92+
// handle @vuepress packages import path
93+
if (importPath.startsWith('@vuepress/')) {
94+
const packageName = importPath.match(/^(@vuepress\/[^/]*)/)![1]
95+
return importPath
96+
.replace(
97+
packageName,
98+
path.dirname(require.resolve(`${packageName}/package.json`)),
99+
)
100+
.replace('/src/', '/lib/')
101+
.replace(/hotKey\.ts$/, 'hotKey.d.ts')
102+
}
103+
return importPath
104+
},
105+
},
106+
},
107+
108+
// use plugins
109+
plugins: [
110+
docsearchPlugin({
111+
appId: '',
112+
apiKey: '',
113+
indexName: 'spel-validator',
114+
searchParameters: {
115+
facetFilters: ['tags:v2'],
116+
},
117+
locales: {
118+
'/': {
119+
placeholder: '搜索文档',
120+
translations: {
121+
button: {
122+
buttonText: '搜索文档',
123+
buttonAriaLabel: '搜索文档',
124+
},
125+
modal: {
126+
searchBox: {
127+
resetButtonTitle: '清除查询条件',
128+
resetButtonAriaLabel: '清除查询条件',
129+
cancelButtonText: '取消',
130+
cancelButtonAriaLabel: '取消',
131+
},
132+
startScreen: {
133+
recentSearchesTitle: '搜索历史',
134+
noRecentSearchesText: '没有搜索历史',
135+
saveRecentSearchButtonTitle: '保存至搜索历史',
136+
removeRecentSearchButtonTitle: '从搜索历史中移除',
137+
favoriteSearchesTitle: '收藏',
138+
removeFavoriteSearchButtonTitle: '从收藏中移除',
139+
},
140+
errorScreen: {
141+
titleText: '无法获取结果',
142+
helpText: '你可能需要检查你的网络连接',
143+
},
144+
footer: {
145+
selectText: '选择',
146+
navigateText: '切换',
147+
closeText: '关闭',
148+
searchByText: '搜索提供者',
149+
},
150+
noResultsScreen: {
151+
noResultsText: '无法找到相关结果',
152+
suggestedQueryText: '你可以尝试查询',
153+
reportMissingResultsText: '你认为该查询应该有结果?',
154+
reportMissingResultsLinkText: '点击反馈',
155+
},
156+
},
157+
},
158+
},
159+
},
160+
}),
161+
baiduAnalyticsPlugin({
162+
id: '1d5d746b39da6a27516834e6529b02e6',
163+
}),
164+
registerComponentsPlugin({
165+
componentsDir: path.resolve(__dirname, './components'),
166+
}),
167+
sitemapPlugin({
168+
hostname: 'spel-validator.sticki.cn',
169+
}),
170+
// only enable shiki plugin in production mode
171+
isProd
172+
? shikiPlugin({
173+
langs: ['bash', 'diff', 'json', 'md', 'ts', 'vue'],
174+
theme: 'dark-plus',
175+
})
176+
: [],
177+
],
178+
})
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import type {HeadConfig} from 'vuepress/core'
2+
3+
export const head: HeadConfig[] = [
4+
[
5+
'link',
6+
{
7+
rel: 'icon',
8+
type: 'image/png',
9+
sizes: '16x16',
10+
href: `/images/logo.png`,
11+
},
12+
],
13+
[
14+
'link',
15+
{
16+
rel: 'icon',
17+
type: 'image/png',
18+
sizes: '32x32',
19+
href: `/images/logo.png`,
20+
},
21+
],
22+
['link', {rel: 'manifest', href: '/manifest.webmanifest'}],
23+
['meta', {name: 'application-name', content: 'VuePress'}],
24+
['meta', {name: 'apple-mobile-web-app-title', content: 'VuePress'}],
25+
['meta', {name: 'apple-mobile-web-app-status-bar-style', content: 'black'}],
26+
[
27+
'link',
28+
{rel: 'apple-touch-icon', href: `/images/icons/apple-touch-icon.png`},
29+
],
30+
[
31+
'link',
32+
{
33+
rel: 'mask-icon',
34+
href: '/images/icons/safari-pinned-tab.svg',
35+
color: '#3eaf7c',
36+
},
37+
],
38+
['meta', {name: 'msapplication-TileColor', content: '#3eaf7c'}],
39+
['meta', {name: 'theme-color', content: '#3eaf7c'}],
40+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export * from './head'
2+
export * from './navbar/index.js'
3+
export * from './sidebar/index.js'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import config from '../../../package.json'
2+
3+
// 获取版本号
4+
export const version = config.version;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './zh.js'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import {version} from '../meta'
2+
import type {NavbarOptions} from "@vuepress/theme-default";
3+
4+
export const navbarZh: NavbarOptions = [
5+
{
6+
text: '指南',
7+
children: [
8+
'/guide/introduction.md',
9+
'/guide/getting-started.md',
10+
],
11+
},
12+
{
13+
text: `v${version}`,
14+
children: [
15+
{
16+
text: '更新日志',
17+
link: 'https://github.com/stick-i/spel-validator/releases',
18+
},
19+
],
20+
},
21+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './zh.js'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import type {SidebarOptions} from '@vuepress/theme-default'
2+
3+
export const sidebarZh: SidebarOptions = {
4+
'/guide/': [
5+
{
6+
text: '指南',
7+
children: [
8+
'/guide/introduction.md',
9+
'/guide/getting-started.md',
10+
],
11+
},
12+
],
13+
'/advanced/': [
14+
{
15+
text: '深入',
16+
children: [
17+
'/advanced/architecture.md',
18+
'/advanced/plugin.md',
19+
'/advanced/theme.md',
20+
],
21+
},
22+
{
23+
text: 'Cookbook',
24+
children: [
25+
'/advanced/cookbook/README.md',
26+
'/advanced/cookbook/usage-of-client-config.md',
27+
'/advanced/cookbook/adding-extra-pages.md',
28+
'/advanced/cookbook/making-a-theme-extendable.md',
29+
'/advanced/cookbook/passing-data-to-client-code.md',
30+
'/advanced/cookbook/markdown-and-vue-sfc.md',
31+
'/advanced/cookbook/resolving-routes.md',
32+
],
33+
},
34+
],
35+
}
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
User-agent:*
2+
3+
Allow: /

document/web-docs/docs/README.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
home: true
33
title: Home
4-
heroImage: https://vuejs.press/images/hero.png
4+
heroImage: ./images/hero.png
55
actions:
66
- text: 快速开始
7-
link: /get-started.html
7+
link: /guide/getting-started.html
88
type: primary
99

1010
- text: 项目介绍
11-
link: https://vuejs.press/guide/introduction.html
11+
link: /guide/introduction.html
1212
type: secondary
1313

1414
features:
@@ -27,5 +27,3 @@ features:
2727

2828
footer: Apache-2.0 license | 版权所有 © 2024-至今 阿杆
2929
---
30-
31-
[default-theme-home]: https://vuejs.press/reference/default-theme/frontmatter.html#home-page

document/web-docs/docs/get-started.md

-1
This file was deleted.

0 commit comments

Comments
 (0)