Skip to content

Commit 28ccb39

Browse files
committed
feat: build with theme-hope
1 parent bffff58 commit 28ccb39

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+1673
-303
lines changed

.github/workflows/theme-hope-docs.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Deploy docs with theme-hope
2+
3+
on:
4+
push:
5+
branches:
6+
- theme-hope
7+
8+
jobs:
9+
deploy-netlify:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Install pnpm
18+
uses: pnpm/action-setup@v4
19+
with:
20+
run_install: true
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: 22
26+
cache: pnpm
27+
28+
- name: Build docs
29+
env:
30+
NODE_OPTIONS: --max_old_space_size=4096
31+
run: |-
32+
pnpm run docs:build
33+
> docs/.vuepress/dist/.nojekyll
34+
35+
- name: Deploy docs
36+
uses: JamesIves/github-pages-deploy-action@v4
37+
with:
38+
branch: netlify
39+
folder: docs/.vuepress/dist

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,6 @@
4141
"vuepress",
4242
"vueuse",
4343
"zoomable"
44-
]
44+
],
45+
"markdown.extension.toc.updateOnSave": false
4546
}

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66

77
VuePress documentation repository.
88

9+
This branch holds a VuePress2 official docs powered by [VuePress Theme Hope](https://theme-hope.vuejs.press).
10+
911
## Deployments
1012

11-
- Release deployment: <https://vuepress.vuejs.org>
13+
- Release deployment: <https://vuejs.press>
1214
- Developer deployment: <https://vuepress.github.io>
1315

1416
## License

docs/.vuepress/config.ts

Lines changed: 4 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,14 @@ import { createRequire } from 'node:module'
22
import process from 'node:process'
33
import { viteBundler } from '@vuepress/bundler-vite'
44
import { webpackBundler } from '@vuepress/bundler-webpack'
5-
import { docsearchPlugin } from '@vuepress/plugin-docsearch'
6-
import { googleAnalyticsPlugin } from '@vuepress/plugin-google-analytics'
75
import { registerComponentsPlugin } from '@vuepress/plugin-register-components'
8-
import { shikiPlugin } from '@vuepress/plugin-shiki'
9-
import { defaultTheme } from '@vuepress/theme-default'
106
import { defineUserConfig } from 'vuepress'
117
import { getDirname, path } from 'vuepress/utils'
12-
import {
13-
head,
14-
navbarEn,
15-
navbarZh,
16-
sidebarEn,
17-
sidebarZh,
18-
} from './configs/index.js'
8+
import { head } from './configs/index.js'
9+
import theme from './theme.js'
1910

2011
const __dirname = getDirname(import.meta.url)
2112
const require = createRequire(import.meta.url)
22-
const isProd = process.env.NODE_ENV === 'production'
2313

2414
export default defineUserConfig({
2515
// set site base to default value
@@ -46,73 +36,6 @@ export default defineUserConfig({
4636
bundler:
4737
process.env.DOCS_BUNDLER === 'webpack' ? webpackBundler() : viteBundler(),
4838

49-
// configure default theme
50-
theme: defaultTheme({
51-
hostname: 'https://vuepress.vuejs.org',
52-
logo: '/images/hero.png',
53-
repo: 'vuepress/core',
54-
docsRepo: 'vuepress/docs',
55-
docsDir: 'docs',
56-
57-
// theme-level locales config
58-
locales: {
59-
/**
60-
* English locale config
61-
*
62-
* As the default locale of @vuepress/theme-default is English,
63-
* we don't need to set all of the locale fields
64-
*/
65-
'/': {
66-
// navbar
67-
navbar: navbarEn,
68-
// sidebar
69-
sidebar: sidebarEn,
70-
// page meta
71-
editLinkText: 'Edit this page on GitHub',
72-
},
73-
74-
/**
75-
* Chinese locale config
76-
*/
77-
'/zh/': {
78-
// navbar
79-
navbar: navbarZh,
80-
selectLanguageName: '简体中文',
81-
selectLanguageText: '选择语言',
82-
selectLanguageAriaLabel: '选择语言',
83-
// sidebar
84-
sidebar: sidebarZh,
85-
// page meta
86-
editLinkText: '在 GitHub 上编辑此页',
87-
lastUpdatedText: '上次更新',
88-
contributorsText: '贡献者',
89-
// custom containers
90-
tip: '提示',
91-
warning: '注意',
92-
danger: '警告',
93-
// 404 page
94-
notFound: [
95-
'这里什么都没有',
96-
'我们怎么到这来了?',
97-
'这是一个 404 页面',
98-
'看起来我们进入了错误的链接',
99-
],
100-
backToHome: '返回首页',
101-
// a11y
102-
openInNewWindow: '在新窗口打开',
103-
toggleColorMode: '切换颜色模式',
104-
toggleSidebar: '切换侧边栏',
105-
},
106-
},
107-
108-
themePlugins: {
109-
// only enable git plugin in production mode
110-
git: isProd,
111-
// use shiki plugin in production mode instead
112-
prismjs: !isProd,
113-
},
114-
}),
115-
11639
// configure markdown
11740
markdown: {
11841
importCode: {
@@ -133,72 +56,12 @@ export default defineUserConfig({
13356
},
13457
},
13558

59+
theme,
60+
13661
// use plugins
13762
plugins: [
138-
docsearchPlugin({
139-
appId: '34YFD9IUQ2',
140-
apiKey: '9a9058b8655746634e01071411c366b8',
141-
indexName: 'vuepress',
142-
searchParameters: {
143-
facetFilters: ['tags:v2'],
144-
},
145-
locales: {
146-
'/zh/': {
147-
placeholder: '搜索文档',
148-
translations: {
149-
button: {
150-
buttonText: '搜索文档',
151-
buttonAriaLabel: '搜索文档',
152-
},
153-
modal: {
154-
searchBox: {
155-
resetButtonTitle: '清除查询条件',
156-
resetButtonAriaLabel: '清除查询条件',
157-
cancelButtonText: '取消',
158-
cancelButtonAriaLabel: '取消',
159-
},
160-
startScreen: {
161-
recentSearchesTitle: '搜索历史',
162-
noRecentSearchesText: '没有搜索历史',
163-
saveRecentSearchButtonTitle: '保存至搜索历史',
164-
removeRecentSearchButtonTitle: '从搜索历史中移除',
165-
favoriteSearchesTitle: '收藏',
166-
removeFavoriteSearchButtonTitle: '从收藏中移除',
167-
},
168-
errorScreen: {
169-
titleText: '无法获取结果',
170-
helpText: '你可能需要检查你的网络连接',
171-
},
172-
footer: {
173-
selectText: '选择',
174-
navigateText: '切换',
175-
closeText: '关闭',
176-
searchByText: '搜索提供者',
177-
},
178-
noResultsScreen: {
179-
noResultsText: '无法找到相关结果',
180-
suggestedQueryText: '你可以尝试查询',
181-
reportMissingResultsText: '你认为该查询应该有结果?',
182-
reportMissingResultsLinkText: '点击反馈',
183-
},
184-
},
185-
},
186-
},
187-
},
188-
}),
189-
googleAnalyticsPlugin({
190-
// we have multiple deployments, which would use different id
191-
id: process.env.DOCS_GA_ID ?? '',
192-
}),
19363
registerComponentsPlugin({
19464
componentsDir: path.resolve(__dirname, './components'),
19565
}),
196-
// only enable shiki plugin in production mode
197-
isProd
198-
? shikiPlugin({
199-
langs: ['bash', 'diff', 'json', 'md', 'ts', 'vue'],
200-
theme: 'dark-plus',
201-
})
202-
: [],
20366
],
20467
})

docs/.vuepress/configs/navbar/en.ts

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import type { NavbarOptions } from '@vuepress/theme-default'
1+
import { navbar } from 'vuepress-theme-hope'
22
import { VERSION } from '../meta.js'
33

4-
export const navbarEn: NavbarOptions = [
4+
export const NAVBAR_EN = navbar([
55
{
66
text: 'Guide',
7+
icon: 'fa6-solid:lightbulb',
78
children: [
89
'/guide/introduction.md',
910
'/guide/getting-started.md',
@@ -22,39 +23,42 @@ export const navbarEn: NavbarOptions = [
2223
},
2324
{
2425
text: 'Reference',
26+
icon: 'fa6-solid:book',
27+
prefix: '/reference/',
2528
children: [
2629
{
2730
text: 'Core',
2831
children: [
2932
{
3033
text: 'CLI',
31-
link: '/reference/cli.html',
34+
icon: 'bi:terminal-fill',
35+
link: 'cli.html',
3236
},
33-
'/reference/config.md',
34-
'/reference/frontmatter.md',
35-
'/reference/components.md',
36-
'/reference/plugin-api.md',
37-
'/reference/theme-api.md',
38-
'/reference/client-api.md',
39-
'/reference/node-api.md',
37+
'config',
38+
'frontmatter',
39+
'components',
40+
'plugin-api',
41+
'theme-api',
42+
'client-api',
43+
'node-api',
4044
],
4145
},
4246
{
4347
text: 'Bundlers',
44-
children: [
45-
'/reference/bundler/vite.md',
46-
'/reference/bundler/webpack.md',
47-
],
48+
prefix: 'bundler/',
49+
children: ['vite', 'webpack'],
4850
},
4951
{
5052
text: 'Ecosystem',
5153
children: [
5254
{
5355
text: 'Default Theme',
56+
icon: 'fa6-solid:palette',
5457
link: 'https://ecosystem.vuejs.press/themes/default/',
5558
},
5659
{
5760
text: 'Plugins',
61+
icon: 'fa6-solid:puzzle-piece',
5862
link: 'https://ecosystem.vuejs.press/plugins/',
5963
},
6064
],
@@ -64,16 +68,19 @@ export const navbarEn: NavbarOptions = [
6468

6569
{
6670
text: 'Learn More',
71+
icon: 'fa6-solid:feather',
6772
children: [
6873
{
6974
text: 'Advanced',
75+
prefix: '/advanced/',
7076
children: [
71-
'/advanced/architecture.md',
72-
'/advanced/plugin.md',
73-
'/advanced/theme.md',
77+
'architecture',
78+
'plugin',
79+
'theme',
7480
{
7581
text: 'Cookbook',
76-
link: '/advanced/cookbook/',
82+
icon: 'fa6-solid:signs-post',
83+
link: 'cookbook/',
7784
},
7885
],
7986
},
@@ -82,14 +89,17 @@ export const navbarEn: NavbarOptions = [
8289
children: [
8390
{
8491
text: 'Ecosystem',
92+
icon: 'fa6-solid:leaf',
8593
link: 'https://ecosystem.vuejs.press/',
8694
},
8795
{
8896
text: 'MarketPlace',
97+
icon: 'fa6-solid:cart-shopping',
8998
link: 'https://marketplace.vuejs.press',
9099
},
91100
{
92101
text: 'Contributing Guide',
102+
icon: 'fa6-solid:signs-post',
93103
link: 'https://github.com/vuepress/core/blob/main/CONTRIBUTING.md',
94104
},
95105
],
@@ -101,17 +111,19 @@ export const navbarEn: NavbarOptions = [
101111
children: [
102112
{
103113
text: 'Changelog',
104-
link: 'https://github.com/vuepress/core/blob/main/CHANGELOG.md',
114+
icon: 'fa6-solid:clock',
115+
link: 'https://github.com/vuepress/vuepress-next/blob/main/CHANGELOG.md',
105116
},
106117
{
107118
text: 'v1.x',
119+
icon: 'fa6-brands:vuejs',
108120
link: 'https://v1.vuepress.vuejs.org',
109121
},
110122
{
111123
text: 'v0.x',
124+
icon: 'fa6-brands:vuejs',
112125
link: 'https://v0.vuepress.vuejs.org',
113126
},
114127
],
115128
},
116-
// TODO: remove the type assertion
117-
] as NavbarOptions
129+
])

0 commit comments

Comments
 (0)