You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/02/24 05:17:45 UTC

[GitHub] [apisix-website] qier222 opened a new pull request #202: feat: multiple features for docs

qier222 opened a new pull request #202:
URL: https://github.com/apache/apisix-website/pull/202


   ### Changes:
   feat: multiple features for docs
   
   ### Screenshots of the change:
   <img width="1392" alt="CleanShot 2021-02-24 at 13 16 29@2x" src="https://user-images.githubusercontent.com/68148142/108951261-9a462580-76a2-11eb-90d8-1dea78eb04e0.png">
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] juzhiyuan commented on pull request #202: feat: multiple features for docs

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on pull request #202:
URL: https://github.com/apache/apisix-website/pull/202#issuecomment-785544369


   @qier222 Please add a blank line in another PR if needed.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] juzhiyuan commented on pull request #202: feat: multiple features for docs

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on pull request #202:
URL: https://github.com/apache/apisix-website/pull/202#issuecomment-785544204


   > Where are these documents placed? ping @qier222
   > 
   > ![image](https://user-images.githubusercontent.com/6814606/109097412-3bdc7e00-775a-11eb-9c26-1320cd1eda2e.png)
   
   @membphis in General folder


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] qier222 commented on a change in pull request #202: feat: multiple features for docs

Posted by GitBox <gi...@apache.org>.
qier222 commented on a change in pull request #202:
URL: https://github.com/apache/apisix-website/pull/202#discussion_r582526418



##########
File path: website/i18n/zh-cn/docusaurus-plugin-content-docs/version-2.3.json
##########
@@ -0,0 +1,10 @@
+{
+  "version.label": {
+    "message": "2.3",
+    "description": "The label for version 2.3"
+  },
+  "sidebar.docs.category.APISIX™️": {
+    "message": "APISIX™️",
+    "description": "The label for category APISIX™️ in sidebar docs"
+  }
+}

Review comment:
       These files are generated by docusaurus cli, I didn't change it in my code editor. Maybe we can use husky* to format codes when commit.
   
   * [husky GitHub repo](https://github.com/typicode/husky)




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] qier222 commented on pull request #202: feat: multiple features for docs

Posted by GitBox <gi...@apache.org>.
qier222 commented on pull request #202:
URL: https://github.com/apache/apisix-website/pull/202#issuecomment-785559570


   General docs 👉
   APISIX English docs 👉 /website/
   👉
   👉
   👉


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] qier222 commented on a change in pull request #202: feat: multiple features for docs

Posted by GitBox <gi...@apache.org>.
qier222 commented on a change in pull request #202:
URL: https://github.com/apache/apisix-website/pull/202#discussion_r581801227



##########
File path: website/src/theme/DocPage/index.js
##########
@@ -0,0 +1,101 @@
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.

Review comment:
       Generate when executing `docusaurus swizzle @docusaurus/theme-classic DocPage`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] membphis commented on a change in pull request #202: feat: multiple features for docs

Posted by GitBox <gi...@apache.org>.
membphis commented on a change in pull request #202:
URL: https://github.com/apache/apisix-website/pull/202#discussion_r582470908



##########
File path: website/i18n/zh-cn/docusaurus-plugin-content-docs/version-2.3.json
##########
@@ -0,0 +1,10 @@
+{
+  "version.label": {
+    "message": "2.3",
+    "description": "The label for version 2.3"
+  },
+  "sidebar.docs.category.APISIX™️": {
+    "message": "APISIX™️",
+    "description": "The label for category APISIX™️ in sidebar docs"
+  }
+}

Review comment:
       please update your code editor, it can help you add a blank line at the end of the file automatically.

##########
File path: .github/workflows/updateDocs.yaml
##########
@@ -0,0 +1,27 @@
+name: Sync Docs from projects
+
+on:
+  push:
+    branches: [master]
+  schedule:
+    # Run everyday at 6:00 AM (See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07)
+    - cron: "0 6 * * *"

Review comment:
       nice!

