Skip to content

Commit 9bbf347

Browse files
committed
feat: 更新配置
1 parent 2ea5465 commit 9bbf347

4 files changed

Lines changed: 54 additions & 57 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ jobs:
3131
# 部署
3232
- name: Deploy
3333
env: # 设置环境变量
34-
GITHUB_TOKEN: ${{ secrets.TOKEN }}
34+
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
3535
run: npm install && npm run deploy

docs/.vuepress/config.js

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = {
1313
// 注入到页面<head> 中的标签,格式[tagName, { attrName: attrValue }, innerHTML?]
1414
['link', { rel: 'icon', href: '/img/favicon.ico' }], //favicons,资源放在public文件夹
1515
['meta', { name: 'keywords', content: 'vuepress,theme,blog,vdoing' }],
16-
['meta', { name: 'theme-color', content: '#11a8cd' }], // 移动浏览器主题颜色
16+
['meta', { name: 'theme-color', content: '#11a8cd' }] // 移动浏览器主题颜色
1717
],
1818

1919
// 主题配置
@@ -28,8 +28,8 @@ module.exports = {
2828
{ text: 'Java构建', link: '/02.Java软件/01.Java构建/' },
2929
{ text: 'Java IDE', link: '/02.Java软件/02.JavaIDE/' },
3030
{ text: 'Java服务器', link: '/02.Java软件/03.Java服务器/' },
31-
{ text: 'Java监控诊断', link: '/02.Java软件/04.Java监控诊断/' },
32-
],
31+
{ text: 'Java监控诊断', link: '/02.Java软件/04.Java监控诊断/' }
32+
]
3333
},
3434
{
3535
text: 'Java工具',
@@ -39,8 +39,8 @@ module.exports = {
3939
{ text: 'JavaBean工具', link: '/03.Java工具/02.JavaBean工具/' },
4040
{ text: 'Java模板引擎', link: '/03.Java工具/03.Java模板引擎/' },
4141
{ text: 'Java测试工具', link: '/03.Java工具/04.Java测试工具/' },
42-
{ text: '其他', link: '/03.Java工具/05.其他Java工具/' },
43-
],
42+
{ text: '其他', link: '/03.Java工具/05.其他Java工具/' }
43+
]
4444
},
4545
{ text: 'Java框架', link: '/04.Java框架/' },
4646
{ text: 'Java中间件', link: '/05.Java中间件/' },
@@ -49,9 +49,9 @@ module.exports = {
4949
ariaLabel: 'Java',
5050
items: [
5151
{ text: 'Java 教程 📚', link: 'https://dunwu.github.io/java-tutorial/', target: '_blank' },
52-
{ text: 'JavaCore 教程 📚', link: 'https://dunwu.github.io/javacore/', target: '_blank' },
53-
],
54-
},
52+
{ text: 'JavaCore 教程 📚', link: 'https://dunwu.github.io/javacore/', target: '_blank' }
53+
]
54+
}
5555
],
5656
sidebarDepth: 2, // 侧边栏显示深度,默认1,最大2(显示到h3标题)
5757
logo: 'https://raw.githubusercontent.com/dunwu/images/dev/common/dunwu-logo-200.png', // 导航栏logo
@@ -69,7 +69,7 @@ module.exports = {
6969
// sidebarOpen: false, // 初始状态是否打开侧边栏,默认true
7070
updateBar: {
7171
// 最近更新栏
72-
showToArticle: false, // 显示到文章页底部,默认true
72+
showToArticle: false // 显示到文章页底部,默认true
7373
// moreArticle: '/archives' // “更多文章”跳转的页面,默认'/archives'
7474
},
7575
// titleBadge: false, // 文章标题前的图标是否显示,默认true
@@ -89,12 +89,12 @@ module.exports = {
8989

9090
category: false, // 是否打开分类功能,默认true。 如打开,会做的事情有:1. 自动生成的frontmatter包含分类字段 2.页面中显示与分类相关的信息和模块 3.自动生成分类页面(在@pages文件夹)。如关闭,则反之。
9191
tag: false, // 是否打开标签功能,默认true。 如打开,会做的事情有:1. 自动生成的frontmatter包含标签字段 2.页面中显示与标签相关的信息和模块 3.自动生成标签页面(在@pages文件夹)。如关闭,则反之。
92-
archive: false, // 是否打开归档功能,默认true。 如打开,会做的事情有:1.自动生成归档页面(在@pages文件夹)。如关闭,则反之。
92+
archive: true, // 是否打开归档功能,默认true。 如打开,会做的事情有:1.自动生成归档页面(在@pages文件夹)。如关闭,则反之。
9393

9494
author: {
9595
// 文章默认的作者信息,可在md文件中单独配置此信息 String | {name: String, href: String}
9696
name: 'dunwu', // 必需
97-
href: 'https://github.com/dunwu', // 可选的
97+
href: 'https://github.com/dunwu' // 可选的
9898
},
9999
social: {
100100
// 社交图标,显示于博主信息栏和页脚栏
@@ -103,21 +103,21 @@ module.exports = {
103103
{
104104
iconClass: 'icon-youjian',
105105
title: '发邮件',
106-
link: 'mailto:forbreak@163.com',
106+
link: 'mailto:forbreak@163.com'
107107
},
108108
{
109109
iconClass: 'icon-github',
110110
title: 'GitHub',
111-
link: 'https://github.com/dunwu',
112-
},
113-
],
111+
link: 'https://github.com/dunwu'
112+
}
113+
]
114114
},
115115
footer: {
116116
// 页脚信息
117117
createYear: 2019, // 博客创建年份
118-
copyrightInfo: '钝悟(dunwu) | MIT License', // 博客版权信息,支持a标签
118+
copyrightInfo: '钝悟(dunwu) | MIT License' // 博客版权信息,支持a标签
119119
},
120-
htmlModules,
120+
htmlModules
121121
},
122122

