Skip to content

Commit 8edf7b6

Browse files
committed
refactor: generate directory.json and directory_ee.json from yaml
1 parent 858cb7d commit 8edf7b6

29 files changed

+660
-1057
lines changed

.github/workflows/check_markdown.yaml

+8-4
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,19 @@ jobs:
1919
steps:
2020
- name: check out code
2121
uses: actions/checkout@main
22-
22+
2323
- name: check directory config
24-
run: python3 .github/workflows/directory_check.py directory.json $(pwd)
24+
run: |
25+
python3 ./gen.py ce | tee directory.json
26+
python3 .github/workflows/directory_check.py directory.json $(pwd)
2527
2628
enterprise_directory_check:
2729
runs-on: ubuntu-latest
2830
steps:
2931
- name: check out code
3032
uses: actions/checkout@main
31-
33+
3234
- name: check enterprise directory config
33-
run: python3 .github/workflows/directory_check.py directory_ee.json $(pwd)
35+
run: |
36+
python3 ./gen.py ee | tee directory_ee.json
37+
python3 .github/workflows/directory_check.py directory_ee.json $(pwd)

.github/workflows/deploy_docs.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ jobs:
5656
with:
5757
node-version: 14.15
5858

59+
- name: generate directory.json
60+
run |
61+
cd docs-files
62+
./gen.py ce | tee directory.json
63+
./gen.py ee | tee directory_ee.json
64+
5965
- name: remove unused files
6066
run: |
6167
cd docs-files

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ book.pdf
77
*.pdf
88
.DS_Store
99
/.idea/
10+
directory.json
11+
directory_ee.json

