config.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. const moment = require("moment");
  2. module.exports = {
  3. title: "go-zero",
  4. description: "集成各种工程实践的 WEB 和 RPC 框架",
  5. head: [
  6. ["link", { rel: "icon", href: "/logo.png" }],
  7. [
  8. "meta",
  9. {
  10. name: "keywords",
  11. content: "Go,golang,zero,go-zero,micro service,gRPC",
  12. },
  13. ],
  14. ],
  15. markdown: {
  16. lineNumbers: true, // 代码块显示行号
  17. },
  18. themeConfig: {
  19. nav: [
  20. {
  21. text: "首页",
  22. link: "/",
  23. },
  24. {
  25. text: "框架文档",
  26. link: "/zero/",
  27. },
  28. {
  29. text: "go-zero",link: "https://github.com/tal-tech/go-zero",
  30. },
  31. {
  32. text: "CDS",link: "https://github.com/tal-tech/cds",
  33. },
  34. ],
  35. docsDir: "docs",
  36. docsBranch: "main",
  37. editLinks: true,
  38. editLinkText: "在github.com上编辑此页",
  39. sidebar: {
  40. '/zero/': getGoZeroSidebar('简介', '开发指南', 'core', 'rest', 'zrpc', 'goctl', '源码解读', 'awesome'),
  41. },
  42. sidebarDepth: 2,
  43. lastUpdated: "上次更新",
  44. serviceWorker: {
  45. updatePopup: {
  46. message: "发现新内容可用",
  47. buttonText: "刷新",
  48. },
  49. },
  50. },
  51. plugins: [
  52. [
  53. "@vuepress/last-updated",
  54. {
  55. transformer: (timestamp, lang) => {
  56. // 不要忘了安装 moment
  57. const moment = require("moment");
  58. moment.locale("zh-cn");
  59. return moment(timestamp).format("YYYY-MM-DD HH:mm:ss");
  60. },
  61. dateOptions: {
  62. hours12: true,
  63. },
  64. },
  65. ],
  66. [
  67. '@vssue/vuepress-plugin-vssue',
  68. {
  69. platform: 'github', // v3的platform是github,v4的是github-v4
  70. locale: 'zh', // 语言
  71. // 其他的 Vssue 配置
  72. owner: 'tal-tech', // github账户名
  73. repo: 'zero-doc', // github一个项目的名称
  74. clientId: '1252229e5b787945392d', // 注册的Client ID
  75. clientSecret: 'c424d19a9cb758d0800f644376b0b4dd24828c94', // 注册的Client Secret
  76. autoCreateIssue: false // 自动创建评论,默认是false,最好开启,这样首次进入页面的时候就不用去点击创建评论的按钮了。
  77. },
  78. ],
  79. "@vuepress/back-to-top",
  80. "@vuepress/active-header-links",
  81. "@vuepress/medium-zoom",
  82. "@vuepress/nprogress",
  83. ],
  84. };
  85. // go-zero main document file
  86. function getGoZeroSidebar(A, B, C, D, E, F, G, H) {
  87. return [
  88. {
  89. title: A,
  90. collapsable: false,
  91. children: [
  92. ['', 'go-zero 简介'],
  93. 'bookstore',
  94. ]
  95. },
  96. {
  97. title: B,
  98. collapsable: false,
  99. children: [
  100. '开发指南',
  101. '快速开始',
  102. '功能描述',
  103. ['HTTP Middleware', 'HTTP Middleware'],
  104. '自定义错误返回',
  105. '创建API服务',
  106. 'model生成',
  107. '用户注册',
  108. '用户登陆',
  109. 'JWT生成',
  110. '获取用户信息(JWT鉴权)',
  111. '获取用户信息(header)',
  112. '中间件使用',
  113. 'rpc调用',
  114. ]
  115. },
  116. {
  117. title: C,
  118. collapsable: false,
  119. children: [
  120. ['logx', 'logx'],
  121. 'bloom',
  122. 'executors',
  123. 'streamapi-fx',
  124. ['timingWheel', 'timingWheel'],
  125. 'periodlimit',
  126. 'tokenlimit',
  127. ['store all', 'store all'],
  128. 'store mysql',
  129. 'redis-lock',
  130. ]
  131. },
  132. {
  133. title: D,
  134. collapsable: false,
  135. children: [
  136. ['server', 'server'],
  137. 'JWT鉴权中间件',
  138. '自适应融断中间件',
  139. '验签中间件',
  140. 'TraceHandler',
  141. 'params',
  142. 'router',
  143. 'tokenparser',
  144. 'rest engine',
  145. ]
  146. },
  147. {
  148. title: E,
  149. collapsable: false,
  150. children: [
  151. ['zrpc简介', '简介'],
  152. ['zrpc目录结构', '目录结构'],
  153. '参数配置客户端',
  154. '参数配置服务端',
  155. '项目创建',
  156. ['zrpc服务端', '服务端'],
  157. ['zrpc客户端', '客户端'],
  158. '自定义拦截器',
  159. '服务注册',
  160. '负载均衡',
  161. ]
  162. },
  163. {
  164. title: F,
  165. collapsable: false,
  166. children: [
  167. 'goctl-overview',
  168. 'goctl-api',
  169. 'goctl-rpc',
  170. 'goctl-model',
  171. 'goctl-template',
  172. 'goctl-plugin',
  173. 'goctl-docker',
  174. 'goctl-kube',
  175. '附录1',
  176. '附录2',
  177. '附录3',
  178. ]
  179. },
  180. {
  181. title: H,
  182. collapsable: false,
  183. children: [
  184. '10月3日线上交流问题汇总',
  185. ]
  186. },
  187. ]
  188. }