Skip to content

Commit

Permalink
feat(docs): 重构部署脚本和更新文档配置
Browse files Browse the repository at this point in the history
本次提交对项目的部署脚本和文档配置进行了重构和更新,包括:
- 移除`deploy.sh`脚本,改用更现代的部署方法。
- 更新`.vitepress/config.mts`配置文件,添加自定义别名、Markdown 预览插件等设置。
- 修改主题配置,引入Ant Design容器组件。
- 添加示例代码和文档安装、使用说明。
- 重命名和更新文档文件,优化导航结构和内容展示。

这些更改旨在提升文档质量和项目部署的效率与灵活性。
  • Loading branch information
Null committed Jul 28, 2024
1 parent 3823368 commit 2e8f613
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 42 deletions.
24 changes: 0 additions & 24 deletions deploy.sh

This file was deleted.

25 changes: 22 additions & 3 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
import { defineConfig } from 'vitepress'
import path from 'path'
import { containerPreview, componentPreview } from '@vitepress-demo-preview/plugin'

// https://vitepress.dev/reference/site-config
export default defineConfig({
title: "My Awesome Project",
description: "A VitePress Site",
title: "ZhongJiaYao",

vite: {
resolve: {
alias: {
"zhongjiayao_v3_hooks": path.resolve(__dirname, '../../packages/hooks/src/index.ts')
}
},
},
markdown: {
config: (md) => {
md.use(containerPreview)
md.use(componentPreview)
}
},

description: "Web Vue3 Hooks Code",
base:"/hooks-encode/",
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
Expand All @@ -25,5 +42,7 @@ export default defineConfig({
socialLinks: [
{ icon: 'github', link: 'https://github.com/vuejs/vitepress' }
]
}
},


})
3 changes: 3 additions & 0 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import { h } from 'vue'
import type { Theme } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import { AntDesignContainer } from '@vitepress-demo-preview/component'
import '@vitepress-demo-preview/component/dist/style.css'
import './style.css'

export default {
Expand All @@ -13,5 +15,6 @@ export default {
},
enhanceApp({ app, router, siteData }) {
// ...
app.component('demo-preview', AntDesignContainer)
}
} satisfies Theme
13 changes: 13 additions & 0 deletions docs/hook-demo/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<template>
<div>{{ useBooleanState }}</div>

<button @click="useBooleanToggle">toggle</button>
<button @click="setTrue">setTrue</button>
<button @click="setFalse">setFalse</button>
</template>

<script setup>
import { useBoolean } from 'zhongjiayao_v3_hooks'
const [useBooleanState, { toggle: useBooleanToggle, setTrue, setFalse }] = useBoolean()
</script>

47 changes: 33 additions & 14 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,42 @@
layout: home

hero:
name: "My Awesome Project"
text: "A VitePress Site"
tagline: My great project tagline
name: "ZhongJiaYao"
text: "Vue3 Hooks Code"
tagline: 冲冲冲!!!
actions:
- theme: brand
text: Markdown Examples
link: /markdown-examples
- theme: alt
text: API Examples
text: 指南
link: /markdown-examples
- theme: brand
text: Hooks API
link: /api-examples

features:
- title: Feature A
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
- title: Feature B
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
- title: Feature C
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
# features:
# - title: ✨ 特性
# details: 可靠的代码健壮:使用 Typescript 构建,提供完善的类型定义文件
# - title: 📦 文档
# details: 完善的文档能力:支持文档记录,支持 demo 演示
---

## ✨ 特性
- 可以用过 cli 创建 一键关联 hooks
- 可靠的代码健壮:使用 Typescript 构建,提供完善的类型定义文件
- 完善的文档能力:支持文档记录,支持 demo 演示

## 📦 安装

```bash
$ pnpm install --save zhongjiayao_v3_hooks
# or
$ yarn add zhongjiayao_v3_hooks

```

## 🔨 使用

参考 `Hooks`内容,使用如下:

```ts
import { useToggle } from 'zhongjiayao_v3_hooks';
```
7 changes: 7 additions & 0 deletions docs/markdown-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

This page demonstrates some of the built-in markdown extensions provided by VitePress.



第一个示例:

<preview path="./hook-demo/index.vue" title="基本使用" description="测试使用 Element Plus 组件"></preview>


## Syntax Highlighting

VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"scripts": {
"preinstall": "npx only-allow pnpm",
"inits": "pnpm install",
"deploy": "bash deploy.sh",
"clean-dist": "rimraf 'packages/hooks/{lib,es,node_modules,dist}'",
"clean": "pnpm run clean-dist && rimraf node_modules",
"build": "pnpm -r --filter=./packages/* run build",
Expand Down

0 comments on commit 2e8f613

Please sign in to comment.