Skip to content

Commit

Permalink
feat(doc): Use VitePress instead of Vuepress
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahoo-Wang committed Jan 2, 2024
1 parent dd0cc77 commit 88f84bf
Show file tree
Hide file tree
Showing 40 changed files with 692 additions and 179 deletions.
64 changes: 45 additions & 19 deletions .github/workflows/document-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,61 @@
# limitations under the License.
#

name: Document Build and Deploy
name: Documentation Build and Deploy
on:
push:
paths:
- 'document/**'
- 'documentation/**'
pull_request:
paths:
- 'documentation/**'
workflow_dispatch:
permissions:
contents: write

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master

- name: Build and Deploy
uses: jenkey2011/vuepress-deploy@master
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18

- name: Build VitePress site
working-directory: documentation
run: npm add -D vitepress && npm run docs:build

- name: Deploy to gh-pages
uses: crazy-max/ghaction-github-pages@v4
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
TARGET_REPO: Ahoo-Wang/CosId
TARGET_BRANCH: gh-pages
BUILD_SCRIPT: cd document && yarn && yarn docs:build
BUILD_DIR: docs/.vuepress/dist/
CNAME: cosid.ahoo.me

- name: Build and Deploy With Site Base
uses: jenkey2011/vuepress-deploy@master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
target_branch: gh-pages
build_dir: documentation/docs/.vitepress/dist/
fqdn: cosid.ahoo.me

- name: Build VitePress site with SITE_BASE
working-directory: documentation
env:
SITE_BASE: /cosid/
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
TARGET_REPO: Ahoo-Wang/CosId
TARGET_BRANCH: gh-pages-with-site-base
BUILD_SCRIPT: cd document && yarn && yarn docs:build
BUILD_DIR: docs/.vuepress/dist/
CNAME: cosid.ahoo.me
run: npm add -D vitepress && npm run docs:build

- name: Deploy to gh-pages-with-site-base
uses: crazy-max/ghaction-github-pages@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
target_branch: gh-pages-with-site-base
build_dir: documentation/docs/.vitepress/dist/

- name: Sync to Gitee
uses: wearerequired/git-mirror-action@master
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
with:
source-repo: "git@github.com:Ahoo-Wang/CosId.git"
destination-repo: "git@gitee.com:AhooWang/CosId.git"
2 changes: 1 addition & 1 deletion document/docs/guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ UUID最大的缺陷是随机的、无序的,当用于主键时会导致数据
- ZookeeperMachineIdDistributor: 使用**ZooKeeper**作为机器号的分发存储,同时还会存储`MachineId`的上一次时间戳,用于**启动时时钟回拨**的检查。

<p align="center" >
<img :src="$withBase('/assets/design/RedisMachineIdDistributor.png')" alt="RedisMachineIdDistributor"/>
<img :src="$withBase('/assets/design/MachineIdDistributor.png')" alt="RedisMachineIdDistributor"/>
</p>

<p align="center">
Expand Down
2 changes: 1 addition & 1 deletion document/docs/guide/cosid-redis.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
## SpringRedisMachineIdDistributor

<p align="center" >
<img :src="$withBase('/assets/design/RedisMachineIdDistributor.png')" alt="SegmentId"/>
<img :src="$withBase('/assets/design/MachineIdDistributor.png')" alt="SegmentId"/>
</p>

<p align="center">
Expand Down
5 changes: 4 additions & 1 deletion documentation/docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import {SITE_BASE} from "./configs/SITE_BASE";
import {head} from "./configs/head";
import {navbar} from "./configs/navbar";
import {sidebar} from "./configs/sidebar";
import {withMermaid} from "vitepress-plugin-mermaid";

let hostname = 'https://cosid.ahoo.me/';
if (SITE_BASE == '/wow/') {
hostname = 'https://ahoowang.gitee.io/cosid/'
}