##########
File path: website/src/theme/DocSidebar/styles.module.css
##########
@@ -0,0 +1,131 @@
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+:root {
+  --collapse-button-bg-color-dark: #2e333a;
+}
+
+@media (min-width: 997px) {
+  .sidebar {
+    display: flex;
+    flex-direction: column;
+    height: 100vh;
+    position: sticky;
+    top: 0;
+    padding-top: var(--ifm-navbar-height);
+    width: var(--doc-sidebar-width);
+    transition: opacity 50ms ease;
+  }
+
+  .sidebarVersionSwitch {
+  display: flex;
+  align-items:center;
+  padding: 4px 1rem;
+  margin: 1rem;
+  border-radius: 0.5rem;
+  border: 1px solid #eee;
+  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
+  }
+
+  .sidebarWithHideableNavbar {
+    padding-top: 0;
+  }
+
+  .sidebarHidden {
+    opacity: 0;
+    height: 0;
+    overflow: hidden;
+    visibility: hidden;
+  }
+
+  .sidebarLogo {
+    display: flex !important;
+    align-items: center;
+    margin: 0 var(--ifm-navbar-padding-horizontal);
+    min-height: var(--ifm-navbar-height);
+    max-height: var(--ifm-navbar-height);
+    color: inherit !important;
+    text-decoration: none !important;
+  }
+
+  .sidebarLogo img {
+    margin-right: 0.5rem;
+    height: 2rem;
+  }
+
+  .menu {
+    flex-grow: 1;
+    padding: 0.5rem;
+  }
+
+  .menuLinkText {
+    cursor: initial;
+  }
+
+  .menuLinkText:hover {
+    background: none;
+  }
+
+  .menuWithAnnouncementBar {
+    margin-bottom: var(--docusaurus-announcement-bar-height);
+  }
+
+  .collapseSidebarButton {
+    display: block !important;
+    background-color: var(--ifm-button-background-color);
+    height: 40px;
+    position: sticky;
+    bottom: 0;
+    border-radius: 0;
+  }
+
+  .collapseSidebarButtonIcon {
+    transform: rotate(180deg);
+    margin-top: 4px;
+  }
+
+  html[data-theme='dark'] .collapseSidebarButton {
+    background-color: var(--collapse-button-bg-color-dark);
+    border: none;
+    border-left: 1px solid var(--ifm-toc-border-color);
+  }
+
+  html[data-theme='dark'] .collapseSidebarButton:hover,
+  html[data-theme='dark'] .collapseSidebarButton:focus {
+    background-color: var(--ifm-color-emphasis-200);
+  }
+}
+
+.sidebarLogo,
+.collapseSidebarButton {
+  display: none;
+}
+
+.sidebarMenuIcon {
+  vertical-align: middle;
+}
+
+.sidebarMenuCloseIcon {
+  display: inline-flex;
+  justify-content: center;
+  align-items: center;
+  height: 24px;
+  font-size: 1.5rem;
+  font-weight: var(--ifm-font-weight-bold);
+  line-height: 0.9;
+  width: 24px;
+}
+
+:global(.menu__list) :global(.menu__list) {
+  overflow-y: hidden;
+  will-change: height;
+  transition: height var(--ifm-transition-fast) linear;
+}
+
+:global(.menu__list-item--collapsed) :global(.menu__list) {
+  height: 0px !important;
+}

Review comment:
       ditto

##########
File path: website/i18n/zh-cn/docusaurus-theme-classic/navbar.json
##########
@@ -0,0 +1,38 @@
+{
+  "title": {
+    "message": "Apache APISIX™",
+    "description": "The title in the navbar"
+  },
+  "item.label.Docs": {
+    "message": "文档",
+    "description": "Navbar item with label Docs"
+  },
+  "item.label.Blog": {
+    "message": "博客",
+    "description": "Navbar item with label Blog"
+  },
+  "item.label.Events": {
+    "message": "Events",
+    "description": "Navbar item with label Events"
+  },
+  "item.label.Downloads": {
+    "message": "下载",
+    "description": "Navbar item with label Downloads"
+  },
+  "item.label.Team": {
+    "message": "团队",
+    "description": "Navbar item with label Team"
+  },
+  "item.label.Help": {
+    "message": "Help",
+    "description": "Navbar item with label Help"
+  },
+  "item.label.APISIX": {
+    "message": "APISIX",
+    "description": "Navbar item with label APISIX"
+  },
+  "item.label.APISIX Dashboard": {
+    "message": "APISIX Dashboard",
+    "description": "Navbar item with label APISIX Dashboard"
+  }
+}

Review comment:
       ditto

