Skip to content

Commit a2189d9

Browse files
committed
feat(doc-site): add vuepress config
1 parent 3271bab commit a2189d9

File tree

21 files changed

+1263
-1439
lines changed

21 files changed

+1263
-1439
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ module.exports = /** @type { import('eslint').Linter.Config } */ ({
101101
'vue/require-default-prop': 'off',
102102
'vue/html-closing-bracket-spacing': 'error',
103103
'vue/no-unused-vars': 'warn',
104+
'vue/multi-word-component-names': 'off',
104105
'vue/one-component-per-file': 'off',
105106
'vue/comment-directive': [
106107
'warn',

.github/workflows/docs.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
9+
pull_request:
10+
branches:
11+
- main
12+
- master
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- name: Install pnpm
22+
uses: pnpm/action-setup@v2.2.1
23+
24+
- name: Use Node.js
25+
uses: actions/setup-node@v2
26+
with:
27+
node-version: 16.x
28+
registry-url: https://registry.npmjs.org/
29+
cache: pnpm
30+
31+
- run: pnpm install
32+
33+
- name: build docs
34+
run: pnpm run build --filter doc-site
35+
36+
- name: deploy docs to vercel
37+
uses: amondnet/vercel-action@v20
38+
# see: https://github.com/amondnet/vercel-action
39+
with:
40+
github-token: ${{ secrets.GITHUB_TOKEN }}
41+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
42+
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
43+
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID_DOC_SITE }}
44+
# for team settings
45+
scope: ${{ secrets.VERCEL_ORG_ID }}
46+
# just like npx vercel --prod
47+
vercel-args: '--prod'
48+
# the docs build dist folder
49+
working-directory: ./packages/doc-site/.vuepress/dist
50+
# bind domains
51+
# alias-domains: |
52+
# docs.vue-superman.com
53+
# docs.vue-superman.cn

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
"demi",
115115
"deps",
116116
"disableddate",
117+
"docsearch",
117118
"DOWNFILE",
118119
"ecmaversion",
119120
"Editer",
@@ -157,6 +158,7 @@
157158
"postbuild",
158159
"preinstall",
159160
"preversion",
161+
"prismjs",
160162
"pythonic",
161163
"Querys",
162164
"Queryt",
@@ -176,6 +178,7 @@
176178
"selectyearprops",
177179
"sels",
178180
"sgcomname",
181+
"shiki",
179182
"shouqi",
180183
"socio",
181184
"storysource",
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<script setup lang="ts">
2+
import {computed} from 'vue'
3+
4+
const props = defineProps({
5+
package: {
6+
type: String,
7+
required: true
8+
},
9+
distTag: {
10+
type: String,
11+
required: false,
12+
default: 'next'
13+
}
14+
})
15+
16+
const badgeLink = computed(() => `https://www.npmjs.com/package/${props.package}`)
17+
const badgeLabel = computed(() => {
18+
if (props.distTag) {
19+
return `${props.package}@${props.distTag}`
20+
}
21+
22+
return props.package
23+
})
24+
const badgeImg = computed(
25+
() => `https://badgen.net/npm/v/${props.package}/${props.distTag}?label=${encodeURIComponent(badgeLabel.value)}`
26+
)
27+
</script>
28+
29+
<template>
30+
<a class="npm-badge" :href="badgeLink" :title="package" target="_blank" rel="noopener noreferrer">
31+
<img :src="badgeImg" :alt="package" />
32+
</a>
33+
</template>
34+
35+
<style scoped>
36+
.npm-badge {
37+
margin-right: 0.5rem;
38+
}
39+
</style>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import path from 'path'
2+
export * as navbar from './navbar'
3+
export * as sidebar from './sidebar'
4+
5+
const rootJson = path.resolve(__dirname, '../../../../package.json')
6+
7+
export const pkgInfo = require(rootJson)
8+
9+
export const version = pkgInfo.version as string
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
import type {NavbarConfig} from '@vuepress/theme-default'
2+
import {version} from '../'
3+
4+
export const en: NavbarConfig = [
5+
{
6+
text: 'Guide',
7+
link: '/guide/'
8+
},
9+
{
10+
text: 'Reference',
11+
children: [
12+
{
13+
text: 'VuePress',
14+
children: [
15+
{
16+
text: 'CLI',
17+
link: '/reference/cli.html'
18+
},
19+
'/reference/config.md',
20+
'/reference/frontmatter.md',
21+
'/reference/components.md',
22+
'/reference/plugin-api.md',
23+
'/reference/theme-api.md',
24+
'/reference/client-api.md',
25+
'/reference/node-api.md'
26+
]
27+
},
28+
{
29+
text: 'Bundlers',
30+
children: ['/reference/bundler/vite.md', '/reference/bundler/webpack.md']
31+
},
32+
{
33+
text: 'Default Theme',
34+
children: [
35+
'/reference/default-theme/config.md',
36+
'/reference/default-theme/frontmatter.md',
37+
'/reference/default-theme/components.md',
38+
'/reference/default-theme/markdown.md',
39+
'/reference/default-theme/styles.md',
40+
'/reference/default-theme/extending.md'
41+
]
42+
}
43+
]
44+
},
45+
{
46+
text: 'Plugins',
47+
children: [
48+
{
49+
text: 'Common Features',
50+
children: [
51+
'/reference/plugin/back-to-top.md',
52+
'/reference/plugin/container.md',
53+
'/reference/plugin/external-link-icon.md',
54+
'/reference/plugin/google-analytics.md',
55+
'/reference/plugin/medium-zoom.md',
56+
'/reference/plugin/nprogress.md',
57+
'/reference/plugin/register-components.md'
58+
]
59+
},
60+
{
61+
text: 'Content Search',
62+
children: ['/reference/plugin/docsearch.md', '/reference/plugin/search.md']
63+
},
64+
{
65+
text: 'PWA',
66+
children: ['/reference/plugin/pwa.md', '/reference/plugin/pwa-popup.md']
67+
},
68+
{
69+
text: 'Syntax Highlighting',
70+
children: ['/reference/plugin/prismjs.md', '/reference/plugin/shiki.md']
71+
},
72+
{
73+
text: 'Theme Development',
74+
children: [
75+
'/reference/plugin/active-header-links.md',
76+
'/reference/plugin/git.md',
77+
'/reference/plugin/palette.md',
78+
'/reference/plugin/theme-data.md',
79+
'/reference/plugin/toc.md'
80+
]
81+
}
82+
]
83+
},
84+
{
85+
text: 'Learn More',
86+
children: [
87+
{
88+
text: 'Advanced',
89+
children: [
90+
'/advanced/architecture.md',
91+
'/advanced/plugin.md',
92+
'/advanced/theme.md',
93+
{
94+
text: 'Cookbook',
95+
link: '/advanced/cookbook/'
96+
}
97+
]
98+
},
99+
{
100+
text: 'Resources',
101+
children: [
102+
'/contributing.md',
103+
{
104+
text: 'Awesome VuePress',
105+
link: 'https://github.com/vuepress/awesome-vuepress'
106+
}
107+
]
108+
}
109+
]
110+
},
111+
{
112+
text: `v${version}`,
113+
children: [
114+
{
115+
text: 'Changelog',
116+
link: 'https://github.com/vuepress/vuepress-next/blob/main/CHANGELOG.md'
117+
},
118+
{
119+
text: 'v1.x',
120+
link: 'https://v1.vuepress.vuejs.org'
121+
},
122+
{
123+
text: 'v0.x',
124+
link: 'https://v0.vuepress.vuejs.org'
125+
}
126+
]
127+
}
128+
]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './en'
2+
export * from './zh'
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
import type {NavbarConfig} from '@vuepress/theme-default'
2+
import {version} from '../'
3+
4+
export const zh: NavbarConfig = [
5+
{
6+
text: '指南',
7+
link: '/zh/guide/'
8+
},
9+
{
10+
text: '参考',
11+
children: [
12+
{
13+
text: 'VuePress',
14+
children: [
15+
'/zh/reference/cli.md',
16+
'/zh/reference/config.md',
17+
'/zh/reference/frontmatter.md',
18+
'/zh/reference/components.md',
19+
'/zh/reference/plugin-api.md',
20+
'/zh/reference/theme-api.md',
21+
'/zh/reference/client-api.md',
22+
'/zh/reference/node-api.md'
23+
]
24+
},
25+
{
26+
text: '打包工具',
27+
children: ['/zh/reference/bundler/vite.md', '/zh/reference/bundler/webpack.md']
28+
},
29+
{
30+
text: '默认主题',
31+
children: [
32+
'/zh/reference/default-theme/config.md',
33+
'/zh/reference/default-theme/frontmatter.md',
34+
'/zh/reference/default-theme/components.md',
35+
'/zh/reference/default-theme/markdown.md',
36+
'/zh/reference/default-theme/styles.md',
37+
'/zh/reference/default-theme/extending.md'
38+
]
39+
}
40+
]
41+
},
42+
{
43+
text: '插件',
44+
children: [
45+
{
46+
text: '常用功能',
47+
children: [
48+
'/zh/reference/plugin/back-to-top.md',
49+
'/zh/reference/plugin/container.md',
50+
'/zh/reference/plugin/external-link-icon.md',
51+
'/zh/reference/plugin/google-analytics.md',
52+
'/zh/reference/plugin/medium-zoom.md',
53+
'/zh/reference/plugin/nprogress.md',
54+
'/zh/reference/plugin/register-components.md'
55+
]
56+
},
57+
{
58+
text: '内容搜索',
59+
children: ['/zh/reference/plugin/docsearch.md', '/zh/reference/plugin/search.md']
60+
},
61+
{
62+
text: 'PWA',
63+
children: ['/zh/reference/plugin/pwa.md', '/zh/reference/plugin/pwa-popup.md']
64+
},
65+
{
66+
text: '语法高亮',
67+
children: ['/zh/reference/plugin/prismjs.md', '/zh/reference/plugin/shiki.md']
68+
},
69+
{
70+
text: '主题开发',
71+
children: [
72+
'/zh/reference/plugin/active-header-links.md',
73+
'/zh/reference/plugin/git.md',
74+
'/zh/reference/plugin/palette.md',
75+
'/zh/reference/plugin/theme-data.md',
76+
'/zh/reference/plugin/toc.md'
77+
]
78+
}
79+
]
80+
},
81+
{
82+
text: '了解更多',
83+
children: [
84+
{
85+
text: '深入',
86+
children: [
87+
'/zh/advanced/architecture.md',
88+
'/zh/advanced/plugin.md',
89+
'/zh/advanced/theme.md',
90+
{
91+
text: 'Cookbook',
92+
link: '/zh/advanced/cookbook/'
93+
}
94+
]
95+
},
96+
{
97+
text: '其他资源',
98+
children: [
99+
'/zh/contributing.md',
100+
{
101+
text: 'Awesome VuePress',
102+
link: 'https://github.com/vuepress/awesome-vuepress'
103+
}
104+
]
105+
}
106+
]
107+
},
108+
{
109+
text: `v${version}`,
110+
children: [
111+
{
112+
text: '更新日志',
113+
link: 'https://github.com/vuepress/vuepress-next/blob/main/CHANGELOG.md'
114+
},
115+
{
116+
text: 'v1.x',
117+
link: 'https://v1.vuepress.vuejs.org/zh/'
118+
},
119+
{
120+
text: 'v0.x',
121+
link: 'https://v0.vuepress.vuejs.org/zh/'
122+
}
123+
]
124+
}
125+
]

0 commit comments

Comments
 (0)