1
0
mirror of https://github.com/142vip/408CSFamily.git synced 2026-04-05 11:38:27 +08:00

feat: 修改侧边栏结构,优化镜像构建脚本

- 新增docker快速打包脚本
- 主题内容优化
This commit is contained in:
妹妹下雨回不去
2023-02-07 23:13:50 +08:00
parent 34f9eb419c
commit be28c0ff83
15 changed files with 390 additions and 529 deletions

View File

@@ -1,24 +1,22 @@
#
# - 功能: 408CSFamily镜像构建
# - 用法: docker build -f Dockerfile --build-arg APP_VERSION=0.0.1 -t 408CSFamily-0.0.1 .
#
## 注意vite构建需要支持node14以上安装node16较为稳妥
FROM registry.cn-hangzhou.aliyuncs.com/142vip/node:16.12.0-alpine AS build_base
LABEL version="Beta1.0" description="408CSFamily合集"
LABEL author="【Github&公众号】Rong姐姐好可爱" email="fairy@2925.com"
RUN mkdir -p /apps
WORKDIR /apps
COPY . .
## 安装依赖
RUN npm i pnpm@6 -g && pnpm i -D && pnpm build
FROM registry.cn-hangzhou.aliyuncs.com/142vip/nginx:1.23.0-alpine
ARG APP_VERSION
LABEL version=$APP_VERSION description="408CSFamily合集"
LABEL author="【Github&公众号】Rong姐姐好可爱" email="fairy_408@2925.com"
# 将dist文件中的内容复制到 /usr/share/nginx/html/ 这个目录下面 注意:--from参数
COPY --from=build_base /apps/docs/.vuepress/dist/ /usr/share/nginx/html/
COPY nginx.conf /etc/nginx/
#EXPOSE 7000
#CMD ["nginx", "-g", "daemon off;"]

14
Faster.Dockerfile Normal file
View File

@@ -0,0 +1,14 @@
#
# - 功能: 快速构建408CSFamily镜像
# - 用法: docker build -f Faster.Dockerfile --build-arg APP_VERSION=0.0.1 -t 408CSFamily-0.0.1 .
#
FROM registry.cn-hangzhou.aliyuncs.com/142vip/nginx:1.23.0-alpine
ARG APP_VERSION
LABEL version=$APP_VERSION description="408CSFamily合集"
LABEL author="【Github&公众号】Rong姐姐好可爱" email="fairy_408@2925.com"
# 将dist文件中的内容复制到 /usr/share/nginx/html/
COPY ./docs/.vuepress/dist/ /usr/share/nginx/html/
COPY nginx.conf /etc/nginx/

View File