##########
File path: website/src/theme/DocSidebar/index.js
##########
@@ -0,0 +1,220 @@
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+import React, { useState, useCallback, useEffect, useRef } from 'react';
+import clsx from 'clsx';
+import { useThemeConfig, isSamePath } from '@docusaurus/theme-common';
+import useUserPreferencesContext from '@theme/hooks/useUserPreferencesContext';
+import useLockBodyScroll from '@theme/hooks/useLockBodyScroll';
+import useWindowSize, { windowSizes } from '@theme/hooks/useWindowSize';
+import useScrollPosition from '@theme/hooks/useScrollPosition';
+import Link from '@docusaurus/Link';
+import isInternalUrl from '@docusaurus/isInternalUrl';
+import Logo from '@theme/Logo';
+import IconArrow from '@theme/IconArrow';
+import IconMenu from '@theme/IconMenu';
+import styles from './styles.module.css';
+import DocsVersionDropdownNavbarItem from "@theme/NavbarItem/DocsVersionDropdownNavbarItem"
+
+const MOBILE_TOGGLE_SIZE = 24;
+
+
+function usePrevious(value) {
+  const ref = useRef(value);
+  useEffect(() => {
+    ref.current = value;
+  }, [value]);
+  return ref.current;
+}
+
+const isActiveSidebarItem = (item, activePath) => {
+  if (item.type === 'link') {
+    return isSamePath(item.href, activePath);
+  }
+
+  if (item.type === 'category') {
+    return item.items.some(subItem => isActiveSidebarItem(subItem, activePath));
+  }
+
+  return false;
+};
+
+function DocSidebarItemCategory({
+  item,
+  onItemClick,
+  collapsible,
+  activePath,
+  ...props
+}) {
+  const {
+    items,
+    label
+  } = item;
+  const isActive = isActiveSidebarItem(item, activePath);
+  const wasActive = usePrevious(isActive); // active categories are always initialized as expanded
+  // the default (item.collapsed) is only used for non-active categories
+
+  const [collapsed, setCollapsed] = useState(() => {
+    if (!collapsible) {
+      return false;
+    }
+
+    return isActive ? false : item.collapsed;
+  });
+  const menuListRef = useRef(null);
+  const [menuListHeight, setMenuListHeight] = useState(undefined);
+
+  const handleMenuListHeight = (calc = true) => {
+    setMenuListHeight(calc ? `${menuListRef.current?.scrollHeight}px` : undefined);
+  }; // If we navigate to a category, it should automatically expand itself
+
+
+  useEffect(() => {
+    const justBecameActive = isActive && !wasActive;
+
+    if (justBecameActive && collapsed) {
+      setCollapsed(false);
+    }
+  }, [isActive, wasActive, collapsed]);
+  const handleItemClick = useCallback(e => {
+    e.preventDefault();
+
+    if (!menuListHeight) {
+      handleMenuListHeight();
+    }
+
+    setTimeout(() => setCollapsed(state => !state), 100);
+  }, [menuListHeight]);
+
+  if (items.length === 0) {
+    return null;
+  }
+
+  return <li className={clsx('menu__list-item', {
+    'menu__list-item--collapsed': collapsed
+  })} key={label}>
+      <a className={clsx('menu__link', {
+      'menu__link--sublist': collapsible,
+      'menu__link--active': collapsible && isActive,
+      [styles.menuLinkText]: !collapsible
+    })} onClick={collapsible ? handleItemClick : undefined} href={collapsible ? '#!' : undefined} {...props}>
+        {label}
+      </a>
+      <ul className="menu__list" ref={menuListRef} style={{
+      height: menuListHeight
+    }} onTransitionEnd={() => {
+      if (!collapsed) {
+        handleMenuListHeight(false);
+      }
+    }}>
+        {items.map(childItem => <DocSidebarItem tabIndex={collapsed ? '-1' : '0'} key={childItem.label} item={childItem} onItemClick={onItemClick} collapsible={collapsible} activePath={activePath} />)}
+      </ul>
+    </li>;
+}
+
+function DocSidebarItemLink({
+  item,
+  onItemClick,
+  activePath,
+  collapsible: _collapsible,
+  ...props
+}) {
+  const {
+    href,
+    label
+  } = item;
+  const isActive = isActiveSidebarItem(item, activePath);
+  return <li className="menu__list-item" key={label}>
+      <Link className={clsx('menu__link', {
+      'menu__link--active': isActive
+    })} to={href} {...isInternalUrl(href) ? {
+      isNavLink: true,
+      exact: true,
+      onClick: onItemClick
+    } : {
+      target: '_blank',
+      rel: 'noreferrer noopener'
+    }} {...props}>
+        {label}
+      </Link>
+    </li>;
+}
+
+function DocSidebarItem(props) {
+  switch (props.item.type) {
+    case 'category':
+      return <DocSidebarItemCategory {...props} />;
+
+    case 'link':
+    default:
+      return <DocSidebarItemLink {...props} />;
+  }
+}
+
+function DocSidebar({
+  path,
+  sidebar,
+  sidebarCollapsible = true,
+  onCollapse,
+  isHidden,
+  docPluginId
+}) {
+  const [showResponsiveSidebar, setShowResponsiveSidebar] = useState(false);
+  const {
+    navbar: {
+      hideOnScroll
+    },
+    hideableSidebar
+  } = useThemeConfig();
+  const {
+    isAnnouncementBarClosed
+  } = useUserPreferencesContext();
+  const {
+    scrollY
+  } = useScrollPosition();
+  useLockBodyScroll(showResponsiveSidebar);
+  const windowSize = useWindowSize();
+  useEffect(() => {
+    if (windowSize === windowSizes.desktop) {
+      setShowResponsiveSidebar(false);
+    }
+  }, [windowSize]);
+
+  return <div className={clsx(styles.sidebar, {
+    [styles.sidebarWithHideableNavbar]: hideOnScroll,
+    [styles.sidebarHidden]: isHidden
+  })}>
+
+    <div className={styles.sidebarVersionSwitch}>
+    Version: <DocsVersionDropdownNavbarItem docsPluginId={docPluginId} dropdownItemsBefore={[]} dropdownItemsAfter={[]} />
+    </div>
+
+      {hideOnScroll && <Logo tabIndex={-1} className={styles.sidebarLogo} />}
+      <div className={clsx('menu', 'menu--responsive', 'thin-scrollbar', styles.menu, {
+      'menu--show': showResponsiveSidebar,
+      [styles.menuWithAnnouncementBar]: !isAnnouncementBarClosed && scrollY === 0
+    })}>
+        <button aria-label={showResponsiveSidebar ? 'Close Menu' : 'Open Menu'} aria-haspopup="true" className="button button--secondary button--sm menu__button" type="button" onClick={() => {
+        setShowResponsiveSidebar(!showResponsiveSidebar);
+      }}>
+          {showResponsiveSidebar ? <span className={clsx(styles.sidebarMenuIcon, styles.sidebarMenuCloseIcon)}>
+              &times;
+            </span> : <IconMenu className={styles.sidebarMenuIcon} height={MOBILE_TOGGLE_SIZE} width={MOBILE_TOGGLE_SIZE} />}
+        </button>
+        <ul className="menu__list">
+          {sidebar.map(item => <DocSidebarItem key={item.label} item={item} onItemClick={e => {
+          e.target.blur();
+          setShowResponsiveSidebar(false);
+        }} collapsible={sidebarCollapsible} activePath={path} />)}
+        </ul>
+      </div>
+      {hideableSidebar && <button type="button" title="Collapse sidebar" aria-label="Collapse sidebar" className={clsx('button button--secondary button--outline', styles.collapseSidebarButton)} onClick={onCollapse}>
+          <IconArrow className={styles.collapseSidebarButtonIcon} aria-label="Collapse sidebar" />
+        </button>}
+    </div>;
+}
+
+export default DocSidebar;

