Skip to content

Commit

Permalink
VuePress Theme Hope
Browse files Browse the repository at this point in the history
使用 Hope 主题重构指南
  • Loading branch information
XTsat committed Nov 4, 2023
1 parent 75e6abe commit 8e90542
Show file tree
Hide file tree
Showing 83 changed files with 6,157 additions and 1,715 deletions.
40 changes: 17 additions & 23 deletions .github/workflows/VuePress.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: docs

on:
# 每当 push 到 Guide 分支时触发部署
# 每当 push 到 VuePress 分支时触发部署
push:
branches: [VuePress]
branches: [vp-hope]
# 手动触发部署
workflow_dispatch:

Expand All @@ -12,36 +12,30 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v1
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
# 选择要使用的 node 版本
node-version: '16'
# 选择要使用的 pnpm 版本
version: 7
# 使用 pnpm 安装依赖
run_install: true

# 缓存 node_modules
- name: Cache dependencies
uses: actions/cache@v2
id: yarn-cache
- name: Setup Node.js
uses: actions/setup-node@v3
with:
path: |
**/node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# 如果缓存没有命中,安装依赖
- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn --frozen-lockfile
# 选择要使用的 node 版本
node-version: 18
# 缓存 pnpm 依赖
cache: pnpm

# 运行构建脚本
- name: Build VuePress site
run: yarn docs:build
run: pnpm docs:build

# 查看 workflow 的文档来获取更多信息
# @see https://github.com/crazy-max/ghaction-github-pages
Expand All @@ -54,4 +48,4 @@ jobs:
build_dir: docs/.vuepress/dist
env:
# @see https://docs.github.com/cn/actions/reference/authentication-in-a-workflow#about-the-github_token-secret
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

欢迎访问 Steam++ 指南,你可以在这里找到 Steam++ 工具箱的使用帮助

文档还在制作过程中,你可以提出更多的文档内容
文档正在制作3.0版本,以更新到来的watt toolkit 3.0版本

详细指南请前往文档链接:<https://xtsat.github.io/SteamTools-Guide/>

Expand Down
78 changes: 0 additions & 78 deletions docs/.vuepress/config.js.bak

This file was deleted.

162 changes: 61 additions & 101 deletions docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { defineUserConfig } from 'vuepress'
import { navbar, sidebar } from './configs'

const { defaultTheme } = require('@vuepress/theme-default')
import { redirectPlugin } from "vuepress-plugin-redirect";

const { searchPlugin } = require('@vuepress/plugin-search')
import theme from "./theme.ts";

// const isProd = process.env.NODE_ENV === 'production'
// const { searchPlugin } = require('@vuepress/plugin-search')