@@ -1,7 +1,5 @@
import { hopeTheme } from "vuepress-theme-hope";
import navbar from "./config/navbar";
import sidebar from "./config/sidebar";
import {searchProPlugin} from "vuepress-plugin-search-pro";
import themeConfig from "./config/theme.config";
import pluginsConfig from "./config/plugins.config";
export default {
title: "计算机应试全家桶",
@@ -10,11 +8,11 @@ export default {
port: 4200,
head: [
[
"link", { rel: "icon", href: "/408_favicon.ico" }
"link", {rel: "icon", href: "/408_favicon.ico"}
],
[
// 百度统计
'script',{},`
// 百度统计
'script', {}, `
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
@@ -24,88 +22,6 @@ export default {
})();`
]
],
// 参考主题https://theme-hope.vuejs.press/zh/config/intro.html#%E9%85%8D%E7%BD%AE%E6%A6%82%E5%BF%B5
theme: hopeTheme({
darkmode:"toggle",
// 支持全屏
fullscreen: true,
// 纯净模式
// pure: true,
hostname:'https://408.142vip.cn',
author:{
name:'ChuFan',
email:'fairy_408@2925.com',
url:'https://www.142vip.cn'
},
favicon:"/408_favicon.ico",
logo: "/assets/408_logo.png",
navbar: navbar,
// 导航栏布局
navbarLayout:{
start: ["Brand"],
center: ["Links"],
end: ["Language","Search","Repo", "Outlook", ]
},
sidebar: sidebar,
// sidebar: "heading",
// 主题布局选项
repo: "https://github.com/mmdapl/408CSFamily",
logoDark:"/assets/408_logo.png",
// 博客配置
blog:{
name:'测试',
avatar:'',
description:'',
intro:'',
roundAvatar:true,
timeline:"时间轴的顶部文字",
articleInfo:"",
medias:{
"BiliBili": "https://space.bilibili.com/350937042?spm_id_from=333.1007.0.0"
}
},
lastUpdated: true,
lastUpdatedText: "最近更新",
contributorsText: '贡献者',
notFound: ['宝贝不要急,我努力更新就会慢慢有的哟...想要什么,也欢迎微信后台私信!'],// 自定义404页面提示语数组
backToHome: '返回首页', // 返回首页
sidebarDepth: 1,
editLink: false,
// 默认为 "Edit this page"
// editLinkText: '帮助我们改善此页面!',
search: true,
searchMaxSuggestions: 10,
plugins: {
// 开启博客功能
blog:true,
// 代码块
mdEnhance: {
codetabs: true,
},
copyCode: {
showInMobile:true
},
},
}),
// 插件配置
plugins: [
searchProPlugin({
// 索引全部内容
indexContent: true,
// 为分类和标签添加索引
customFields: [
{
getter: (page) => page.frontmatter.category,
formatter: "分类:$content",
},
{
getter: (page) => page.frontmatter.tag,
formatter: "标签:$content",
},
],
}),
],
};
theme: themeConfig,
plugins: pluginsConfig
}

View File

@@ -0,0 +1,5 @@
export const FOOTER_HTML_INFO=`
<a href="https://tongji.baidu.com/web/welcome/login" target="_blank">百度统计</a> Copyrights © 2015-${new Date().getFullYear()} 妍荣姑娘网络工作室
| <a href="https://github.com/mmdapl" target="_blank">储凡</a>
`

View File

@@ -1,4 +1,3 @@
// 参考https://theme-hope.vuejs.press/zh/guide/layout/navbar.html#%E5%AD%97%E7%AC%A6%E4%B8%B2%E6%A0%BC%E5%BC%8F
export default [
{
text: '主页',

View File

@@ -0,0 +1,19 @@
import {searchProPlugin} from "vuepress-plugin-search-pro";
export default [
searchProPlugin({
// 索引全部内容
indexContent: true,
// 为分类和标签添加索引
customFields: [
{
getter: (page) => page.frontmatter.category,
formatter: "分类:$content",
},
{
getter: (page) => page.frontmatter.tag,
formatter: "标签:$content",
},
],
}),
]

View File

@@ -1,3 +1,2 @@
export default[
]

View File

@@ -0,0 +1,80 @@
import {hopeTheme} from "vuepress-theme-hope";
import navbar from "./navbar";
import sidebar from "./sidebar";
import {FOOTER_HTML_INFO} from "./constant";
/**
* hope主题配置
* 参考https://theme-hope.vuejs.press/zh/config/
*/
export default hopeTheme({
darkmode:"toggle",
// 支持全屏
// fullscreen: true,
// 纯净模式
// pure: true,
hostname:'https://408.142vip.cn',
author:{
name:'ChuFan',
email:'fairy_408@2925.com',
url:'https://www.142vip.cn'
},
favicon:"/408_favicon.ico",
logo: "/assets/408_logo.png",
navbar: navbar,
// 导航栏布局
navbarLayout:{
start: ["Brand"],
center: ["Links"],
end: ["Language","Search","Repo", "Outlook", ]
},
sidebar: sidebar,
// sidebar: "heading",
// 主题布局选项
repo: "https://github.com/mmdapl/408CSFamily",
logoDark:"/assets/408_logo.png",
// 博客配置
blog:{
name:'测试',
avatar:'',
description:'',
intro:'',
roundAvatar:true,
timeline:"时间轴的顶部文字",
articleInfo:"",
medias:{
"BiliBili": "https://space.bilibili.com/350937042?spm_id_from=333.1007.0.0"
}
},
// 设置页脚
displayFooter:true,
footer:FOOTER_HTML_INFO,
copyright:false,
// 主题色选择器
themeColor: {
blue: "#2196f3",
red: "#f26d6d",
green: "#3eaf7c",
orange: "#fb9b5f",
},
plugins: {
copyright:false,
// 开启博客功能
blog:true,
// 代码块
mdEnhance: {
codetabs: true,
},
copyCode: {
showInMobile:true
},
feed: {
json: true,
},
},
})

View File

@@ -0,0 +1,7 @@
// 参考https://theme-hope.vuejs.press/zh/guide/interface/code-theme.htm
// 浅色主题
$code-light-them:"vs";
// 深色主题
$code-dark-theme:"atom-dark";

View File

@@ -0,0 +1,2 @@
// 主题色
$theme-color: #2196f3;

View File

@@ -1,10 +1,7 @@
---
home: true
heroImage: http://vuejs.org/images/logo.png
heroImageDark: http://vuejs.org/images/logo.png
heroText: 计算机应试全家桶
externalLinkIcon: false
tagline: 磨刀不误砍柴工、读完硕士再打工,笔记内容持续更新...
tagline: 磨刀不误砍柴工、读完硕士再打工...
actions:
- text: 快速开始→
link: /guide/
@@ -19,6 +16,7 @@ features:
details: 官方插件的基础上抽象、封装出适合自己功能的plus插件能够快速集成、使用在新的项目中。
- title: 反复反复
details: 通过以项目Demo示例的方式对框架常用的功能进行Code编写和整理提供有效且易用的代码封装。
footerColumn: 3
footerWrap:
- headline: 相关资料
@@ -69,7 +67,6 @@ footerWrap:
link: https://space.bilibili.com/350937042
details: 不定期更新
footer: <a href="https://tongji.baidu.com/web/welcome/login" target="_blank">百度统计</a> Copyrights © 2015-2021 妍荣姑娘网络工作室 | <a href="https://github.com/mmdapl" target="_blank">储凡</a>
---

View File

@@ -6,7 +6,8 @@
"scripts": {
"dev": "vuepress dev docs",
"build": "vuepress build docs",
"build-image": "bash scripts/build_image.sh $npm_package_version",
"image": "bash scripts/build_image.sh $npm_package_version",
"faster-image": "bash scripts/build_image.sh $npm_package_version faster",
"ali": "bash scripts/deploy.sh ali $npm_package_version",
"github": "bash scripts/page_deploy.sh",
"clean": "find . -name \"node_modules\" -type d -exec rm -rf '{}' +"
@@ -17,11 +18,11 @@
"url": "https://github.com/142vip"
},
"devDependencies": {
"vue": "^3.2.45",
"@vuepress/client": "2.0.0-beta.60",
"vue": "^3.2.47",
"vuepress": "2.0.0-beta.60",
"vuepress-plugin-search-pro": "^2.0.0-beta.172",
"vuepress-theme-hope": "^2.0.0-beta.171",
"@vuepress/client": "2.0.0-beta.60"
"vuepress-theme-hope": "^2.0.0-beta.172"
},
"license": "MIT"
}

630
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +1,11 @@
#!/bin/bash
## 功能本地前后端项目构建、打包镜像上传docker仓库
## 参考https://blog.csdn.net/Dontla/article/details/125210694
## 使用示例bash xxx.sh 版本号 faster[可选]
## - bash build_image.sh 0.0.1 faster
## 作者:储凡
## 使用示例bash xxx.sh 版本号
## - bash build_image.sh 0.0.1
##
## 日志颜色定义
readonly successLogger="\033[36m"
readonly errorLogger="\033[1;31m"
@@ -16,12 +15,13 @@ readonly currentTime=$(date "+%Y-%m-%d %H:%M:%S")
## 项目名称
readonly projectName="408CSFamily"
## 仓库地址
readonly repoAddress="registry.cn-hangzhou.aliyuncs.com/142vip/doc_book:"
readonly repoAddress="registry.cn-hangzhou.aliyuncs.com/142vip/doc_book"
## 版本号
version=${1}
## 是否先本地构建执行npm run build操作
isFaster=${2}
## 镜像名称
imageTagName=${repoAddress}${projectName}-${version}
imageTagName=${repoAddress}:${projectName}-${version}
prepare_check(){
@@ -33,7 +33,15 @@ prepare_check(){
run(){
echo -e "${successLogger}---------------- shell ${projectName} start ---------------- "
docker build -t "${imageTagName}" .
if [ "${isFaster}" == "faster" ];then
## 本地构建、快速制作镜像
npm run build && docker build -f Faster.Dockerfile --build-arg APP_VERSION="${version}" -t "${imageTagName}" .
else
## ci流程构建
docker build -f Dockerfile --build-arg APP_VERSION="${version}" -t "${imageTagName}" .
fi
echo -e "${successLogger}---------------- shell ${projectName} end ---------------- "
push_docker_image
}