Skip to content

Commit 18bdd76

Browse files
committed
feat: 🎉 init project
0 parents  commit 18bdd76

File tree

6,966 files changed

+242394
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

6,966 files changed

+242394
-0
lines changed

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
insert_final_newline = false
13+
trim_trailing_whitespace = false

.gitignore

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
/dist
14+
/docs/.vuepress/dist
15+
16+
# misc
17+
.DS_Store
18+
.env.local
19+
.env.development.local
20+
.env.test.local
21+
.env.production.local
22+
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
27+
.env
28+
29+
# add vscode ignore
30+
.history
31+
.vscode/
32+
33+
# add idea ignore
34+
.idea/
35+
# config.yaml
36+
37+
docs/.vuepress/.cache
38+
docs/.vuepress/.temp

.gitlab-ci.yml

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
image: registry.cn-beijing.aliyuncs.com/authing-next/authing-server:ci-base
2+
3+
stages:
4+
- build
5+
6+
before_script:
7+
- git config http.postBuffer 2097152000
8+
- mkdir -p ~/.ssh
9+
- touch ~/.ssh/id_rsa
10+
- touch ~/.ssh/config
11+
- chmod 700 ~/.ssh/id_rsa
12+
- echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
13+
- echo "$SSH_CONFIG" > ~/.ssh/config
14+
- export VERSION=$(cat version.txt)
15+
- VERSION_TAG=${VERSION}
16+
- |
17+
case "$CI_COMMIT_REF_NAME" in
18+
"master")
19+
export VERSION=$(cat version.txt)
20+
OSS_REGION=${OSS_REGION_PROD}
21+
OSS_URL=${CDN_OSS_PROD}
22+
PUBLIC_URL=//cdn.authing.co/authing-docs-v2/${VERSION}/
23+
;;
24+
*)
25+
export VERSION=$(cat version.txt)-${CI_COMMIT_SHORT_SHA}
26+
OSS_REGION=${OSS_REGION_DAILY}
27+
OSS_URL=${CDN_OSS_DAILY}
28+
PUBLIC_URL=//cdn-daily.authing.co/authing-docs-v2/${VERSION}/
29+
;;
30+
esac
31+
32+
# yarn 构建文档并 git 打 tag
33+
build:
34+
cache:
35+
key: node_deps
36+
paths:
37+
- node_modules
38+
stage: build
39+
rules:
40+
- when: manual
41+
script:
42+
- yarn --registry https://registry.npm.taobao.org
43+
- NODE_OPTIONS=--max_old_space_size=8192 PUBLIC_URL=$PUBLIC_URL yarn docs:build
44+
- echo $CI_COMMIT_REF_NAME
45+
- docker build -t authing:docs-new .
46+
- docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWD} ${DOCKER_REPO}
47+
- export IMAGE_NAME=${DOCKER_REPO}/${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}
48+
- docker tag authing:docs-new ${IMAGE_NAME}:${VERSION}
49+
- docker push ${IMAGE_NAME}:${VERSION}
50+
- docker image rm authing:docs-new
51+
- docker image rm ${IMAGE_NAME}:${VERSION}
52+
- echo $OSS_URL
53+
- echo $OSS_REGION
54+
- >
55+
ossutil --access-key-id ${ALIYUN_ACCESS_KEY}
56+
--access-key-secret ${ALIYUN_ACCESS_KEY_SECRET}
57+
-e ${OSS_REGION} cp -r -f docs/.vuepress/dist oss://${OSS_URL}/authing-docs-v2/${VERSION}/
58+
# 只有彻底成功了才打 tag,避免重试时版本号问题
59+
- |
60+
case "$CI_COMMIT_REF_NAME" in
61+
"master")
62+
git config --global user.name "${GITLAB_USER_NAME}"
63+
git config --global user.email "${GITLAB_USER_EMAIL}"
64+
# 这个傻逼 tag 一直报错
65+
git tag -d 1.1.95
66+
git tag -a ${VERSION} -m "${VERSION}"
67+
git push [email protected]:authing-next/authing-docs-v2.git --tags
68+
;;
69+
*)
70+
71+
;;
72+
esac

Dockerfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# FROM node:12.14.0 as PATH_IMAGE
2+
# ENV NODE_OPTIONS=--max_old_space_size=5120
3+
# WORKDIR /app
4+
# COPY package.json .
5+
# RUN yarn --registry https://registry.npm.taobao.org/
6+
# COPY . .
7+
# RUN npm run docs:build
8+
9+
FROM nginx:alpine
10+
COPY docs/.vuepress/dist /docs
11+
COPY docs/.vuepress/dist /docs/v2
12+
COPY nginx.conf /etc/nginx/conf.d/default.conf
13+
EXPOSE 80

