Skip to content

Commit

Permalink
docs: add local search and keep old docs temporarily
Browse files Browse the repository at this point in the history
  • Loading branch information
0fatal committed Jan 20, 2024
1 parent fd8453d commit 6b17cfd
Show file tree
Hide file tree
Showing 18 changed files with 62 additions and 16 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/deploy-doc-deprecated.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: deploy deprecated docs

on:
workflow_dispatch:
push:
branches: [main]
paths:
- "docs_deprecated/**"
- ".github/workflows/deploy-doc-deprecated.yml"
env:
LAF_CI_DOCS_PAT: ${{ secrets.LAF_CI_DOCS_PAT }}
LAF_CI_DOCS_APPID: ${{ secrets.LAF_CI_DOCS_APPID }}
LAF_CI_DOCS_BUCKET_NAME: ${{ secrets.LAF_CI_DEPRECATED_DOCS_BUCKET_NAME }}
LAF_API_URL: ${{ secrets.LAF_API_URL }}

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Build Docs
uses: ./.github/actions/build-docs

- name: Setup laf-cli
run: npm i laf-cli -g
- name: Login laf-cli
run: |
laf user add doc -r ${{ env.LAF_API_URL }}
laf user switch doc
laf login ${{ env.LAF_CI_DOCS_PAT }}
- name: Deploy to laf
working-directory: docs_deprecated/.vitepress
run: |
laf app init ${{ env.LAF_CI_DOCS_APPID }}
laf storage push -f ${{ env.LAF_CI_DOCS_BUCKET_NAME }} dist/
10 changes: 9 additions & 1 deletion docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,20 @@ import { NavItemsInZh, SidebarItemsInZh } from './zh.mts'

// https://vitepress.dev/reference/site-config
export default defineConfig({
rewrites: {
'zh/index.md': 'index.md',
},
themeConfig: {
search: {
provider: 'local'
}
},
lastUpdated: true,
markdown: {
lineNumbers: true,
},

locales: {
locales: {
root: {
label: '简体中文',
lang: 'zh-CN',
Expand Down
3 changes: 2 additions & 1 deletion docs/.vitepress/zh.mts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ function wrapGray(content: string) {

export const NavItemsInZh: DefaultTheme.NavItem[] = [
{ text: '开发指南', link: '/zh/' },
{ text: '使用实例', link: '/zh/examples/' }
{ text: '使用实例', link: '/zh/examples/' },
{ text: '旧版文档', link: 'https://doc.laf.run/old/' }
]

export const SidebarItemsInZh: DefaultTheme.SidebarItem[] = [
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: laf-cli 命令行工具
---

# {{ $frontmatter.title }}
# laf-cli 命令行工具

## 简介

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/client-sdk/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: laf-client-sdk
---

# {{ $frontmatter.title }}
# laf-client-sdk

## 介绍

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/cloud-database/database-ql/add.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: 新增数据
---

# {{ $frontmatter.title }}
# 新增数据

Laf 云函数库中,新增数据非常简单,正规说法为插入文档。以下是插入单个文档和批量插入文档的写法。

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/cloud-database/database-ql/aggregate.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: 数据库聚合操作
---

# {{ $frontmatter.title }}
# 数据库聚合操作

在进行复杂的数据查询时,需要用到聚合操作。

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/cloud-database/database-ql/command.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: 数据库操作符
---

# {{ $frontmatter.title }}
# 数据库操作符

Laf 云函数支持多种不同的数据库操作符,用于执行查询、更新、删除等操作。

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/cloud-database/database-ql/del.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: 删除数据
---

# {{ $frontmatter.title }}
# 删除数据

Laf 云数据库删除数据,包括删除文档和删除集合。同时支持单个删除和批量删除。

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/cloud-database/database-ql/find.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: 查询数据
---

# {{ $frontmatter.title }}
# 查询数据

Laf 云数据库支持传入不同的条件来查询数据,并且对查询结果进行处理。本文档将通过示例说明如何通过 `cloud.database()` 在云函数中执行查询。

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/cloud-database/database-ql/geo.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: 地理信息 API
---

# {{ $frontmatter.title }}
# 地理信息 API

注意:**如果需要对类型为地理位置的字段进行搜索,一定要建立地理位置索引**

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/cloud-database/database-ql/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: 云数据库介绍
---

# {{ $frontmatter.title }}
# 云数据库介绍

Laf 云数据库提供了开箱即用的数据库,无需复杂配置和连接。在云函数中可通过 `cloud.database()` 新建 DB 实例去操作数据库。

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/cloud-database/database-ql/operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: 数据库运算
---

# {{ $frontmatter.title }}
# 数据库运算

**等同于 mongoDB 聚合操作符概念**

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/cloud-database/database-ql/policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: 访问策略
---

# {{ $frontmatter.title }}
# 访问策略

前端可使用 [laf-client-sdk](https://github.com/labring/laf/tree/main/packages/client-sdk) “直连”数据库,无需与服务端对接口。

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/cloud-database/database-ql/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: 数据库入门
---

# {{ $frontmatter.title }}
# 数据库入门

Laf 为每个应用提供了一个开箱即用的数据库,并且非常易用。下面是一个简单的数据库的增删改查的例子,来快速的了解 Laf 的数据库操作。

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/cloud-database/database-ql/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: 更新数据
---

# {{ $frontmatter.title }}
# 更新数据

Laf 云数据库更新数据,实际上就是针对集合中的文档进行修改,通过 `where` 等操作符设置查询条件,然后通过 `update``set` 等更新操作符进行修改。

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/quick-start/Todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: 快速开始
---

# {{ $frontmatter.title }}
# 快速开始

我们将在 [laf.run](https://laf.run) 上,通过开发一个简单的「Todo」的功能,快速体验 `laf` 云开发。

Expand Down
1 change: 1 addition & 0 deletions docs_deprecated/.vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ const examplesSideBarConfig = [
];

export default defineConfig({
base: '/old/',
locales: {
root: {
label: "简体中文",
Expand Down

0 comments on commit 6b17cfd

Please sign in to comment.