Skip to content

Commit

Permalink
Merge pull request #48 from Ares-Chang/docs/vitepress
Browse files Browse the repository at this point in the history
docs: add vitepress docs website
  • Loading branch information
edwinhuish authored Oct 16, 2024
2 parents d5c2e62 + 12fcd86 commit 2e95a34
Show file tree
Hide file tree
Showing 51 changed files with 2,526 additions and 450 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,6 @@ dist_ssg

# Android
*.keystore

# Vitepress
cache
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@
"prepare": "is-ci || simple-git-hooks",
"prepublishOnly": "pnpm run build",
"release": "pnpm install && pnpm run lint && bumpp",
"test": "vitest"
"test": "vitest",
"docs:dev": "vitepress dev src",
"docs:build": "vitepress build src",
"docs:preview": "vitepress preview src"
},
"peerDependencies": {
"@vueuse/core": "^9.0.0 || ^10.0.0",
Expand Down Expand Up @@ -91,6 +94,7 @@
"commitizen": "^4.3.0",
"concurrently": "^8.2.2",
"eslint": "^8.56.0",
"fast-glob": "^3.3.2",
"is-ci": "^3.0.1",
"lint-staged": "^15.2.0",
"markdownlint-cli": "^0.38.0",
Expand All @@ -102,6 +106,7 @@
"tsx": "^4.7.0",
"typescript": "^5.3.3",
"unbuild": "^2.0.0",
"vitepress": "^1.4.0",
"vitest": "^1.4.0"
},
"publishConfig": {
Expand Down
2,178 changes: 1,926 additions & 252 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions src/.vitepress/components/HomeTeam.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<script setup lang="ts">
import { VPTeamMembers } from 'vitepress/theme';
const teamMembers = [
{
avatar: 'https://github.com/ModyQyW.png',
name: 'ModyQyW',
title: 'Author',
links: [
{ icon: 'github', link: 'https://github.com/ModyQyW' },
],
},
{
avatar: 'https://github.com/edwinhuish.png',
name: 'edwinhuish',
title: 'Maintainer',
links: [
{ icon: 'github', link: 'https://github.com/edwinhuish' },
],
},
];
</script>

<template>
<div>
<h2 style="text-align: center;">
团队成员
</h2>
<VPTeamMembers size="small" :members="teamMembers" />
</div>
</template>
135 changes: 135 additions & 0 deletions src/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
import fg from 'fast-glob';
import { defineConfig } from 'vitepress';

const files = await fg('*', {
onlyDirectories: true,
cwd: './src',
ignore: [
'public',
'apis',
'guide',
],
});

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: 'UniUse',
description: 'uni-app (vue3) 组合式工具集。',
lang: 'zh-CN',
themeConfig: {
logo: '/logo.png',

nav: [
{ text: '指南', link: '/guide/' },
{ text: 'API', link: '/apis/' },
{ text: 'ChangeLog', link: 'https://github.com/uni-helper/uni-use/blob/main/CHANGELOG.md' },
],

sidebar: {
'/guide/': [
{
text: '指南',
items: [
{
text: '开始',
link: '/guide/',
},
{
text: '注意事项',
link: '/guide/notice/',
},
{
text: '更新日志',
link: 'https://github.com/uni-helper/uni-use/blob/main/CHANGELOG.md',
},
{
text: '所有函数',
link: '/apis/',
},
],
},
],
'/': [
{
text: 'All Functions',
items: [
{
text: '函数列表',
link: '/apis/',
},
],
},
{
text: 'API',
items: files.map(file => ({
text: file,
link: `/${file}/`,
})),
},
],
},

editLink: {
pattern: 'https://github.com/uni-helper/uni-use/tree/main/src/:path',
text: '为这个页面提供建议',
},

footer: {
message: 'Released under the MIT License.',
copyright: 'Copyright © 2022-PRESENT uni-helper and uni-helper contributors',
},

docFooter: {
prev: '上一页',
next: '下一页',
},

outline: {
label: '页面导航',
},

search: {
provider: 'local',
options: {
locales: {
'zh-CN': {
translations: {
button: {
buttonText: '搜索文档',
buttonAriaLabel: '搜索文档',
},
modal: {
noResultsText: '无法找到相关结果',
resetButtonTitle: '清除查询条件',
footer: {
selectText: '选择',
navigateText: '切换',
closeText: '关闭',
},
},
},
},
},
},
},

lastUpdated: {
text: '最后更新于',
formatOptions: {
dateStyle: 'short',
timeStyle: 'medium',
},
},

langMenuLabel: '多语言',
returnToTopLabel: '回到顶部',
sidebarMenuLabel: '菜单',
darkModeSwitchLabel: '主题',
lightModeSwitchTitle: '切换到浅色模式',
darkModeSwitchTitle: '切换到深色模式',

socialLinks: [
{ icon: 'github', link: 'https://github.com/uni-helper/uni-use' },
],
},
});
18 changes: 18 additions & 0 deletions src/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// https://vitepress.dev/guide/custom-theme
import type { Theme } from 'vitepress';
import DefaultTheme from 'vitepress/theme';
import { h } from 'vue';
import HomeTeam from '../components/HomeTeam.vue';
import './style.css';

export default {
extends: DefaultTheme,
Layout: () => {
return h(DefaultTheme.Layout, null, {
// https://vitepress.dev/guide/extending-default-theme#layout-slots
});
},
enhanceApp({ app }) {
app.component('HomeTeam', HomeTeam);
},
} satisfies Theme;
Loading

0 comments on commit 2e95a34

Please sign in to comment.