Skip to content

Commit 2a18a3d

Browse files
authored
Merge pull request #23 from stick-i/docs
feat: 添加基于 VuePress 的文档模板,以及自动部署到 GitHub Page 的配置文件
2 parents 87b0fbf + 9078721 commit 2a18a3d

File tree

7 files changed

+132
-2
lines changed

7 files changed

+132
-2
lines changed

.github/workflows/deploy-docs.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: 部署文档
2+
3+
on:
4+
push:
5+
branches:
6+
# 确保这是你正在使用的分支名称
7+
- docs
8+
# 手动触发部署
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
deploy-gh-pages:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
# 如果你文档需要 Git 子模块,取消注释下一行
24+
# submodules: true
25+
26+
- name: 安装 pnpm
27+
uses: pnpm/action-setup@v2
28+
with:
29+
# 选择要使用的 pnpm 版本
30+
version: 8
31+
# 使用 pnpm 安装依赖
32+
run_install: true
33+
34+
- name: 设置 Node.js
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: 20
38+
cache: pnpm
39+
cache-dependency-path: document/web-docs/package.json
40+
41+
- name: 构建文档
42+
env:
43+
NODE_OPTIONS: --max_old_space_size=8192
44+
run: |-
45+
cd document/web-docs
46+
pnpm run docs:build
47+
> docs/.vuepress/dist/.nojekyll
48+
49+
- name: 部署文档
50+
uses: JamesIves/github-pages-deploy-action@v4
51+
with:
52+
# 这是文档部署到的分支名称
53+
branch: gh-pages
54+
folder: document/web-docs/docs/.vuepress/dist

.gitignore

+8-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,11 @@ build/
3232
.vscode/
3333

3434
### Mac OS ###
35-
.DS_Store
35+
.DS_Store
36+
37+
### vuepress ###
38+
/document/web-docs/node_modules/
39+
/document/web-docs/docs/.vuepress/.cache/
40+
/document/web-docs/docs/.vuepress/.temp/
41+
/document/web-docs/pnpm-lock.yaml
42+
/document/web-docs/docs/.vuepress/dist/

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,8 @@ https://github.com/stick-i/spel-validator/releases
316316

317317
- `main`:主分支,已发布的最新版本代码将合入此分支。
318318
- `docs`:文档分支,修改文档的内容将提交到这里。
319-
- `vX.Y.Z`:版本分支,用于开发新版本,已经发布的版本会将分支删除。
319+
- `vX.Y.Z`:版本分支,用于汇总及验证新版本的功能,已经发布的版本会将分支删除。
320+
- `dev-xxx`:开发分支,用于开发新功能,每个dev分支都应当对应一个issue,功能开发完成后通过PR合入 `vX.Y.Z` 分支,并删除当前分支。
320321

321322
## 💰 捐赠支持
322323

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import {defaultTheme} from '@vuepress/theme-default'
2+
import {defineUserConfig} from 'vuepress/cli'
3+
import {viteBundler} from '@vuepress/bundler-vite'
4+
5+
export default defineUserConfig({
6+
lang: 'zh-CN',
7+
8+
title: 'SpEL Validator',
9+
description: '一个强大的 Java 参数校验包,基于 SpEL 实现,扩展自 javax.validation 包,几乎支持所有场景下的参数校验。',
10+
11+
theme: defaultTheme({
12+
logo: 'https://vuejs.press/images/hero.png',
13+
navbar: ['/', '/get-started'],
14+
}),
15+
16+
bundler: viteBundler(),
17+
})

document/web-docs/docs/README.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
home: true
3+
title: Home
4+
heroImage: https://vuejs.press/images/hero.png
5+
actions:
6+
- text: 快速开始
7+
link: /get-started.html
8+
type: primary
9+
10+
- text: 项目介绍
11+
link: https://vuejs.press/guide/introduction.html
12+
type: secondary
13+
14+
features:
15+
- title: 易上手
16+
details: 设计直观,简单易用,与 javax.validation 使用方式高度相似,学习成本低,上手快。
17+
- title: 极致灵活
18+
details: 利用 SpEL(Spring Expression Language)的强大功能,轻松实现复杂验证逻辑,且能够直接调用已注入的 Spring Beans 进行验证。
19+
- title: 无缝集成
20+
details: 扩展自 javax.validation 包,只新增不修改,无缝集成到现有项目中。
21+
- title: 上下文感知
22+
details: 能够在整个对象的上下文中进行验证,支持跨字段的逻辑验证,提高数据完整性检查的效率和准确性。
23+
- title: 异常友好
24+
details: 验证失败时自动整合进 javax.validation 的异常管理体系,简化错误处理流程。
25+
- title: 完全可定制
26+
details: 支持创建自定义约束注解,允许根据具体业务需求灵活定义验证规则。
27+
28+
footer: Apache-2.0 license | 版权所有 © 2024-至今 阿杆
29+
---
30+
31+
[default-theme-home]: https://vuejs.press/reference/default-theme/frontmatter.html#home-page

document/web-docs/docs/get-started.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Test

document/web-docs/package.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "spel-validator",
3+
"version": "0.0.1",
4+
"description": "一个强大的 Java 参数校验包,基于 SpEL 实现,扩展自 javax.validation 包,几乎支持所有场景下的参数校验。",
5+
"license": "Apache-2.0",
6+
"type": "module",
7+
"scripts": {
8+
"docs:build": "vuepress build docs",
9+
"docs:clean-dev": "vuepress dev docs --clean-cache",
10+
"docs:dev": "vuepress dev docs",
11+
"docs:update-package": "pnpm dlx vp-update"
12+
},
13+
"devDependencies": {
14+
"@vuepress/bundler-vite": "^2.0.0-rc.7",
15+
"@vuepress/theme-default": "^2.0.0-rc.11",
16+
"vue": "^3.4.38",
17+
"vuepress": "2.0.0-rc.15"
18+
}
19+
}

0 commit comments

Comments
 (0)