export default defineUserConfig({
base: '/SteamTools-Guide/',
Expand Down Expand Up @@ -52,9 +51,8 @@ export default defineUserConfig({
// ['meta', { name: 'theme-color', content: '#3eaf7c' }],
],

// site-level locales config
locales: {
'/': {
'/zh/': {
lang: '简体中文',
title: 'Watt Toolkit 指南',
description: '「Watt Toolkit」是一个开源跨平台的多功能 Steam 工具箱。',
Expand All @@ -66,98 +64,60 @@ export default defineUserConfig({
},
},

theme: defaultTheme({
// 在这里进行配置
logo: '/logo/Steam++ico.svg',

repo: 'XTsat/SteamTools-Guide',

docsBranch: 'VuePress',
docsDir: 'docs',

// theme-level locales config
locales: {

'/en/': {
// navbar
navbar: navbar.en,
selectLanguageName: 'English',
selectLanguageText: '选择语言',
selectLanguageAriaLabel: '选择语言',

// sidebar
sidebar: sidebar.en,

// page meta
editLinkText: 'Edit this page on GitHub',
},

'/': {
// navbar
navbar: navbar.zh,
selectLanguageName: '简体中文',
selectLanguageText: 'language',
selectLanguageAriaLabel: 'language',

repoLabel: 'GitHub文档',

// sidebar
sidebar: sidebar.zh,

// page meta
editLinkText: '在 GitHub 上编辑此页',
lastUpdatedText: '最后更新时间',
contributorsText: '编辑人',

// custom containers
tip: '提示',
warning: '注意',
danger: '警告',

// 404 page
notFound: [
'找不到该页面',
'这里什么都没有',
'我们怎么到这来了?',
'这是一个 404 页面',
'看起来我们进入了错误的链接',
],
backToHome: '返回首页',

// a11y
openInNewWindow: '在新窗口打开',
toggleDarkMode: '切换夜间模式',
toggleSidebar: '切换侧边栏',
},
},
theme,

// theme: defaultTheme({
// // 在这里进行配置
// logo: '/logo/Steam++ico.svg',

// repo: 'XTsat/SteamTools-Guide',

// themePlugins: {
// // only enable git plugin in production mode
// git: isProd,
// // use shiki plugin in production mode instead
// prismjs: !isProd,
// },
}),
// docsBranch: 'VuePress',
// docsDir: 'docs',

// locales: {
// '/zh/': {
// lang: '简体中文',
// title: 'Watt Toolkit 指南',
// description: '「Watt Toolkit」是一个开源跨平台的多功能 Steam 工具箱。',
// },
// '/en/': {
// lang: 'English',
// title: 'Watt Toolkit Guide',
// description: 'Watt Toolkit" is an open source cross-platform multi-purpose game toolkit',
// },
// },

// }),

plugins: [
searchPlugin({
// 配置项
locales: {
'/en/': {
placeholder: 'Search',
hotKeys: ['/']
},
'/': {
placeholder: '搜索文档',
hotKeys: ['/']
}
// searchPlugin({
// // 配置项
// locales: {
// '/en/': {
// placeholder: 'Search',
// hotKeys: ['/']
// },
// '/': {
// placeholder: '搜索文档',
// hotKeys: ['/']
// }
// },
// }),
redirectPlugin({
defaultLocale: "/zh/",
autoLocale: true,
switchLocale: "modal",
localeConfig: {
"/en/": ["en-US", "en-UK", "en"],
"/zh/": ["zh-CN", "zh-TW", "zh"],
},
}),

],

// 旧的插件配置方式暂时保留注释

// plugins: [
// [
// searchPlugin({
Expand All @@ -173,19 +133,19 @@ export default defineUserConfig({
// },
// }),
// ],
// [
// "vuepress-plugin-auto-sidebar",
// {
// title: {
// // 更多选项:
// // `default`、`lowercase`、`uppercase`、`capitalize`、`camelcase`、`kebabcase`、`titlecase`
// mode: "titlecase"
// },
// removeEmptyGroup: true,
// }
// ],
// [
// "vuepress-plugin-auto-sidebar",
// {
// title: {
// // 更多选项:
// // `default`、`lowercase`、`uppercase`、`capitalize`、`camelcase`、`kebabcase`、`titlecase`
// mode: "titlecase"
// },
// removeEmptyGroup: true,
// }
// ],

// ['vuepress-plugin-auto-sidebar', false] // disabled.
// ['vuepress-plugin-auto-sidebar', false] // disabled.
// ],
}
)
7 changes: 4 additions & 3 deletions docs/.vuepress/configs/navbar/en.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { NavbarConfig } from '@vuepress/theme-default'
import { navbar } from "vuepress-theme-hope";

export const en: NavbarConfig = [
export const enNavbar = navbar([
"/en/",
{
text: 'HOME',
link: '/en/'
Expand Down Expand Up @@ -228,4 +229,4 @@ export const en: NavbarConfig = [
},
]
},
]
]);
7 changes: 4 additions & 3 deletions docs/.vuepress/configs/navbar/zh.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { NavbarConfig } from '@vuepress/theme-default'
import { navbar } from "vuepress-theme-hope";

export const zh: NavbarConfig = [
export const zhNavbar = navbar([
"/zh/",
{
text: '主页',
link: '/'
Expand All @@ -25,4 +26,4 @@ export const zh: NavbarConfig = [
text: '关于我',
link: '/关于我.md',
},
]
]);

0 comments on commit 8e90542

Please sign in to comment.