Skip to content

Commit

Permalink
docs: refactor documentation (#1744)
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed Jan 2, 2024
1 parent abb8bee commit 9d49443
Show file tree
Hide file tree
Showing 424 changed files with 18,007 additions and 1,594 deletions.
12 changes: 0 additions & 12 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@

node_modules
dist

upload
data/*
tmp

.DS_Store
.idea

coverage
.nyc_

.vitepress/cache
85 changes: 85 additions & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import { defineConfig } from 'vitepress'
import { NavItemsInEnglish, SidebarItemsInEnglish } from './en.mts'
import { NavItemsInZh, SidebarItemsInZh } from './zh.mts'

// https://vitepress.dev/reference/site-config
export default defineConfig({
lastUpdated: true,
markdown: {
lineNumbers: true,
},

locales: {
root: {
label: '简体中文',
lang: 'zh-CN',
link: '/zh/',
title: "Laf 开发文档",
description: "laf 开发文档,像写博客一样写函数。",
themeConfig: {
logo: "/logo.png",
footer: {
message: "Apache License V2.0",
copyright: "Copyright © 2021-2024 labring/laf",
},
editLink: {
pattern: "https://github.com/labring/laf/edit/main/docs/:path",
text: "我修改这一页",
},
lastUpdated: {
text: "更新于"
},
docFooter: {
prev: '上一篇',
next: '下一篇'
},
socialLinks: [
{ icon: "github", link: "https://github.com/labring/laf" },
{ icon: "discord", link: "https://discord.gg/KaxHF86CcF" },
{ icon: "twitter", link: "https://twitter.com/laf_dev" },
],
returnToTopLabel: '返回顶部',
externalLinkIcon: true,
outline: 'deep',

// https://vitepress.dev/reference/default-theme-config
nav: NavItemsInZh,

sidebar: SidebarItemsInZh,
},
},
en: {
label: 'English',
lang: 'en',
link: '/en/',
title: "Laf Documentation",
description: "Development documentation of laf, write function like writing blog.",
themeConfig: {
logo: "/logo.png",
footer: {
message: "Apache License V2.0",
copyright: "Copyright © 2021-2024 labring/laf",
},
editLink: {
pattern: "https://github.com/labring/laf/edit/main/docs/:path",
text: "Edit this page on GitHub",
},
socialLinks: [
{ icon: "github", link: "https://github.com/labring/laf" },
{ icon: "discord", link: "https://discord.gg/KaxHF86CcF" },
{ icon: "twitter", link: "https://twitter.com/laf_dev" },
],

outline: 'deep',

externalLinkIcon: true,

// https://vitepress.dev/reference/default-theme-config
nav: NavItemsInEnglish,

sidebar: SidebarItemsInEnglish,
}
},
},

})
17 changes: 17 additions & 0 deletions docs/.vitepress/en.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { DefaultTheme } from 'vitepress'


export const NavItemsInEnglish: DefaultTheme.NavItem[] = [
// { text: 'Guides', link: '/en/' },
// { text: 'Examples', link: './markdown-examples' }
]

export const SidebarItemsInEnglish: DefaultTheme.SidebarItem[] = [
{
text: 'Getting Started',
items: [
{ text: 'Overview', link: '/en/' },
{ text: 'Architecture', link: '/en/architecture' },
]
}
]
37 changes: 12 additions & 25 deletions docs/.vitepress/theme/custom.css
Original file line number Diff line number Diff line change
@@ -1,34 +1,21 @@
:root {
--vp-c-brand: #646cff;
--vp-c-brand-light: #747bff;
--vp-c-brand-dark: #323cf7;
.VPSidebar::-webkit-scrollbar {
display: none;
}

.inline img {
display: inline;
/*
.VPDocAside .outline-link {
color: rgb(6, 63, 148);
}
.search {
flex-grow: 1;
padding-left: 24px;
.VPDocAside .outline-link {
font-size: 14px;
}
.search button {
justify-content: flex-start;
border: 1px solid transparent;
border-radius: 8px;
padding: 0 10px 0 12px;
width: 100%;
height: 40px;
margin-right: -20px;
background-color: #f6f6f7;
.VPDocAside .outline-link.active {
color: rgb(82, 7, 234);
}
.search button:hover {
border: 1px solid var(--vp-c-brand);
background-color: #f6f6f7;
}
.dark .search button {
background-color: var(--vp-c-bg);
}
.VPDocAside .outline-link:hover {
color: rgb(82, 7, 234);
} */
4 changes: 4 additions & 0 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import DefaultTheme from 'vitepress/theme'
import './custom.css'

export default DefaultTheme
140 changes: 140 additions & 0 deletions docs/.vitepress/zh.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
import { DefaultTheme } from 'vitepress'


function wrapGray(content: string) {
return `<span style='color:darkgray'>${content}</span>`
}

export const NavItemsInZh: DefaultTheme.NavItem[] = [
{ text: '开发指南', link: '/zh/' },
{ text: '使用实例', link: '/zh/examples/' }
]

export const SidebarItemsInZh: DefaultTheme.SidebarItem[] = [
{
text: '入门',
link: '/zh/',
items: [
{
text: 'laf 介绍',
link: '/zh/',
},
{
text: '快速开始',
link: '/zh/quick-start/login'
}
],
},
{
text: '云函数',
collapsed: false,
items: [
{ text: '云函数简介', link: '/zh/cloud-function/' },
{ text: '快速开始', link: '/zh/cloud-function/quick-start' },
{
text: '处理 HTTP',
collapsed: true,
items: [
{ text: '请求', link: '/zh/cloud-function/request' },
{ text: '响应', link: '/zh/cloud-function/response' },
{ text: '认证', link: '/zh/cloud-function/auth' },
{ text: '文件上传', link: '/zh/cloud-function/files' },
]
},
{ text: '发起网络请求', link: '/zh/cloud-function/fetch' },
{ text: '函数引用', link: '/zh/cloud-function/import' },
{ text: '环境变量', link: '/zh/cloud-function/env' },
{ text: '依赖管理', link: '/zh/cloud-function/deps' },
{ text: '定时任务', link: '/zh/cloud-function/cron' },
{
text: '内置云函数',
collapsed: true,
items: [
{ text: '拦截器(TBD)' },
{ text: '初始化(TBD)' },
{ text: 'NotFound(TBD)' },
],
},
{ text: 'WebSocket(TBD)' },
]
},
{
text: '云数据库',
collapsed: false,
items: [
{ text: '云数据库简介', link: '/zh/cloud-database/' },
{ text: '快速开始', link: '/zh/cloud-database/quick-start' },
{ text: '插入文档', link: '/zh/cloud-database/insert' },
{
text: '查询文档',
link: '/zh/cloud-database/find',
collapsed: true,
items: [
{ text: '条件查询', link: '/zh/cloud-database/query/condition' },
{ text: '排序查询', link: '/zh/cloud-database/query/sort' },
{ text: '分页查询', link: '/zh/cloud-database/query/pagination' },
{ text: '嵌套文档查询', link: '/zh/cloud-database/query/nested' },
{ text: '正则模糊查询', link: '/zh/cloud-database/query/regex' },
{ text: '数组查询', link: '/zh/cloud-database/query/array' },
]
},
{ text: '更新文档', link: '/zh/cloud-database/update' },
{ text: '删除文档', link: '/zh/cloud-database/delete' },
{
text: '进阶使用',
collapsed: true,
items: [
{ text: '聚合查询(TBD)' },
{ text: '事务(TBD)' },
{ text: '组合操作(TBD)' },
{ text: '索引(TBD)' },
{ text: '时序集合(TBD)' },
{ text: '变更流(TBD)' },
]
},
{
text: wrapGray('旧版语法'),
collapsed: true,
items: [
{ text: wrapGray('数据库简介'), link: '/zh/cloud-database/database-ql/' },
{ text: wrapGray('数据库入门'), link: '/zh/cloud-database/database-ql/quickstart' },
{ text: wrapGray('新增数据'), link: '/zh/cloud-database/database-ql/add' },
{ text: wrapGray('查询数据'), link: '/zh/cloud-database/database-ql/find' },
{ text: wrapGray('更新数据'), link: '/zh/cloud-database/database-ql/update' },
{ text: wrapGray('删除数据'), link: '/zh/cloud-database/database-ql/del' },
{ text: wrapGray('数据库操作符'), link: '/zh/cloud-database/database-ql/command' },
{ text: wrapGray('数据库聚合操作'), link: '/zh/cloud-database/database-ql/aggregate' },
{ text: wrapGray('数据库运算'), link: '/zh/cloud-database/database-ql/operator' },
]
}
],
},
{
text: '云存储',
collapsed: false,
items: [
{ text: '云存储简介', link: '/zh/cloud-storage/' },
{ text: '上传文件', link: '/zh/cloud-storage/upload' },
{ text: '读取文件', link: '/zh/cloud-storage/read' },
{ text: '删除文件', link: '/zh/cloud-storage/delete' },
{ text: '文件列表', link: '/zh/cloud-storage/list' },
{ text: '生成文件上传地址', link: '/zh/cloud-storage/upload-url' },
{ text: '生成文件下载地址', link: '/zh/cloud-storage/download-url' },
{ text: '网站托管', link: '/zh/cloud-storage/website-hosting' },
{
text: '更多例子',
collapsed: true,
items: [
{ text: '微信小程序上传文件', link: '/zh/examples/wxmp-upload' },
{ text: 'GitHub Action 持续集成网站托管', link: '/zh/examples/website-hosting-ci-cd.md' },
{ text: 'Web 前端上传文件(TBD)' },
{ text: '微信小程序上传文件(TBD)' },
]
}
],
},
{
text: '工具',
items: [{ text: 'laf-cli', link: '/zh/cli/' }],
},
]
2 changes: 2 additions & 0 deletions docs/en/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

> TBD
Binary file added docs/en/ide.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9d49443

Please sign in to comment.