123123
// 插件
@@ -150,8 +150,8 @@ module.exports = {
150150
[
151151
'vuepress-plugin-baidu-tongji', // 百度统计
152152
{
153-
hm: baiduCode || '01293bffa6c3962016c08ba685c79d78',
154-
},
153+
hm: baiduCode || '01293bffa6c3962016c08ba685c79d78'
154+
}
155155
],
156156

157157
[
@@ -161,8 +161,8 @@ module.exports = {
161161
copySelector: ['div[class*="language-"] pre', 'div[class*="aside-code"] aside'], // String or Array
162162
copyMessage: '复制成功', // default is 'Copy successfully and then paste it for use.'
163163
duration: 1000, // prompt message display time.
164-
showInMobile: false, // whether to display on the mobile side, default: false.
165-
},
164+
showInMobile: false // whether to display on the mobile side, default: false.
165+
}
166166
],
167167
[
168168
'demo-block',
@@ -174,35 +174,35 @@ module.exports = {
174174
// vue: 'https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js', // 在线示例中的vue依赖
175175
jsfiddle: false, // 是否显示 jsfiddle 链接
176176
codepen: true, // 是否显示 codepen 链接
177-
horizontal: false, // 是否展示为横向样式
178-
},
179-
},
177+
horizontal: false // 是否展示为横向样式
178+
}
179+
}
180180
],
181181
[
182182
'vuepress-plugin-zooming', // 放大图片
183183
{
184184
selector: '.theme-vdoing-content img:not(.no-zoom)',
185185
options: {
186-
bgColor: 'rgba(0,0,0,0.6)',
187-
},
188-
},
186+
bgColor: 'rgba(0,0,0,0.6)'
187+
}
188+
}
189189
],
190190
[
191191
'@vuepress/last-updated', // "上次更新"时间格式
192192
{
193193
transformer: (timestamp, lang) => {
194194
const dayjs = require('dayjs') // https://day.js.org/
195195
return dayjs(timestamp).format('YYYY/MM/DD, HH:mm:ss')
196-
},
197-
},
198-
],
196+
}
197+
}
198+
]
199199
],
200200

201201
markdown: {
202202
// lineNumbers: true,
203-
extractHeaders: ['h2', 'h3', 'h4', 'h5', 'h6'], // 提取标题到侧边栏的级别,默认['h2', 'h3']
203+
extractHeaders: ['h2', 'h3', 'h4', 'h5', 'h6'] // 提取标题到侧边栏的级别,默认['h2', 'h3']
204204
},
205205

206206
// 监听文件变化并重新构建
207-
extraWatchFiles: ['.vuepress/config.js', '.vuepress/config/htmlModules.js'],
207+
extraWatchFiles: ['.vuepress/config.js', '.vuepress/config/htmlModules.js']
208208
}

prettier.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* @see https://prettier.io/docs/en/options.html
3+
* @see https://prettier.io/docs/en/configuration.html
4+
*/
5+
module.exports = {
6+
tabWidth: 2, semi: false, singleQuote: true
7+
}

scripts/deploy.sh

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@ ROOT_DIR=$(
1515
# 确保脚本抛出遇到的错误
1616
set -e
1717

18-
cd ${ROOT_DIR}
19-
2018
# 生成静态文件
21-
npm install
2219
npm run build
2320

2421
# 进入生成的文件夹
@@ -27,26 +24,19 @@ cd ${ROOT_DIR}/docs/.temp
2724
# 如果是发布到自定义域名
2825
# echo 'www.example.com' > CNAME
2926

30-
git init
31-
git checkout -b gh-pages && git add .
32-
if [[ ${GITHUB_TOKEN} ]]; then
33-
MSG="使用 token 部署 gh-pages"
34-
PUSH_URL="https://dunwu:${GITHUB_TOKEN}@github.com/dunwu/java-tutorial.git"
27+
if [ -z "$GITHUB_TOKEN" ]; then
28+
msg='deploy'
29+
githubUrl=git@github.com:dunwu/java-tutorial.git
3530
else
36-
MSG="github actions 自动化部署 gh-pages"
37-
git config --global user.name "dunwu"
38-
git config --global user.email "forbreak@163.com"
39-
PUSH_URL=git@github.com:dunwu/java-tutorial.git
31+
msg='来自github actions的自动部署'
32+
githubUrl=https://dunwu:${GITHUB_TOKEN}@github.com/dunwu/java-tutorial.git
33+
git config --global user.name "dunwu"
34+
git config --global user.email "forbreak@163.com"
4035
fi
41-
git commit -m ${MSG}
42-
git push --force --quiet ${PUSH_URL} gh-pages
43-
44-
#if [[ ${GITEE_TOKEN} ]]; then
45-
# echo "使用 token 公钥部署 gh-pages"
46-
# git push --force --quiet "https://turnon:${GITEE_TOKEN}@gitee.com/turnon/java-tutorial.git" gh-pages
47-
#else
48-
# echo "使用 ssh 公钥部署 gh-pages"
49-
# git push -f git@gitee.com:turnon/java-tutorial.git gh-pages
50-
#fi
51-
52-
cd ${ROOT_DIR}
36+
git init
37+
git add -A
38+
git commit -m "${msg}"
39+
git push -f "${githubUrl}" master:gh-pages # 推送到github gh-pages分支
40+
41+
cd -
42+
rm -rf ${ROOT_DIR}/docs/.temp

0 commit comments

Comments
 (0)