Fix docs and improve ci (#182)
This commit is contained in:
14
.github/workflows/check-format.yml
vendored
14
.github/workflows/check-format.yml
vendored
@@ -1,9 +1,21 @@
|
|||||||
name: format
|
name: format
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- .clang-format
|
||||||
|
- "include/**"
|
||||||
|
- "src/**"
|
||||||
|
- "tests/**"
|
||||||
|
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- .clang-format
|
||||||
|
- "include/**"
|
||||||
|
- "src/**"
|
||||||
|
- "tests/**"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check:
|
||||||
|
|||||||
23
.github/workflows/cmake.yml
vendored
23
.github/workflows/cmake.yml
vendored
@@ -3,18 +3,21 @@ name: cmake
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- ".github/workflows/cmake.yml"
|
||||||
|
- "include/**"
|
||||||
|
- "src/**"
|
||||||
|
- "tests/**"
|
||||||
|
- "CMakeLists.txt"
|
||||||
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
paths-ignore:
|
paths:
|
||||||
- "docs"
|
- ".github/workflows/cmake.yml"
|
||||||
- "scripts"
|
- "include/**"
|
||||||
- ".clang-format"
|
- "src/**"
|
||||||
- ".clangd"
|
- "tests/**"
|
||||||
- ".gitignore"
|
- "CMakeLists.txt"
|
||||||
- "LICENSE"
|
|
||||||
- "README.md"
|
|
||||||
- ".github/workflows/xmake.yml"
|
|
||||||
- "xmake.lua"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|||||||
25
.github/workflows/xmake.yml
vendored
25
.github/workflows/xmake.yml
vendored
@@ -3,20 +3,21 @@ name: xmake
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- ".github/workflows/xmake.yml"
|
||||||
|
- "include/**"
|
||||||
|
- "src/**"
|
||||||
|
- "tests/**"
|
||||||
|
- "xmake.lua"
|
||||||
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
paths-ignore:
|
paths:
|
||||||
- "docs"
|
- ".github/workflows/xmake.yml"
|
||||||
- "scripts"
|
- "include/**"
|
||||||
- ".clang-format"
|
- "src/**"
|
||||||
- ".clangd"
|
- "tests/**"
|
||||||
- ".gitignore"
|
- "xmake.lua"
|
||||||
- "LICENSE"
|
|
||||||
- "README.md"
|
|
||||||
- ".github/workflows/cmake.yml"
|
|
||||||
- "CMakeLists.txt"
|
|
||||||
- "CMakePresets.json"
|
|
||||||
- "cmake"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
linux:
|
linux:
|
||||||
|
|||||||
@@ -18,17 +18,16 @@ export default defineConfig({
|
|||||||
nav: [
|
nav: [
|
||||||
{ text: 'Home', link: '/' },
|
{ text: 'Home', link: '/' },
|
||||||
],
|
],
|
||||||
|
|
||||||
sidebar: {
|
sidebar: {
|
||||||
"/zh/": [
|
"/zh/": [
|
||||||
genSidebar('zh/design', { title: 'Design' }),
|
genSidebar('zh', 'design', { title: 'Design' }),
|
||||||
genSidebar('zh/dev', { title: 'Development' }),
|
genSidebar('zh', 'dev', { title: 'Development' }),
|
||||||
genSidebar('zh/guide', { title: 'Guide' }),
|
genSidebar('zh', 'guide', { title: 'Guide' }),
|
||||||
],
|
],
|
||||||
"/": [
|
"/": [
|
||||||
genSidebar('en/design', { title: 'Design' }),
|
genSidebar('en', 'design', { title: 'Design' }),
|
||||||
genSidebar('en/dev', { title: 'Development' }),
|
genSidebar('en', 'dev', { title: 'Development' }),
|
||||||
genSidebar('en/guide', { title: 'Guide' }),
|
genSidebar('en', 'guide', { title: 'Guide' }),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
socialLinks: [
|
socialLinks: [
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import path from 'path'
|
|||||||
import { DefaultTheme } from 'vitepress'
|
import { DefaultTheme } from 'vitepress'
|
||||||
|
|
||||||
export const genSidebar = (
|
export const genSidebar = (
|
||||||
|
lang: string,
|
||||||
dirPath: string,
|
dirPath: string,
|
||||||
options: {
|
options: {
|
||||||
title: string
|
title: string
|
||||||
@@ -10,7 +11,7 @@ export const genSidebar = (
|
|||||||
ignore?: string[]
|
ignore?: string[]
|
||||||
}
|
}
|
||||||
): DefaultTheme.SidebarItem => {
|
): DefaultTheme.SidebarItem => {
|
||||||
const sidebarPath = path.resolve(process.cwd(), dirPath)
|
const sidebarPath = path.resolve(process.cwd(), lang, dirPath)
|
||||||
const ignore = options.ignore || ['index.md']
|
const ignore = options.ignore || ['index.md']
|
||||||
|
|
||||||
const files = fs
|
const files = fs
|
||||||
@@ -22,9 +23,17 @@ export const genSidebar = (
|
|||||||
const match = content.match(/^#\s+(.*)/)
|
const match = content.match(/^#\s+(.*)/)
|
||||||
const title = match ? match[1] : file.replace('.md', '')
|
const title = match ? match[1] : file.replace('.md', '')
|
||||||
|
|
||||||
|
let prefix = '/';
|
||||||
|
if (lang != 'en') {
|
||||||
|
prefix += lang;
|
||||||
|
prefix += '/';
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
text: title,
|
text: title,
|
||||||
link: `/${dirPath}/${file.replace('.md', '')}`
|
/// Make sure link for en is actually root, beacuse Github Pages
|
||||||
|
/// doesn't support redirect url.
|
||||||
|
link: `${prefix}${dirPath}/${file.replace('.md', '')}`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ hero:
|
|||||||
actions:
|
actions:
|
||||||
- theme: brand
|
- theme: brand
|
||||||
text: What is clice?
|
text: What is clice?
|
||||||
link: /en/guide/what-is-clice
|
link: /guide/what-is-clice
|
||||||
- theme: alt
|
- theme: alt
|
||||||
text: Quick Start
|
text: Quick Start
|
||||||
link: /en/guide/quick-start
|
link: /guide/quick-start
|
||||||
- theme: alt
|
- theme: alt
|
||||||
text: Contribution
|
text: Contribution
|
||||||
link: /en/dev/contribution
|
link: /dev/contribution
|
||||||
image:
|
image:
|
||||||
src: /image.png
|
src: /image.png
|
||||||
alt: clice
|
alt: clice
|
||||||
|
|||||||
Reference in New Issue
Block a user