From d5d0e1036bf806007ffc97ee8f33dc6f021f3824 Mon Sep 17 00:00:00 2001 From: chenos Date: Sat, 17 Apr 2021 21:33:21 +0800 Subject: [PATCH] docs: add docs (#75) * docs: add docs * ignore dumi theme test * fix: error TS2717: Subsequent property declarations must have the same type. * update docs * deploy gh-pages * plugins docs * hash & cname * exportStatic * ssr * vercel * vercel * fix: deploy vercel * Delete vercel.json * docs * fix APP_DIST * on master branch --- .dumi/theme/builtins/API.tsx | 57 + .dumi/theme/builtins/Alert.less | 68 + .dumi/theme/builtins/Alert.tsx | 17 + .dumi/theme/builtins/Badge.less | 31 + .dumi/theme/builtins/Badge.tsx | 4 + .dumi/theme/builtins/Example.less | 47 + .dumi/theme/builtins/Example.tsx | 34 + .dumi/theme/builtins/Previewer.less | 364 + .dumi/theme/builtins/Previewer.tsx | 253 + .dumi/theme/builtins/SourceCode.less | 58 + .dumi/theme/builtins/SourceCode.tsx | 41 + .dumi/theme/builtins/Tree.less | 22 + .dumi/theme/builtins/Tree.tsx | 60 + .dumi/theme/components/LocaleSelect.less | 48 + .dumi/theme/components/LocaleSelect.tsx | 53 + .dumi/theme/components/Navbar.less | 172 + .dumi/theme/components/Navbar.tsx | 68 + .dumi/theme/components/SearchBar.less | 107 + .dumi/theme/components/SearchBar.tsx | 41 + .dumi/theme/components/SideMenu.less | 321 + .dumi/theme/components/SideMenu.tsx | 139 + .dumi/theme/components/SlugList.less | 22 + .dumi/theme/components/SlugList.tsx | 20 + .dumi/theme/layout.tsx | 117 + .dumi/theme/style/layout.less | 325 + .dumi/theme/style/markdown.less | 196 + .dumi/theme/style/variables.less | 26 + .dumi/theme/test/index.test.tsx | 315 + .github/workflows/vercel.yml | 38 + .gitignore | 9 +- .umirc.ts | 23 + docs/cores/index.md | 35 + docs/cores/nocobase-core.png | Bin 0 -> 119595 bytes docs/cores/packages/actions.md | 426 + docs/cores/packages/blocks.md | 74 + docs/cores/packages/database.md | 732 + docs/cores/packages/resourcer.md | 563 + docs/cores/packages/sdk.md | 87 + docs/cores/packages/server.md | 146 + docs/cores/packages/test.md | 72 + docs/guide/config.md | 118 + docs/guide/getting-started.md | 196 + docs/guide/index.md | 51 + docs/guide/nocobase.png | Bin 0 -> 285560 bytes docs/index.md | 20 + docs/index.zh-CN.md | 20 + docs/plugins/concepts/actions.md | 24 + docs/plugins/concepts/blocks.md | 56 + docs/plugins/concepts/collections.md | 25 + docs/plugins/concepts/fields.md | 117 + docs/plugins/concepts/hooks.md | 9 + docs/plugins/concepts/locales.md | 34 + docs/plugins/concepts/middlewares.md | 9 + docs/plugins/concepts/migrations.md | 5 + docs/plugins/concepts/models.md | 33 + docs/plugins/concepts/resources.md | 7 + docs/plugins/packages/action-logs.md | 16 + docs/plugins/packages/automations.md | 100 + docs/plugins/packages/collections.md | 13 + docs/plugins/packages/file-manager.md | 45 + docs/plugins/packages/pages.md | 13 + docs/plugins/packages/permissions.md | 54 + docs/plugins/packages/users.md | 146 + docs/plugins/tutorials/developer-mode.md | 12 + docs/plugins/tutorials/index.md | 67 + docs/plugins/tutorials/plugin-cli.md | 23 + docs/plugins/tutorials/server-lifecycle.md | 74 + docs/plugins/tutorials/testing.md | 34 + jest.config.js | 1 + package-lock.json | 15120 ++++++++++++------- package.json | 19 +- packages/api/.env.example | 2 +- public/CNAME | 1 + yarn.lock | 4081 ++++- 74 files changed, 20219 insertions(+), 5557 deletions(-) create mode 100755 .dumi/theme/builtins/API.tsx create mode 100755 .dumi/theme/builtins/Alert.less create mode 100755 .dumi/theme/builtins/Alert.tsx create mode 100755 .dumi/theme/builtins/Badge.less create mode 100755 .dumi/theme/builtins/Badge.tsx create mode 100755 .dumi/theme/builtins/Example.less create mode 100755 .dumi/theme/builtins/Example.tsx create mode 100755 .dumi/theme/builtins/Previewer.less create mode 100755 .dumi/theme/builtins/Previewer.tsx create mode 100755 .dumi/theme/builtins/SourceCode.less create mode 100755 .dumi/theme/builtins/SourceCode.tsx create mode 100644 .dumi/theme/builtins/Tree.less create mode 100644 .dumi/theme/builtins/Tree.tsx create mode 100755 .dumi/theme/components/LocaleSelect.less create mode 100755 .dumi/theme/components/LocaleSelect.tsx create mode 100755 .dumi/theme/components/Navbar.less create mode 100755 .dumi/theme/components/Navbar.tsx create mode 100755 .dumi/theme/components/SearchBar.less create mode 100755 .dumi/theme/components/SearchBar.tsx create mode 100755 .dumi/theme/components/SideMenu.less create mode 100755 .dumi/theme/components/SideMenu.tsx create mode 100755 .dumi/theme/components/SlugList.less create mode 100755 .dumi/theme/components/SlugList.tsx create mode 100755 .dumi/theme/layout.tsx create mode 100755 .dumi/theme/style/layout.less create mode 100755 .dumi/theme/style/markdown.less create mode 100755 .dumi/theme/style/variables.less create mode 100755 .dumi/theme/test/index.test.tsx create mode 100644 .github/workflows/vercel.yml create mode 100644 .umirc.ts create mode 100644 docs/cores/index.md create mode 100644 docs/cores/nocobase-core.png create mode 100644 docs/cores/packages/actions.md create mode 100644 docs/cores/packages/blocks.md create mode 100644 docs/cores/packages/database.md create mode 100644 docs/cores/packages/resourcer.md create mode 100644 docs/cores/packages/sdk.md create mode 100644 docs/cores/packages/server.md create mode 100644 docs/cores/packages/test.md create mode 100644 docs/guide/config.md create mode 100644 docs/guide/getting-started.md create mode 100644 docs/guide/index.md create mode 100644 docs/guide/nocobase.png create mode 100644 docs/index.md create mode 100644 docs/index.zh-CN.md create mode 100644 docs/plugins/concepts/actions.md create mode 100644 docs/plugins/concepts/blocks.md create mode 100644 docs/plugins/concepts/collections.md create mode 100644 docs/plugins/concepts/fields.md create mode 100644 docs/plugins/concepts/hooks.md create mode 100644 docs/plugins/concepts/locales.md create mode 100644 docs/plugins/concepts/middlewares.md create mode 100644 docs/plugins/concepts/migrations.md create mode 100644 docs/plugins/concepts/models.md create mode 100644 docs/plugins/concepts/resources.md create mode 100644 docs/plugins/packages/action-logs.md create mode 100644 docs/plugins/packages/automations.md create mode 100644 docs/plugins/packages/collections.md create mode 100644 docs/plugins/packages/file-manager.md create mode 100644 docs/plugins/packages/pages.md create mode 100644 docs/plugins/packages/permissions.md create mode 100644 docs/plugins/packages/users.md create mode 100644 docs/plugins/tutorials/developer-mode.md create mode 100644 docs/plugins/tutorials/index.md create mode 100644 docs/plugins/tutorials/plugin-cli.md create mode 100644 docs/plugins/tutorials/server-lifecycle.md create mode 100644 docs/plugins/tutorials/testing.md create mode 100644 public/CNAME diff --git a/.dumi/theme/builtins/API.tsx b/.dumi/theme/builtins/API.tsx new file mode 100755 index 000000000..ce815d396 --- /dev/null +++ b/.dumi/theme/builtins/API.tsx @@ -0,0 +1,57 @@ +import React, { useContext } from 'react'; +import type { IApiComponentProps} from 'dumi/theme'; +import { context, useApiData, AnchorLink } from 'dumi/theme'; + +const LOCALE_TEXTS = { + 'zh-CN': { + name: '属性名', + description: '描述', + type: '类型', + default: '默认值', + required: '(必选)', + }, + 'en-US': { + name: 'Name', + description: 'Description', + type: 'Type', + default: 'Default', + required: '(required)', + }, +}; + +export default ({ identifier, export: expt }: IApiComponentProps) => { + const data = useApiData(identifier); + const { locale } = useContext(context); + const texts = /^zh|cn$/i.test(locale) ? LOCALE_TEXTS['zh-CN'] : LOCALE_TEXTS['en-US']; + + return ( + <> + {data && ( + + + + + + + + + + + {data[expt].map(row => ( + + + + + + + ))} + +
{texts.name}{texts.description}{texts.type}{texts.default}
{row.identifier}{row.description || '--'} + {row.type} + + {row.default || (row.required && texts.required) || '--'} +
+ )} + + ); +}; diff --git a/.dumi/theme/builtins/Alert.less b/.dumi/theme/builtins/Alert.less new file mode 100755 index 000000000..988f32486 --- /dev/null +++ b/.dumi/theme/builtins/Alert.less @@ -0,0 +1,68 @@ +@import (reference) '../style/variables.less'; + +.@{prefix}-alert { + @s-border-right: 3px; + + position: relative; + margin: 24px 0; + padding: 15px; + color: @c-text; + font-size: 14px; + line-height: 20px; + border-left: 0; + background: #ffffff; + // box-shadow: 0 6px 16px -2px rgba(0, 0, 0, 0.06); + border-radius: 1px; + + &::after { + content: ''; + position: absolute; + display: inline-block; + top: 0; + left: 0; + bottom: 0; + width: @s-border-right; + border-radius: 1px; + } + + &:first-child { + margin-top: 0; + } + + &:not([type]), + &[type='warning'] { + background-color: #fffbe6; + &::after { + background: #ffe58f; + } + } + + &[type='info'] { + background: rgba(105, 185, 255, .15); + &::after { + background: #69b9ff; + } + .@{prefix}-alert-title { + color: #69b9ff; + } + } + + &[type='success'] { + &::after { + background: #8cd225; + } + } + + &[type='error'] { + &::after { + background: #ff4646; + } + } + + .@{prefix}-alert-title { + margin-top: 0; + font-weight: 600; + color: #fab00e; + margin-bottom: .6em; + } +} diff --git a/.dumi/theme/builtins/Alert.tsx b/.dumi/theme/builtins/Alert.tsx new file mode 100755 index 000000000..9facc10b9 --- /dev/null +++ b/.dumi/theme/builtins/Alert.tsx @@ -0,0 +1,17 @@ +import React from 'react'; +import './Alert.less'; +import { Alert } from 'antd'; +import micromark from 'micromark' + +export default (props: any) => { + const { title, children, ...others } = props; + console.log({children}); + return ( +
+ {title && ( +

{title}

+ )} + {typeof children === 'string' ?
: children} +
+ ) +}; diff --git a/.dumi/theme/builtins/Badge.less b/.dumi/theme/builtins/Badge.less new file mode 100755 index 000000000..dc2de29c9 --- /dev/null +++ b/.dumi/theme/builtins/Badge.less @@ -0,0 +1,31 @@ +@import (reference) '../style/variables.less'; + +.@{prefix}-badge { + display: inline-block; + margin-left: 6px; + padding: 1px 7px; + color: #fff; + font-size: 13px; + line-height: 20px; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.1); + box-shadow: 0 6px 16px -2px rgba(0, 0, 0, 0.06); + border-radius: 1px; + vertical-align: top; + + &:not([type]), + &[type='info'] { + background: #4569d4; + } + + &[type='warning'] { + background: #ffc121; + } + + &[type='success'] { + background: #8cd225; + } + + &[type='error'] { + background: #ff4646; + } +} diff --git a/.dumi/theme/builtins/Badge.tsx b/.dumi/theme/builtins/Badge.tsx new file mode 100755 index 000000000..2572c291c --- /dev/null +++ b/.dumi/theme/builtins/Badge.tsx @@ -0,0 +1,4 @@ +import React from 'react'; +import './Badge.less'; + +export default (props: any) => ; diff --git a/.dumi/theme/builtins/Example.less b/.dumi/theme/builtins/Example.less new file mode 100755 index 000000000..cb829c52e --- /dev/null +++ b/.dumi/theme/builtins/Example.less @@ -0,0 +1,47 @@ +@import (reference) '../style/variables.less'; + +.@{prefix}-example-wrapper { + padding-top: 16px; + height: calc(100vh - @s-nav-height - 2px); + + @media @mobile { + padding-top: 16px; + } + + &-toolbar { + display: flex; + color: @c-heading; + font-size: 16px; + font-weight: 500; + justify-content: space-between; + margin-bottom: 16px; + border-bottom: 1px solid @c-border; + + button, + a { + display: inline-block; + margin: 6px 0 6px 12px; + width: 16px; + height: 16px; + font-weight: 400; + border: 0; + outline: none; + vertical-align: middle; + cursor: pointer; + + &:first-child { + background-position-x: -144px; + } + + &:nth-child(2) { + background-position-x: -126px; + } + } + } + + iframe { + width: 100%; + min-height: 100%; + border: 0; + } +} diff --git a/.dumi/theme/builtins/Example.tsx b/.dumi/theme/builtins/Example.tsx new file mode 100755 index 000000000..7323cd68c --- /dev/null +++ b/.dumi/theme/builtins/Example.tsx @@ -0,0 +1,34 @@ +import React, { useRef, useEffect, useState } from 'react'; +import './Example.less'; + +export default (props: { route: any }) => { + const elm = useRef(); + const [height, setHeight] = useState(0); + + useEffect(() => { + setHeight(elm.current.contentWindow.document.documentElement.scrollHeight); + }, [elm]); + + return ( + props.route.meta.examplePath && ( +
+
+ {props.route.meta.description || props.route.meta.title} + +
+