Review comment:
       ditto

##########
File path: website/i18n/zh-cn/docusaurus-theme-classic/footer.json
##########
@@ -0,0 +1,58 @@
+{
+  "link.title.ASF": {
+    "message": "ASF",
+    "description": "The title of the footer links column with title=ASF in the footer"
+  },
+  "link.title.Community": {
+    "message": "Community",
+    "description": "The title of the footer links column with title=Community in the footer"
+  },
+  "link.title.More": {
+    "message": "More",
+    "description": "The title of the footer links column with title=More in the footer"
+  },
+  "link.item.label.Foundation": {
+    "message": "Foundation",
+    "description": "The label of footer link with label=Foundation linking to https://www.apache.org/"
+  },
+  "link.item.label.License": {
+    "message": "License",
+    "description": "The label of footer link with label=License linking to https://www.apache.org/licenses/"
+  },
+  "link.item.label.Events": {
+    "message": "Events",
+    "description": "The label of footer link with label=Events linking to https://www.apache.org/events/"
+  },
+  "link.item.label.Security": {
+    "message": "Security",
+    "description": "The label of footer link with label=Security linking to https://www.apache.org/security/"
+  },
+  "link.item.label.Sponsorship": {
+    "message": "Sponsorship",
+    "description": "The label of footer link with label=Sponsorship linking to https://www.apache.org/foundation/sponsorship.html"
+  },
+  "link.item.label.Thanks": {
+    "message": "Thanks",
+    "description": "The label of footer link with label=Thanks linking to https://www.apache.org/foundation/thanks.html"
+  },
+  "link.item.label.GitHub Issue Tracker": {
+    "message": "GitHub Issue Tracker",
+    "description": "The label of footer link with label=GitHub Issue Tracker linking to https://github.com/apache/apisix/issues"
+  },
+  "link.item.label.Slack": {
+    "message": "Slack",
+    "description": "The label of footer link with label=Slack linking to https://apisix.slack.com/"
+  },
+  "link.item.label.Twitter": {
+    "message": "Twitter",
+    "description": "The label of footer link with label=Twitter linking to https://twitter.com/ApacheAPISIX"
+  },
+  "link.item.label.Blog": {
+    "message": "Blog",
+    "description": "The label of footer link with label=Blog linking to https://apisix.apache.org/blog/"
+  },
+  "copyright": {
+    "message": "Copyright © 2019-2021 The Apache Software Foundation. Apache APISIX, APISIX™, Apache, the Apache feather logo, and the Apache APISIX project logo are either registered trademarks or trademarks of the Apache Software Foundation.",
+    "description": "The footer copyright"
+  }
+}