DOCS-WRITING-GUIDE-CN.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ EMQ 文档使用 Markdown 格式编写,并使用 [Vuepress](https://vuepress.v
4242

4343
### 配置文件
4444

45-
目录配置文件为文档根目录下的 `directory.json`(企业版为 `directory_ee.json`)。如下所示:
46-
47-
![directory](./assets/directory.jpg)
45+
目录配置文件为文档根目录下的 dir.yaml:
4846

4947
### 配置示例
5048

DOCS-WRITING-GUIDE-EN.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ The final presentation of the documentation can be divided into three parts:
4343

4444
### Configuration files
4545

46-
The menu configuration file is `directory.json` (`directory_ee.json` for Enterprise) in the document root directory. This is shown below:
47-
48-
![directory](./assets/directory.jpg)
46+
The menu configuration file is `dir.yaml` in the document root directory. This is shown below:
4947

5048
### Configuration examples
5149

README-CN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ EMQX 是一款完全开源,高度可伸缩,高可用的分布式 [MQTT](http
3535
./preview.sh ee 8080
3636
```
3737

38-
现在浏览器打开 <http://localhost:8080/docs/zh/latest/> 或者 <http://localhost:8080/zh/enterprise/latest/>, 如果更新了 `directory.json``directory_ee.json` 文件, 你需要重新运行上面的命令。
38+
现在浏览器打开 <http://localhost:8080/docs/zh/latest/> 或者 <http://localhost:8080/zh/enterprise/latest/>, 如果更新了 dir.yaml 文件, 你需要重新运行上面的命令。
3939

4040
## 联系我们
4141

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ See [EMQX Documentation Contributing Guide](./CONTRIBUTING-EN.md) to become a co
3333
./preview.sh ee 8080
3434
```
3535

36-
Now, open <http://localhost:8080/docs/en/latest/> or <http://localhost:8080/en/enterprise/latest/>, if `directory.json` and `directory_ee.json` has been updated, you can re-run the above command to update the docs.
36+
Now, open <http://localhost:8080/docs/en/latest/> or <http://localhost:8080/en/enterprise/latest/>, if dir.yaml has been updated, you can re-run the above command to update the docs.
3737

3838
## Release a New Version
3939

assets/directory.jpg

-105 KB
Binary file not shown.

dir.yaml

+192
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
---
2+
3+
# How it is organised
4+
#
5+
# - Each doc node is a yaml dict
6+
# - A doc node is either a grouping node or a content node
7+
# - A doc node may have edition: ee for enterprise only content
8+
#
9+
# Grouping node
10+
# - Must have a 'title_en' (English), 'title_cn' (Chinese) is optional wehn no need to translate. e.g. FAQ
11+
# - Parent nodes must NOT have a 'path'
12+
#
13+
# Content node can be one of:
14+
# - Just the path to the markdown file (the first lien of which is extracted as its title)
15+
# the path is relative inside the per-language sub-dir i.e. en_US and zh_CN
16+
# - A node with 'title_en' 'title_cn' and 'path'
17+
18+
- title_en: Introduction
19+
title_cn: 概览
20+
path: "./" # this is the index page, {en_US,zh_CN}/README.md is the content
21+
22+
- title_en: Quick Start
23+
title_cn: 快速开始
24+
path: getting-started/getting-started
25+
26+
- title_en: Deployment & Provisioning
27+
title_cn: 安装与部署
28+
children:
29+
- tutorial/tune
30+
- getting-started/install
31+
- getting-started/directory
32+
- getting-started/start
33+
- advanced/relup
34+
- advanced/patches
35+
- getting-started/cluster # TODO merge down
36+
- advanced/cluster # TODO merge up
37+
- tutorial/load-balancing
38+
39+
- title_en: Management Interfaces
40+
title_cn: 管理接口
41+
children:
42+
- getting-started/config ## TODO merge down
43+
- configuration/configuration ## TODO merge up
44+
- configuration/environment-variable
45+
- advanced/http-api
46+
- advanced/cli # TODO: merge down
47+
- getting-started/command-line # TODO: merge up
48+
- getting-started/dashboard
49+
50+
- title_en: Security
51+
title_cn: 安全
52+
children:
53+
- title_en: Authentication
54+
title_cn: 认证
55+
children:
56+
- advanced/auth
57+
- advanced/auth-mnesia
58+
- advanced/auth-http
59+
- advanced/auth-jwt
60+
- advanced/auth-ldap
61+
- advanced/auth-mysql
62+
- advanced/auth-postgresql
63+
- advanced/auth-redis
64+
- advanced/auth-mongodb
65+
- title_en: Authorisation (ACL)
66+
title_cn: 鉴权(ACL)
67+
children:
68+
- advanced/acl
69+
- advanced/acl-file
70+
- advanced/acl-mnesia
71+
- advanced/acl-http
72+
- advanced/acl-mysql
73+
- advanced/acl-postgres
74+
- advanced/acl-redis
75+
- advanced/acl-mongodb
76+
- advanced/blacklist
77+
78+
- title_en: Observability
79+
title_cn: 监控与运维
80+
children:
81+
- getting-started/log
82+
- tutorial/prometheus
83+
- modules/tracer
84+
- modules/slow_subscribers_statistics
85+
- advanced/metrics-and-stats
86+
- advanced/alarms
87+
- advanced/telemetry
88+
89+
- title_en: Reliability
90+
title_cn: 可靠性
91+
children:
92+
- advanced/rate-limit
93+
- advanced/config-and-data-backup-restore
94+
95+
- title_en: Advanced MQTT Features
96+
title_cn: MQTT 高级特性
97+
children:
98+
- advanced/retained
99+
- advanced/shared-subscriptions
100+
- advanced/delayed-publish
101+
- advanced/auto-subscriptions
102+
- advanced/topic-rewrite
103+
- advanced/system-topic
104+
105+
- title_en: Data Integration (Rule Engine)
106+
title_cn: 数据集成(规则引擎)
107+
children:
108+
- rule/rule-engine
109+
- rule/rule-engine_grammar_and_examples
110+
- rule/rule-engine_field
111+
- rule/rule-engine_buildin_function
112+
- rule/rule-create
113+
- rule/how_to_update_resources
114+
- rule/rule-example
115+
116+
- title_en: Gateway
117+
title_cn: 网关
118+
children:
119+
- modules/lwm2m_protocol
120+
- modules/mqtt_sn_protocol
121+
- modules/tcp_protocol
122+
- modules/jt808_protocol
123+
- modules/coap_protocol
124+
- modules/stomp_protocol
125+
126+
- title_en: Cluster Link
127+
title_cn: 集群互联
128+
children:
129+
- bridge/bridge
130+
- advanced/bridge ## TODO merge down
131+
- bridge/bridge-mqtt ## TODO merge up
132+
133+
- title_en: Plugins & Extensions
134+
title_cn: 插件与扩展
135+
children:
136+
# TODO: add Introduction
137+
# TODO: add plugin development doc
138+
- advanced/hooks
139+
- advanced/webhook
140+
- advanced/lang-exhook
141+
- advanced/lang-exproto
142+
143+
- title_en: Persistence Backends
144+
title_cn: 数据持久化
145+
edition: ee
146+
children:
147+
- backend/backend
148+
- backend/backend_cassandra
149+
- backend/backend_dynamodb
150+
- backend/backend_influxdb
151+
- backend/backend_mongodb
152+
- backend/backend_mysql
153+
- backend/backend_opentsdb
154+
- backend/backend_pgsql
155+
- backend/backend_redis
156+
- backend/backend_timescale
157+
158+
- title_en: Misc Functionality # TODO: better title?
159+
title_cn: 其他功能
160+
children:
161+
- tutorial/device-management
162+
163+
- title_en: Design & Implementation
164+
title_cn: 设计与实现
165+
children:
166+
- advanced/inflight-window-and-message-queue
167+
- advanced/retransmission
168+
- title_en: SDK & Tools
169+
title_cn: SDK与工具
170+
children:
171+
- development/client
172+
- development/c
173+
- development/java
174+
- development/go
175+
- development/erlang
176+
- development/javascript
177+
- development/python
178+
- development/resource
179+
- design/design
180+
181+
- title_en: Load tests
182+
title_cn: 压力测试
183+
children:
184+
- tutorial/benchmark
185+
186+
- title_en: FAQ
187+
children:
188+
- faq/faq
189+
- faq/use-guide
190+
- faq/deployment
191+
- faq/error
192+
- faq/enterprise

0 commit comments

Comments
 (0)