README.md

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Authing doc
2+
3+
## 使用
4+
5+
```bash
6+
# start dev server
7+
npm run docs:dev
8+
9+
# delete cache then build
10+
npm run docs:no-cache
11+
12+
# build to static HTMLs in docs/.vuepress/dist
13+
npm run docs:build
14+
```
15+
16+
## 常用组件
17+
18+
`page-ref`:
19+
20+
```bash
21+
# 普通 md: 绝对路径
22+
23+
::: page-ref /quickstart/hello-world.md
24+
:::
25+
26+
# README.md 可省略
27+
::: page-ref /scan-qrcode/wxapp-qrcode/
28+
:::
29+
30+
```
31+
32+
`embed`:
33+
34+
```bash
35+
::: embed
36+
[title](link)
37+
:::
38+
```
39+
40+
`hints`:
41+
42+
```bash
43+
::: hint-success
44+
text
45+
:::
46+
47+
::: hint-info
48+
::: hint-warning
49+
::: hint-danger
50+
```
51+
52+
`api-method`:
53+
54+
````markdown
55+
<!-- 组件的 prop 都可以用 slot 代替,纯字符串时可以用 prop,有 Markdown 时用 slot -->
56+
57+
<ApiMethodSpec method="get" host="https://core.authing.cn" path="/oauth/me" summary="使用 access_token 换取用户信息">
58+
<template slot="queryParams">
59+
<ApiMethodParam name="access_token" type="string" required description="access_token" />
60+
</template>
61+
<template slot="response">
62+
<ApiMethodResponse httpCode="200" description="请求结果">
63+
64+
```json
65+
{
66+
"a": "1"
67+
}
68+
```
69+
70+
</ApiMethodResponse>
71+
</template>
72+
</ApiMethodSpec>
73+
````
74+
75+
## 插值
76+
77+
按 vue 语法使用插值,可以在具体 md 文件的头部定义,也可使用全局变量(即 config 中的所有配置),常用的全局插值如下:
78+
79+
- \$localeConfig.brandName,品牌名,如 Authing
80+
- \$themeConfig.apiDomain,api 地址
81+
- \$themeConfig.sampleAppDomain,体验地址
82+
- \$themeConfig.consoleDomain,控制台地址
83+
84+
## 注意!!!
85+
86+
写好的文档发布完后要去线上看一眼,刷新页面,然后点击菜单看能否跳到其他页面。很多情况会报以下错,会导致后续 vue 代码无法执行,跳转不了页面:
87+
88+
```
89+
DOMException: Failed to execute 'appendChild' on 'Node': This node type does not support this method.
90+
```
91+
92+
### 加粗内容不能有中文标点符号
93+
94+
### 链接无法加粗
95+
96+
如:
97+
98+
```markdown
99+
[**百度**](https://baidu.com)
100+
**[百度](https://baidu.com)**
101+
```
102+
103+
都会导致报错,可用如下方法实现
104+
105+
```html
106+
<a class="strong" href="https://baidu.com" target="_blank">百度</a>
107+
```

build-docs-v2-prod.sh

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
# 本地 build 文档并上传 docker 仓库和 OSS
3+
./.env
4+
VERSION=$(cat version.txt)
5+
PUBLIC_URL=//cdn.authing.co/authing-docs-v2/${VERSION}/
6+
OSS_URL=authing-cdn-cn-prod
7+
OSS_REGION=oss-cn-beijing.aliyuncs.com
8+
# 构建文档
9+
PUBLIC_URL=$PUBLIC_URL yarn docs:build
10+
# 上传产物到 docker
11+
docker build -t authing:docs-new .
12+
docker login -u ${DOCKER_REPO_USERNAME} -p ${DOCKER_REPO_PASSWORD} ${DOCKER_REPO_HOST}
13+
docker tag authing:docs-new registry.cn-beijing.aliyuncs.com/authing-next/authing-docs-v2:${VERSION}
14+
docker push registry.cn-beijing.aliyuncs.com/authing-next/authing-docs-v2:${VERSION}
15+
# 上传静态文件到 OSS
16+
ossutil --access-key-id ${ALIYUN_ACCESS_KEY} --access-key-secret ${ALIYUN_ACCESS_KEY_SECRET} -e ${OSS_REGION} cp -r -f docs/.vuepress/dist oss://${OSS_URL}/authing-docs-v2/${VERSION}/
17+
echo "完成"

config.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ga:
2+
enabled: true
3+
gTrackingId: G-B1XMPFE9RK

docker-compose.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: "3.4"
2+
services:
3+
core:
4+
image: registry.cn-beijing.aliyuncs.com/teamory/docs:latest
5+
ports:
6+
- 3200:80

0 commit comments

Comments
 (0)