Review comment:
       ditto




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] juzhiyuan commented on a change in pull request #202: feat: multiple features for docs

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #202:
URL: https://github.com/apache/apisix-website/pull/202#discussion_r581785595



##########
File path: pullDocs.js
##########
@@ -0,0 +1,108 @@
+console.log("start pullDocs.js");
+
+const childProcess = require("child_process");
+const fs = require("fs");
+
+const docsPaths = {
+  apisix: {
+    pluginId: "docs-apisix",
+    latestDocs: {
+      en: "./website/docs/apisix",
+      zh:
+        "./website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix/current",
+    },
+  },
+  apisixDashboard: {
+    pluginId: "docs-apisix-dashboard",
+    latestDocs: {
+      en: "./website/docs/apisix-dashboard",
+      zh:
+        "./website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix-dashboard/current",
+    },
+  },
+  apisixDashboard: {
+    pluginId: "docs-apisix-ingress-controller",
+    latestDocs: {
+      en: "./website/docs/apisix-ingress-controller",
+      zh:
+        "./website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix-ingress-controller/current",
+    },
+  },
+};
+
+function isFileExisted(path) {
+  try {
+    fs.accessSync(path);
+    return true;
+  } catch {
+    return false;
+  }
+}
+
+const copyDocs = (source, project, locale) => {
+  if (isFileExisted(`${source}/${locale}/latest`) === false) {
+    console.log(`[${project}] can not find ${locale} latest folder, skip.`);
+    return;
+  }
+
+  console.log(`[${project}] load ${locale} latest docs config.json`);
+  const configLatest = JSON.parse(
+    fs.readFileSync(`${source}/${locale}/latest/config.json`)
+  );
+
+  console.log(`[${project}] delete ${locale} docs config.json`);
+  fs.unlinkSync(`${source}/${locale}/latest/config.json`);
+
+  console.log(
+    `[${project}] copy latest ${locale} docs to ${docsPaths[project].latestDocs[locale]}`
+  );
+  childProcess.execSync(
+    `cp -rf ${source}/${locale}/latest/* ${docsPaths[project].latestDocs[locale]}`
+  );
+
+  console.log(`[${project}] write sidebar.json`);
+  const sidebar = {
+    docs: { ...configLatest.sidebar },

Review comment:
       ```suggestion
       docs: { ...(configLatest.sidebar || {}) },
   ```

##########
File path: pullDocs.js
##########
@@ -0,0 +1,108 @@
+console.log("start pullDocs.js");
+
+const childProcess = require("child_process");
+const fs = require("fs");
+
+const docsPaths = {
+  apisix: {
+    pluginId: "docs-apisix",
+    latestDocs: {
+      en: "./website/docs/apisix",
+      zh:
+        "./website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix/current",
+    },
+  },
+  apisixDashboard: {
+    pluginId: "docs-apisix-dashboard",
+    latestDocs: {
+      en: "./website/docs/apisix-dashboard",
+      zh:
+        "./website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix-dashboard/current",
+    },
+  },
+  apisixDashboard: {
+    pluginId: "docs-apisix-ingress-controller",
+    latestDocs: {
+      en: "./website/docs/apisix-ingress-controller",
+      zh:
+        "./website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix-ingress-controller/current",
+    },
+  },
+};
+
+function isFileExisted(path) {
+  try {
+    fs.accessSync(path);
+    return true;
+  } catch {
+    return false;
+  }
+}
+
+const copyDocs = (source, project, locale) => {
+  if (isFileExisted(`${source}/${locale}/latest`) === false) {
+    console.log(`[${project}] can not find ${locale} latest folder, skip.`);
+    return;
+  }
+
+  console.log(`[${project}] load ${locale} latest docs config.json`);
+  const configLatest = JSON.parse(
+    fs.readFileSync(`${source}/${locale}/latest/config.json`)
+  );
+
+  console.log(`[${project}] delete ${locale} docs config.json`);
+  fs.unlinkSync(`${source}/${locale}/latest/config.json`);
+
+  console.log(
+    `[${project}] copy latest ${locale} docs to ${docsPaths[project].latestDocs[locale]}`
+  );
+  childProcess.execSync(
+    `cp -rf ${source}/${locale}/latest/* ${docsPaths[project].latestDocs[locale]}`
+  );
+
+  console.log(`[${project}] write sidebar.json`);
+  const sidebar = {
+    docs: { ...configLatest.sidebar },
+  };
+  fs.writeFileSync(
+    `${docsPaths[project].latestDocs[locale]}/sidebars.json`,
+    JSON.stringify(sidebar, null, 4)
+  );
+};
+
+const main = () => {
+  childProcess.execSync("mkdir tmp");
+
+  console.log("Clone repos");
+  childProcess.execSync(
+    `git clone --depth=1 https://github.com/apache/apisix.git &
+     git clone --depth=1 https://github.com/apache/apisix-dashboard.git &
+     git clone --depth=1 https://github.com/apache/apisix-ingress-controller.git &

Review comment:
       Not clear for new projects 🤔 We could improve this part by using a configuration file in the future

##########
File path: pullDocs.js
##########
@@ -0,0 +1,108 @@
+console.log("start pullDocs.js");
+
+const childProcess = require("child_process");
+const fs = require("fs");
+
+const docsPaths = {
+  apisix: {
+    pluginId: "docs-apisix",
+    latestDocs: {
+      en: "./website/docs/apisix",
+      zh:
+        "./website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix/current",
+    },
+  },
+  apisixDashboard: {
+    pluginId: "docs-apisix-dashboard",
+    latestDocs: {
+      en: "./website/docs/apisix-dashboard",
+      zh:
+        "./website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix-dashboard/current",
+    },
+  },
+  apisixDashboard: {
+    pluginId: "docs-apisix-ingress-controller",
+    latestDocs: {
+      en: "./website/docs/apisix-ingress-controller",
+      zh:
+        "./website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix-ingress-controller/current",
+    },
+  },
+};
+
+function isFileExisted(path) {
+  try {
+    fs.accessSync(path);
+    return true;
+  } catch {
+    return false;
+  }
+}
+
+const copyDocs = (source, project, locale) => {
+  if (isFileExisted(`${source}/${locale}/latest`) === false) {
+    console.log(`[${project}] can not find ${locale} latest folder, skip.`);
+    return;
+  }
+
+  console.log(`[${project}] load ${locale} latest docs config.json`);
+  const configLatest = JSON.parse(
+    fs.readFileSync(`${source}/${locale}/latest/config.json`)
+  );
+
+  console.log(`[${project}] delete ${locale} docs config.json`);
+  fs.unlinkSync(`${source}/${locale}/latest/config.json`);
+
+  console.log(
+    `[${project}] copy latest ${locale} docs to ${docsPaths[project].latestDocs[locale]}`
+  );
+  childProcess.execSync(
+    `cp -rf ${source}/${locale}/latest/* ${docsPaths[project].latestDocs[locale]}`
+  );
+
+  console.log(`[${project}] write sidebar.json`);
+  const sidebar = {
+    docs: { ...configLatest.sidebar },
+  };
+  fs.writeFileSync(
+    `${docsPaths[project].latestDocs[locale]}/sidebars.json`,
+    JSON.stringify(sidebar, null, 4)

Review comment:
       2 spaces is fine
   
   ```suggestion
       JSON.stringify(sidebar, null, 2)
   ```

##########
File path: website/docusaurus.config.js
##########
@@ -58,6 +58,18 @@ module.exports = {
       "apache/apisix-control-plane",
     ],
   },
+  i18n: {
+    defaultLocale: "en",
+    locales: ["en", "zh-cn"],

Review comment:
       could we use `zh` here?

##########
File path: website/src/theme/DocPage/index.js
##########
@@ -0,0 +1,101 @@
+/**
+ * Copyright (c) Facebook, Inc. and its affiliates.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.

Review comment:
       This file is copied from Facebook?

##########
File path: website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix-dashboard/current.json
##########
@@ -0,0 +1,10 @@
+{
+  "version.label": {
+    "message": "Next",
+    "description": "The label for version current"
+  },
+  "sidebar.docs.category.APISIX™️ Dashboard": {
+    "message": "APISIX™️ Dashboard",
+    "description": "The label for category APISIX™️ Dashboard in sidebar docs"
+  }
+}

Review comment:
       All files should end with a blank line

##########
File path: website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix/current.json
##########
@@ -0,0 +1,10 @@
+{
+  "version.label": {
+    "message": "Next",
+    "description": "The label for version current"
+  },
+  "sidebar.docs.category.APISIX™️ Dashboard": {
+    "message": "APISIX™️ Dashboard",

Review comment:
       ![image](https://user-images.githubusercontent.com/2106987/108978712-ddb18b80-76c4-11eb-83da-5754059fcd7f.png)
   

##########
File path: pullDocs.js
##########
@@ -0,0 +1,108 @@
+console.log("start pullDocs.js");
+
+const childProcess = require("child_process");
+const fs = require("fs");
+
+const docsPaths = {
+  apisix: {
+    pluginId: "docs-apisix",
+    latestDocs: {
+      en: "./website/docs/apisix",
+      zh:
+        "./website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix/current",
+    },
+  },
+  apisixDashboard: {
+    pluginId: "docs-apisix-dashboard",
+    latestDocs: {
+      en: "./website/docs/apisix-dashboard",
+      zh:
+        "./website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix-dashboard/current",
+    },
+  },
+  apisixDashboard: {
+    pluginId: "docs-apisix-ingress-controller",
+    latestDocs: {
+      en: "./website/docs/apisix-ingress-controller",
+      zh:
+        "./website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix-ingress-controller/current",
+    },
+  },
+};
+
+function isFileExisted(path) {
+  try {
+    fs.accessSync(path);
+    return true;
+  } catch {
+    return false;
+  }
+}
+
+const copyDocs = (source, project, locale) => {
+  if (isFileExisted(`${source}/${locale}/latest`) === false) {
+    console.log(`[${project}] can not find ${locale} latest folder, skip.`);
+    return;
+  }
+
+  console.log(`[${project}] load ${locale} latest docs config.json`);
+  const configLatest = JSON.parse(
+    fs.readFileSync(`${source}/${locale}/latest/config.json`)
+  );
+
+  console.log(`[${project}] delete ${locale} docs config.json`);
+  fs.unlinkSync(`${source}/${locale}/latest/config.json`);
+
+  console.log(
+    `[${project}] copy latest ${locale} docs to ${docsPaths[project].latestDocs[locale]}`
+  );
+  childProcess.execSync(
+    `cp -rf ${source}/${locale}/latest/* ${docsPaths[project].latestDocs[locale]}`
+  );
+
+  console.log(`[${project}] write sidebar.json`);
+  const sidebar = {
+    docs: { ...configLatest.sidebar },
+  };
+  fs.writeFileSync(
+    `${docsPaths[project].latestDocs[locale]}/sidebars.json`,
+    JSON.stringify(sidebar, null, 4)
+  );
+};
+
+const main = () => {
+  childProcess.execSync("mkdir tmp");
+
+  console.log("Clone repos");
+  childProcess.execSync(
+    `git clone --depth=1 https://github.com/apache/apisix.git &
+     git clone --depth=1 https://github.com/apache/apisix-dashboard.git &
+     git clone --depth=1 https://github.com/apache/apisix-ingress-controller.git &
+     wait`,
+    {
+      cwd: "./tmp",
+    }
+  );
+
+  copyDocs("./tmp/apisix/docs", "apisix", "en");

Review comment:
       We could use for loop here 🤔 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] juzhiyuan commented on a change in pull request #202: feat: multiple features for docs

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #202:
URL: https://github.com/apache/apisix-website/pull/202#discussion_r581794791



##########
File path: .github/workflows/updateDocs.yaml
##########
@@ -0,0 +1,25 @@
+name: Update Docs

Review comment:
       ```suggestion
   name: Sync Docs from projects
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] juzhiyuan merged pull request #202: feat: multiple features for docs

Posted by GitBox <gi...@apache.org>.
juzhiyuan merged pull request #202:
URL: https://github.com/apache/apisix-website/pull/202


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] membphis commented on pull request #202: feat: multiple features for docs

Posted by GitBox <gi...@apache.org>.
membphis commented on pull request #202:
URL: https://github.com/apache/apisix-website/pull/202#issuecomment-785544058


   Where are these documents placed? 
   
   ![image](https://user-images.githubusercontent.com/6814606/109097412-3bdc7e00-775a-11eb-9c26-1320cd1eda2e.png)
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] qier222 edited a comment on pull request #202: feat: multiple features for docs

Posted by GitBox <gi...@apache.org>.
qier222 edited a comment on pull request #202:
URL: https://github.com/apache/apisix-website/pull/202#issuecomment-785559570


   General English docs 👉 /website/docs/general
   APISIX English docs 👉 /website/docs/apisix
   APISIX English Dashboard docs 👉 /website/docs/apisix-dashboard
   APISIX Ingress Controller English docs 👉 /website/docs/apisix-ingress-controller
   
   General Chinese docs 👉 /website/i18n/zh/docusaurus-plugin-content-docs
   APISIX Chinese docs 👉 /website/i18n/zh/docusaurus-plugin-content-docs-docs-apisix
   APISIX Chinese Dashboard docs 👉 /website/i18n/zh/docusaurus-plugin-content-docs-docs-apisix-dashboard
   APISIX Ingress Controller Chinese docs 👉 /website/i18n/zh/docusaurus-plugin-content-docs-docs-apisix-ingress-controller


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] membphis edited a comment on pull request #202: feat: multiple features for docs

Posted by GitBox <gi...@apache.org>.
membphis edited a comment on pull request #202:
URL: https://github.com/apache/apisix-website/pull/202#issuecomment-785544058


   Where are these documents placed?  ping @qier222 
   
   ![image](https://user-images.githubusercontent.com/6814606/109097412-3bdc7e00-775a-11eb-9c26-1320cd1eda2e.png)
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-website] qier222 edited a comment on pull request #202: feat: multiple features for docs

Posted by GitBox <gi...@apache.org>.
qier222 edited a comment on pull request #202:
URL: https://github.com/apache/apisix-website/pull/202#issuecomment-785559570


   General English docs 👉 /website/docs/general
   APISIX English docs 👉 /website/docs/apisix
   APISIX English Dashboard docs 👉 /website/docs/apisix-dashboard
   APISIX Ingress Controller English docs 👉 /website/docs/apisix-ingress-controller
   
   General Chinese docs 👉 /website/i18n/zh-cn/docusaurus-plugin-content-docs
   APISIX Chinese docs 👉 /website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix
   APISIX Chinese Dashboard docs 👉 /website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix-dashboard
   APISIX Ingress Controller Chinese docs 👉 /website/i18n/zh-cn/docusaurus-plugin-content-docs-docs-apisix-ingress-controller


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org