Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: optimize cloud function documents and database documents #1076

Merged
merged 7 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .lycheeignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
.*xx.*
https://beian.miit.gov.cn/
.*127-0-0-1.*
https://oss.laf.run
https://oss.laf.run
https://github.com/labring/laf/edit/main/docs/
82 changes: 73 additions & 9 deletions docs/.vitepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,55 @@ import mdItCustomAttrs from "markdown-it-custom-attrs";
*/
const NavConfig = [
{ text: "主页", link: "https://laf.run" },
{ text: "开发指南", link: "/guide/", activeMatch: "^/guide/" },
{
text: "开发指南",
activeMatch: "^/guide/",
items: [
{
text: "入门",
items: [
{
text: "Laf 云开发介绍",
link: "/guide/",
},
],
},
{
text: "功能",
items: [
{
text: "云函数",
link: "/guide/function/",
},
{
text: "云数据库",
link: "/guide/db/",
},
{
text: "云存储",
link: "/guide/oss/",
},
],
},
{
text: "更多",
items: [
{
text: "网站托管",
link: "/guide/website-hosting/",
},
{
text: "客户端SDK",
link: "/guide/client-sdk/",
},
{
text: "命令行工具",
link: "/guide/cli/",
},
],
},
],
},
{ text: "API", link: "/api/cloud", activeMatch: "^/api/" },
{ text: "范例", link: "/examples/aliyun-sms", activeMatch: "^/examples/" },
{ text: "预览图", link: "/screenshots" },
Expand Down Expand Up @@ -45,6 +93,7 @@ const guideSiderbarConfig = [
},
{
text: "云函数",
collapsed: false,
items: [
{
text: "云函数入门",
Expand Down Expand Up @@ -95,17 +144,24 @@ const guideSiderbarConfig = [
text: "拦截器",
link: "/guide/function/interceptor",
},
{
text: "云函数FAQ",
link: "/guide/function/faq",
},
],
},
{
text: "云数据库",
collapsed: false,
items: [
{ text: "数据库简介", link: "/guide/db/" },
{ text: "数据库入门", link: "/guide/db/quickstart" },
{ text: "新增数据", link: "/guide/db/add" },
{ text: "查询数据", link: "/guide/db/find" },
{ text: "数据操作", link: "/guide/db/actions" },
{ text: "访问策略", link: "/guide/db/policy" },
{ text: "更新数据", link: "/guide/db/update" },
{ text: "删除数据", link: "/guide/db/del" },
{ text: "数据库操作符", link: "/guide/db/command" },
{ text: "数据库聚合操作", link: "/guide/db/aggregate" },
{
text: "操作地理信息",
link: "/guide/db/geo",
Expand All @@ -114,6 +170,7 @@ const guideSiderbarConfig = [
},
{
text: "云存储",
collapsed: false,
items: [
{ text: "云存储简介", link: "/guide/oss/" },
{ text: "生成云存储临时令牌(STS)", link: "/guide/oss/get-sts" },
Expand All @@ -136,7 +193,10 @@ const guideSiderbarConfig = [
},
{
text: "客户端 SDK",
items: [{ text: "laf-client-sdk 使用说明", link: "/guide/client-sdk/" }],
items: [
{ text: "laf-client-sdk 使用说明", link: "/guide/client-sdk/" },
{ text: "数据库访问策略", link: "/guide/db/policy" },
],
},
];

Expand Down Expand Up @@ -212,13 +272,17 @@ export default defineConfig({
message: "Apache License V2.0",
copyright: "Copyright © 2021-present labring/laf",
},
// editLink: {
// pattern: "https://github.com/labring/laf/edit/main/docs/:path",
// text: "在 GitHub 上编辑此页",
// },
editLink: {
pattern: "https://github.com/labring/laf/edit/main/docs/:path",
text: "在 GitHub 上编辑此页",
},
lastUpdated: "更新于",
nav: NavConfig,
socialLinks: [{ icon: "github", link: "https://github.com/labring/laf" }],
socialLinks: [
{ icon: "github", link: "https://github.com/labring/laf" },
{ icon: "discord", link: "https://discord.gg/KaxHF86CcF" },
{ icon: "twitter", link: "https://twitter.com/laf_dev" },
],
sidebar: {
"/guide/": guideSiderbarConfig,
"/api/": apiSideBarConfig,
Expand Down
2 changes: 1 addition & 1 deletion docs/api/function.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: 云函数API文档

## 云函数签名

```ts
```typescript
(ctx: FunctionContext) => any;
```

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/alipay-pay.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: 支付宝支付云函数

创建 `aliPay` 云函数,添加依赖 alipay-sdk ,编写以下代码:

```ts
```typescript
import cloud from "@lafjs/cloud";
import alipay from "alipay-sdk";
const AlipayFormData = require("alipay-sdk/lib/form").default;
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/aliyun-sms.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ title: 阿里云短信服务发验证码的云函数

创建 `sendsms` 云函数,添加依赖 @alicloud/dysmsapi20170525,编写以下代码:

```ts
```typescript
import Dysmsapi, * as dysmsapi from "@alicloud/dysmsapi20170525";
import * as OpenApi from "@alicloud/openapi-client";
import * as Util from "@alicloud/tea-util";
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/send-mail.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ title: 发送邮件

创建 `sendmail` 云函数,添加依赖 `nodemailer`,编写以下代码:

```ts
```typescript
import from 'nodemailer'

// 邮件服务器配置
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/wechat-pay.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ notify_url 也可以写一个 laf 云函数来接受支付结果的通知。

创建 `wx-pay` 云函数,添加依赖 [wxpay-v3](https://github.com/yangfuhe/node-wxpay),编写以下代码:

```ts
```typescript
import cloud from "@lafjs/cloud";
const Payment = require("wxpay-v3");

Expand Down
6 changes: 3 additions & 3 deletions docs/guide/client-sdk/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const cloud = new Cloud({

setting下新增:

```ts
```typescript
"packNpmManually": true,
"packNpmRelationList": [
{
Expand Down Expand Up @@ -122,7 +122,7 @@ const cloud = new Cloud({
`laf-client-sdk` 调用云函数只支持POST请求云函数
:::

```ts
```typescript
import { Cloud } from "laf-client-sdk";

const cloud = new Cloud({
Expand All @@ -142,7 +142,7 @@ const res = await cloud.invoke("getCode", { phone: phone.value });
还有就是需要配合相对应的访问策略。
:::

```ts
```typescript
import { Cloud } from "laf-client-sdk";

const cloud = new Cloud({
Expand Down
Loading