// https://vitepress.dev/reference/site-config
export default defineConfig({
let userConfig = defineConfig({
lang: 'zh-CN',
title: "CosId",
description: "通用、灵活、高性能的分布式ID生成器",
Expand Down Expand Up @@ -54,3 +55,5 @@ export default defineConfig({
}
}
})

export default withMermaid(userConfig)
1 change: 0 additions & 1 deletion documentation/docs/.vitepress/configs/head.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const head: HeadConfig[] = [
['meta', {'http-equiv': 'cache-control', content: 'no-cache, no-store, must-revalidate'}],
['meta', {'http-equiv': 'pragma', content: 'no-cache'}],
['meta', {'http-equiv': 'expires', content: '0'}],
['link', {rel: 'manifest', href: `${SITE_BASE}manifest.webmanifest`}],
['meta', {name: 'application-name', content: 'CosId'}],
['meta', {name: 'theme-color', content: '#5f67ee'}],
[
Expand Down
65 changes: 45 additions & 20 deletions documentation/docs/.vitepress/configs/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ export const sidebar: DefaultTheme.Sidebar = {
items: [
{text: '简介', link: 'introduction'},
{text: '快速上手', link: 'getting-started'},
{text: '号段链模式', link: 'segment-chain'},
{text: 'Faq', link: 'faq'},
{text: '性能评测', link: 'perf-test'},
{text: 'CosId VS 美团 Leaf', link: 'Performance-CosId-Leaf'},
{text: 'SnowflakeId', link: 'snowflake'},
{text: 'SegmentId', link: 'segment'},
{text: 'SegmentChainId', link: 'segment-chain'},
{text: 'CosIdGenerator', link: 'cosid-generator'},
{text: 'CosIdProxy', link: 'cosid-proxy'},
],
}, {
base: '/guide/extensions/',
Expand All @@ -34,12 +35,36 @@ export const sidebar: DefaultTheme.Sidebar = {
items: [
{text: 'Redis', link: 'cosid-redis'},
{text: 'Jdbc', link: 'cosid-jdbc'},
{text: 'MongoDB', link: 'cosid-mongo'},
{text: 'Zookeeper', link: 'cosid-zookeeper'},
{text: 'MyBatis', link: 'cosid-mybatis'},
{text: 'Jackson', link: 'cosid-jackson'},
{text: 'ShardingSphere', link: 'cosid-shardingsphere'},
{text: 'Axon', link: 'cosid-axon'},
{text: 'Spring-Data-Jdbc', link: 'cosid-spring-data-jdbc'},
{text: 'Spring-Boot-Starter', link: 'cosid-spring-boot-starter'},
{text: 'Activiti', link: 'cosid-activiti'},
{text: 'Flowable', link: 'cosid-flowable'},
{text: 'Axon', link: 'cosid-axon'},
{text: 'ShardingSphere', link: 'cosid-shardingsphere'},
{text: '兼容性测试套件', link: 'cosid-test'},
],
}, {
base: '/guide/faq/',
text: 'FAQ',
collapsed: false,
items: [
{text: '常见问题', link: 'faq'},
{text: '性能评测', link: 'perf-test'},
{text: 'CosId VS 美团 Leaf', link: 'Performance-CosId-Leaf'},
],
}, {
base: '/guide/advanced/',
text: '深入',
collapsed: false,
items: [
{text: 'IdGenerator', link: 'id-generator'},
{text: 'IdConverter', link: 'id-converter'},
{text: 'IdGeneratorProvider', link: 'provider'},
{text: 'Sharding', link: 'sharding'},
],
}, {
text: '配置',
Expand All @@ -60,20 +85,20 @@ export const sidebar: DefaultTheme.Sidebar = {
{text: 'ShardingSphere', link: 'shardingsphere'},
],
},
{
text: 'API',
base: '/reference/api/',
collapsed: false,
items: [
{text: 'IdGenerator', link: 'id-generator'},
{text: 'IdConverter', link: 'id-converter'},
{text: 'IdGeneratorProvider', link: 'provider'},
{text: 'CosIdGenerator', link: 'cosid-generator'},
{text: 'Segment', link: 'segment'},
{text: 'SnowflakeId', link: 'snowflake'},
{text: 'Sharding', link: 'sharding'},
],
},
// {
// text: 'API',
// base: '/reference/api/',
// collapsed: false,
// items: [
// {text: 'IdGenerator', link: 'id-generator'},
// {text: 'IdConverter', link: 'id-converter'},
// {text: 'IdGeneratorProvider', link: 'provider'},
// {text: 'CosIdGenerator', link: 'cosid-generator'},
// {text: 'Segment', link: 'segment'},
// {text: 'SnowflakeId', link: 'snowflake'},
// {text: 'Sharding', link: 'sharding'},
// ],
// },
{
text: '博客',
base: '/reference/blog/',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public interface IdConverter {

> 雪花Id转换器,将符合雪花规则的字符串,转换成 long ,或者long 转换成雪花规则字符串

## PrefixIdConverter

> 将带有前缀的字符串转换成long,或者将long转换成带前缀字符串
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

## 设计
<p align="center">
<img src="../../public/assets/design/CosIdGenerator.png" alt="IdGenerator design diagram"/>
<img src="../public/assets/design/CosIdGenerator.png" alt="IdGenerator design diagram"/>
</p>

## Radix36CosIdGenerator
Expand Down
1 change: 1 addition & 0 deletions documentation/docs/guide/cosid-proxy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# CosId Proxy 模块
19 changes: 19 additions & 0 deletions documentation/docs/guide/extensions/cosid-activiti.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# CosId-Activiti 模块

## 安装

::: code-group
```kotlin [Gradle(Kotlin)]
val cosidVersion = "latestVersion"
implementation("me.ahoo.cosid:cosid-activiti:${cosidVersion}")
```
```xml [Maven]
<dependencies>
<dependency>
<groupId>me.ahoo.cosid</groupId>
<artifactId>cosid-activiti</artifactId>
<version>${cosid.version}</version>
</dependency>
</dependencies>
```
:::
18 changes: 17 additions & 1 deletion documentation/docs/guide/extensions/cosid-axon.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# CosId-Axon 模块

TODO
## 安装

::: code-group
```kotlin [Gradle(Kotlin)]
val cosidVersion = "latestVersion"
implementation("me.ahoo.cosid:cosid-axon:${cosidVersion}")
```
```xml [Maven]
<dependencies>
<dependency>
<groupId>me.ahoo.cosid</groupId>
<artifactId>cosid-axon</artifactId>
<version>${cosid.version}</version>
</dependency>
</dependencies>
```
:::
18 changes: 17 additions & 1 deletion documentation/docs/guide/extensions/cosid-flowable.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# CosId-Flowable 模块

TODO
## 安装

::: code-group
```kotlin [Gradle(Kotlin)]
val cosidVersion = "latestVersion"
implementation("me.ahoo.cosid:cosid-flowable:${cosidVersion}")
```
```xml [Maven]
<dependencies>
<dependency>
<groupId>me.ahoo.cosid</groupId>
<artifactId>cosid-flowable</artifactId>
<version>${cosid.version}</version>
</dependency>
</dependencies>
```
:::
18 changes: 14 additions & 4 deletions documentation/docs/guide/extensions/cosid-jackson.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CosId-Jackson 模块

> **Jackson** 序列化/反序列化注解插件,相当于隔离了应用API边界内外的 *ID* 使用方式,应用内部使用 `long`、外部使用 `String`,做到了应用无侵入,无感知。
**Jackson** 序列化/反序列化注解插件,相当于隔离了应用API边界内外的 *ID* 使用方式,应用内部使用 `long`、外部使用 `String`,做到了应用无侵入,无感知。

::: danger JavaScript Number 溢出问题

Expand All @@ -17,11 +17,21 @@

## 安装

> Kotlin DSL
``` kotlin
::: code-group
```kotlin [Gradle(Kotlin)]
val cosidVersion = "latestVersion"
implementation("me.ahoo.cosid:cosid-jackson:${cosidVersion}")
```
```xml [Maven]
<dependencies>
<dependency>
<groupId>me.ahoo.cosid</groupId>
<artifactId>cosid-jackson</artifactId>
<version>${cosid.version}</version>
</dependency>
</dependencies>
```
:::

```java
public class AsStringDto {
Expand Down
16 changes: 13 additions & 3 deletions documentation/docs/guide/extensions/cosid-jdbc.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@

## 安装

> Kotlin DSL
``` kotlin
::: code-group
```kotlin [Gradle(Kotlin)]
val cosidVersion = "latestVersion"
implementation("me.ahoo.cosid:cosid-jdbc:${cosidVersion}")
```
```xml [Maven]
<dependencies>
<dependency>
<groupId>me.ahoo.cosid</groupId>
<artifactId>cosid-jdbc</artifactId>
<version>${cosid.version}</version>
</dependency>
</dependencies>
```
:::

## JdbcIdSegmentDistributor

Expand Down
19 changes: 19 additions & 0 deletions documentation/docs/guide/extensions/cosid-mongo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# CosId-Mongo 模块

## 安装

::: code-group
```kotlin [Gradle(Kotlin)]
val cosidVersion = "latestVersion"
implementation("me.ahoo.cosid:cosid-mongo:${cosidVersion}")
```
```xml [Maven]
<dependencies>
<dependency>
<groupId>me.ahoo.cosid</groupId>
<artifactId>cosid-mongo</artifactId>
<version>${cosid.version}</version>
</dependency>
</dependencies>
```
:::
Loading

0 comments on commit 88f84bf

Please sign in to comment.