This is an automated email from the ASF dual-hosted git repository.
kirs pushed a commit to branch main
in repository
https://gitbox.apache.org/repos/asf/incubator-seatunnel-website.git
The following commit(s) were added to refs/heads/main by this push:
new 2cc4892 Migrate sidebars.js to code repo and add describe (#95)
2cc4892 is described below
commit 2cc48927203651b5117d69346e2c383b7ca166e7
Author: Jiajie Zhong <[email protected]>
AuthorDate: Sun Mar 27 19:47:01 2022 +0800
Migrate sidebars.js to code repo and add describe (#95)
* Migrate sidebars.js to code repo and add describe
This path migrate sidebars.js to our main repo and
and describe about how our `tool/build_docs.sh` work.
ref: apache/incubator-seatunnel#1586
* Add missing rsync for sidebar.js
---
.gitignore | 1 +
HOW_DOC_WORK.md | 20 ++++++++++
README.md | 2 +-
README_ZH.md | 2 +-
sidebars.js | 103 ----------------------------------------------------
tools/build-docs.sh | 38 +++++++++++++++++--
6 files changed, 58 insertions(+), 108 deletions(-)
diff --git a/.gitignore b/.gitignore
index febfa97..6af4517 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,6 +25,7 @@ build/
swap/
docs/
static/image_en/
+sidebars.js
dist
dist-ssr
diff --git a/HOW_DOC_WORK.md b/HOW_DOC_WORK.md
new file mode 100644
index 0000000..52597d8
--- /dev/null
+++ b/HOW_DOC_WORK.md
@@ -0,0 +1,20 @@
+# How Documentation Work
+
+[Our website](https://seatunnel.apache.org) is generated based on this
repository(**apache/incubator-seatunnel-website**),
+but the content of document is hold on [our codebase
repository](https://github.com/apache/incubator-seatunnel/tree/dev/docs).
+So we have to fetch the document from the codebase repository before we build
the document.
+
+Indeed, you could fetch it by your hand, but we provide the more convenience
way to do it, the `build-docs.sh` in directory
+`tools`. It will
+
+* Create the directory named `swap` under your project directory, as well
`docs` and `static/image_en`.
+* Fetch the latest code in codebase repository(apache/dolphinscheduler) to
directory `swap`.
+* Sync the latest `incubator-seatunnel/docs/en` and
`incubator-seatunnel/docs/en/image` to directory `docs` and `static/image_en`.
+
+After that, you are finish the prepare work, and all resources you need to
build our website it there, you could run your
+`npm` command to build the website.
+
+## How It Works in GitHub Action
+
+Our GitHub Action also use script `tools/build-docs.sh` to finish its prepare
work. Consistent way to prepare and build
+the website is good for both development and production maintenance.
diff --git a/README.md b/README.md
index ca3f534..0435b16 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,7 @@ This website is compiled using node, using Docusaurus
framework components
1. Download and install nodejs (version>12.5.0)
2. Clone the code to the local `git clone
[email protected]:apache/incubator-seatunnel-website.git`
-3. Run `./tools/build-docs.sh` to fetch and prepare docs form
**apache/incubator-seatunnel**
+3. Run `./tools/build-docs.sh` to fetch and prepare docs form
**apache/incubator-seatunnel**, for more information you could see [how our
document work](HOW_DOC_WORK.md)
4. Run `npm install` to install the required dependent libraries.
5. Run `npm run start` in the root directory, you can visit
http://localhost:3000 to view the English mode preview of the site
6. Run `npm run start-zh` in the root directory, you can visit
http://localhost:3000 to view the Chinese mode preview of the site
diff --git a/README_ZH.md b/README_ZH.md
index 399cb28..f081c54 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -23,7 +23,7 @@ asf-staging 官网测试环境 通过https://seatunnel.staged.apache.org 访问
1. 下载并安装 nodejs(version>12.5.0)
2. 克隆代码到本地 `git clone [email protected]:apache/incubator-seatunnel-website.git`
-3. 运行 `./tools/build-docs.sh` 从 **apache/incubator-seatunnel** 中拉取、准备文档
+3. 运行 `./tools/build-docs.sh` 从 **apache/incubator-seatunnel**
中拉取、准备文档。如果想要了解更多细节和操作请阅读[文档如何工作](HOW_DOC_WORK.md)
4. 运行 `npm install` 来安装所需的依赖库。
5. 在根目录运行`npm run start`,可以访问http://localhost:3000查看站点英文模式预览
6. 在根目录运行`npm run start-zh`,可以访问http://localhost:3000查看站点的中文模式预览
diff --git a/sidebars.js b/sidebars.js
deleted file mode 100644
index 9058522..0000000
--- a/sidebars.js
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * Creating a sidebar enables you to:
- - create an ordered group of docs
- - render a sidebar for each doc of that group
- - provide next/previous navigation
-
- The sidebars can be generated from the filesystem, or explicitly defined here.
-
- Create as many sidebars as you want.
- */
-
-// @ts-check
-
-/** @type {import('@docusaurus/plugin-content-docs').SidebarsConfig} */
-const sidebars = {
- // By default, Docusaurus generates a sidebar from the docs folder structure
- // tutorialSidebar: [{type: 'autogenerated', dirName: '.'}],
-
- // But you can create a sidebar manually
- /*
- tutorialSidebar: [
- {
- type: 'category',
- label: 'Tutorial',
- items: ['hello'],
- },
- ],
- */
-
- docs: [
- 'introduction',
- {
- type: 'category',
- label: 'Spark',
- items: [
- 'spark/installation',
- 'spark/quick-start',
- 'spark/deployment',
- {
- type: 'category',
- label: 'Configuration',
- items: [
- // TODO we can use generated-index to create some leading page
like https://docusaurus.io/docs/category/guides
- {
- type: 'autogenerated',
- dirName: 'spark/configuration',
- },
- ],
- },
- {
- type: 'category',
- label: 'Commands',
- items: [
- {
- type: 'autogenerated',
- dirName: 'spark/commands',
- },
- ],
- },
- ],
- },
- {
- type: 'category',
- label: 'Flink',
- items: [
- 'flink/installation',
- 'flink/quick-start',
- 'flink/deployment',
- {
- type: 'category',
- label: 'Configuration',
- items: [
- {
- type: 'autogenerated',
- dirName: 'flink/configuration',
- },
- ],
- },
- {
- type: 'category',
- label: 'Commands',
- items: [
- {
- type: 'autogenerated',
- dirName: 'flink/commands',
- },
- ],
- },
- ],
- },
- {
- type: 'category',
- label: 'developement',
- items: [
- 'developement/setup',
- 'developement/NewLicenseGuide',
- ],
- },
- 'FAQ',
- ]
-};
-
-module.exports = sidebars
diff --git a/tools/build-docs.sh b/tools/build-docs.sh
index 49a5570..62e9995 100755
--- a/tools/build-docs.sh
+++ b/tools/build-docs.sh
@@ -4,17 +4,23 @@ set -euo pipefail
SOURCE_PATH="$(cd "$(dirname "$(dirname "${BASH_SOURCE[0]}")" )" && pwd)"
+# Codebase Repository
PROJECT_NAME="seatunnel"
PROJECT_BRANCH_NAME="dev"
-# PROJECT_WEBSITE_NAME="${PROJECT_NAME}-website"
+# Repository Website(current) Directory
SWAP_DIR="${SOURCE_PATH}/swap"
PROJECT_SITE_IMG_DIR="${SOURCE_PATH}/static/image_en"
PROJECT_SITE_DOC_DIR="${SOURCE_PATH}/docs"
+# Repository Codebase(current) Directory
PROJECT_DIR="${SWAP_DIR}/${PROJECT_NAME}"
PROJECT_IMG_DIR="${PROJECT_DIR}/docs/en/images"
PROJECT_DOC_DIR="${PROJECT_DIR}/docs/en"
+PROJECT_SIDEBAR_PATH="${PROJECT_DIR}/docs/sidebars.js"
+
+# Repository Codebase(current) File Path
+DOCUSAURUS_DOC_SIDEBARS_FILE="${SOURCE_PATH}/sidebars.js"
# Choose the protocol for git communication to server, default is HTTP because
it do not requests password or secret key,
@@ -29,11 +35,12 @@ fi
##############################################################
#
# Rebuild specific directory, if directory exists, will remove
-# it before create it, otherwise create it directly.
+# it before create it, otherwise create it directly. It
+# supports one or more parameters.
#
# Arguments:
#
-# path: One or more directories want to rebuild
+# <path...>: One or more directories want to rebuild
#
##############################################################
function rebuild_dirs() {
@@ -48,6 +55,25 @@ function rebuild_dirs() {
##############################################################
#
+# Remove specific exists file. It supports one or more
+# parameters.
+#
+# Arguments:
+#
+# <file...>: One or more files want to remove
+#
+##############################################################
+function rm_exists_files() {
+ for file in "$@"; do
+ echo " ---> Remove exists ${file}"
+ if [ -f "${file}" ]; then
+ rm -rf "${file}"
+ fi
+ done
+}
+
+##############################################################
+#
# Clone repository to target directory, it will only support
# clone one depth. Supported two or three parameters, if you
# want to clone into specific directory you should provider
@@ -119,9 +145,15 @@ function prepare_docs() {
echo "===>>>: Rebuild directory swap, docs, static/image_en."
rebuild_dirs "${SWAP_DIR}" "${PROJECT_SITE_DOC_DIR}"
"${PROJECT_SITE_IMG_DIR}"
+ echo "===>>>: Remove exists file sidebars.js."
+ rm_exists_files "${DOCUSAURUS_DOC_SIDEBARS_FILE}"
+
echo "===>>>: Clone project main codebase repositories."
clone_repo "${PROJECT_REPO}" "${PROJECT_BRANCH_NAME}" "${PROJECT_DIR}"
+ echo "===>>>: Rsync sidebars.js to ${DOCUSAURUS_DOC_SIDEBARS_FILE}"
+ rsync -av "${PROJECT_SIDEBAR_PATH}" "${DOCUSAURUS_DOC_SIDEBARS_FILE}"
+
echo "===>>>: Rsync images to ${PROJECT_SITE_IMG_DIR}"
rsync -av "${PROJECT_IMG_DIR}"/ "${PROJECT_SITE_IMG_DIR}"