You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by li...@apache.org on 2021/01/20 02:20:23 UTC

[incubator-dolphinscheduler-website] branch master updated: Support download page (#272)

This is an automated email from the ASF dual-hosted git repository.

lidongdai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 5412b37  Support download page (#272)
5412b37 is described below

commit 5412b3772dd14a9b68eabf24045130cfd822ab0e
Author: Shiwen Cheng <ch...@gmail.com>
AuthorDate: Wed Jan 20 10:20:16 2021 +0800

    Support download page (#272)
    
    * add download page and upgrade to docsite-ext 1.4.4
    
    * update build and workflows
    
    * update readme
---
 .eslintrc                                      |   2 +-
 .github/workflows/website.yml                  |   3 +-
 README.md                                      |  19 ++++------
 gulpfile.js                                    |  22 ++++++++++-
 img/system/download.png                        | Bin 0 -> 3802 bytes
 package.json                                   |  49 ++++++++++++++-----------
 site_config/site.js                            |   8 ++--
 src/components/header/index.jsx                |   7 ++--
 src/pages/{blogDetail => blog}/index.md.jsx    |   0
 src/pages/{blogDetail => blog}/index.md.scss   |   0
 src/pages/{documentation => docs}/index.md.jsx |   8 ++--
 src/pages/download/index.md.jsx                |  43 ++++++++++++++++++++++
 webpack.config.js                              |   2 +-
 13 files changed, 114 insertions(+), 49 deletions(-)

diff --git a/.eslintrc b/.eslintrc
index 0e70ce4..206dead 100755
--- a/.eslintrc
+++ b/.eslintrc
@@ -23,6 +23,6 @@
     "react/jsx-indent-props": 0,
     "indent": 0,
     "radix": ["error", "as-needed"],
-    "linebreak-style": [0 ,"error", "windows"]
+    "linebreak-style": [0, "error", "windows"]
   }
 }
\ No newline at end of file
diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml
index b8ef2a6..4f00e40 100644
--- a/.github/workflows/website.yml
+++ b/.github/workflows/website.yml
@@ -14,8 +14,7 @@ jobs:
       with:
         node-version: 8.16.2
     - name: Build
-      run: |
-        mkdir dist && npm install && npm run build && cp -r sitemap.xml 404.html .asf.yaml index.html en-us zh-cn build img download dist/
+      run: npm install && npm run build
 
     - name: Deploy
       uses: peaceiris/actions-gh-pages@v3
diff --git a/README.md b/README.md
index 562c69a..19c1b92 100644
--- a/README.md
+++ b/README.md
@@ -4,24 +4,21 @@ This project keeps all sources used for building up DolphinScheduler official we
 
 ## Prerequisite
 
-DolphinScheduler website is powered by [docsite](https://github.com/txd-team/docsite).
-If your version of docsite is lower than `1.3.3`,please upgrade to `1.3.3`.
-Please also make sure your node version is 8.x, versions higher than 8.x is not supported by docsite yet.
+DolphinScheduler website is powered by [docsite](https://github.com/chengshiwen/docsite-ext).
+Please also make sure your node version is 8+, version lower than 8.x is not supported yet.
 
 ## Build instruction 
 
-1. Run `npm install docsite -g` to install the dev tool.
-2. Run `npm i` in the root directory to install the dependencies.
-3. Run `docsite start` in the root directory to start a local server, you will see the website in 'http://127.0.0.1:8080'.
-4. Run `docsite build` to build source code.
-5. Verify your change locally: `python -m SimpleHTTPServer 8000`, when your python version is 3 use :`python3 -m http.server 8000` instead.
+1. Run `npm install` in the root directory to install the dependencies.
+2. Run `npm run start` in the root directory to start a local server, you will see the website in 'http://127.0.0.1:8080'.
+3. Run `npm run build` to build source code into dist directory.
+4. Verify your change locally: `python -m SimpleHTTPServer 8000`, when your python version is 3 use :`python3 -m http.server 8000` instead.
 
 If you have higher version of node installed, you may consider `nvm` to allow different versions of `node` coexisting on your machine.
 
 1. Follow the [instructions](http://nvm.sh) to install nvm
-2. Run `nvm install v8.16.0` to install node v8
-3. Run `nvm use v8.16.0` to switch the working environment to node v8
-4. Run `npm install docsite -g`
+2. Run `nvm install v8.16.2` to install node v8
+3. Run `nvm use v8.16.2` to switch the working environment to node v8
 
 Then you are all set to run and build the website. Follow the build instruction above for the details.
 
diff --git a/gulpfile.js b/gulpfile.js
index 70a6eab..5ccace4 100755
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -4,6 +4,7 @@ const gutil = require('gulp-util');
 const webpack = require('webpack');
 const opn = require('opn');
 const path = require('path');
+const fs = require('fs-extra');
 const WebpackDevServer = require('webpack-dev-server');
 const CopyWebpackPlugin = require('copy-webpack-plugin');
 const siteConfig = require('./site_config/site').default;
@@ -40,8 +41,27 @@ gulp.task('webpack:build', callback => {
       },
     }),
     new webpack.optimize.UglifyJsPlugin(),
+    new CopyWebpackPlugin((() => {
+      const entries = ['.asf.yaml', 'sitemap.xml', 'file', 'img'];
+      const pages = fs.readdirSync(path.join(__dirname, './src/pages'));
+      pages.forEach(page => {
+        if (page === 'home') return;
+        if (fs.statSync(path.join(__dirname, './src/pages', page)).isDirectory()) {
+          if (fs.existsSync(path.join(__dirname, page)) && fs.statSync(path.join(__dirname, page)).isDirectory()) {
+            entries.push(page);
+          }
+        }
+      });
+      return entries.map(entry => {
+        return {
+          from: path.join(__dirname, entry),
+          to: path.join(__dirname, 'dist', entry),
+          ignore: ['*.md', '*.markdown']
+        }
+      });
+    })()),
     new CopyWebpackPlugin([
-      { from: path.join(__dirname, siteConfig.defaultLanguage, 'index.html'), to: path.join(__dirname, 'index.html') },
+      { from: path.join(__dirname, siteConfig.defaultLanguage, 'index.html'), to: path.join(__dirname, 'dist/index.html') },
     ])
   );
 
diff --git a/img/system/download.png b/img/system/download.png
new file mode 100644
index 0000000..023edcd
Binary files /dev/null and b/img/system/download.png differ
diff --git a/package.json b/package.json
index abf1a80..b6f3189 100644
--- a/package.json
+++ b/package.json
@@ -6,31 +6,47 @@
     "start": "docsite start",
     "build": "docsite build"
   },
+  "dependencies": {
+    "antd": "^3.26.20",
+    "classnames": "^2.2.6",
+    "core-decorators": "^0.20.0",
+    "js-cookie": "^2.2.1",
+    "react": "^16.13.1",
+    "react-dom": "^16.13.1",
+    "react-scroll": "^1.8.1",
+    "react-tilt": "^0.1.4",
+    "whatwg-fetch": "^2.0.4"
+  },
   "devDependencies": {
-    "babel-core": "6.23.1",
-    "babel-eslint": "^6.0.5",
+    "asset-require-hook": "^1.2.0",
+    "babel-core": "6.26.3",
+    "babel-eslint": "^10.1.0",
     "babel-loader": "7.1.5",
     "babel-plugin-transform-class-properties": "^6.24.1",
-    "babel-plugin-transform-decorators-legacy": "^1.3.4",
+    "babel-plugin-transform-decorators-legacy": "^1.3.5",
     "babel-plugin-transform-object-assign": "^6.22.0",
-    "babel-plugin-transform-object-rest-spread": "^6.23.0",
+    "babel-plugin-transform-object-rest-spread": "^6.26.0",
     "babel-plugin-transform-runtime": "^6.23.0",
+    "babel-polyfill": "^6.26.0",
     "babel-preset-es2015": "6.22.0",
-    "babel-preset-react": "6.23.0",
-    "babel-preset-stage-0": "6.22.0",
+    "babel-preset-react": "^6.24.1",
+    "babel-preset-stage-0": "6.24.1",
     "babel-register": "^6.26.0",
+    "commander": "^2.20.3",
     "copy-webpack-plugin": "^4.6.0",
-    "css-loader": "0.6.12",
-    "docsite-ext": "1.4.1",
-    "eslint": "^4.18.2",
-    "eslint-config-ali": "^3.2.0",
+    "css-loader": "0.28.11",
+    "css-modules-require-hook": "^4.2.3",
+    "docsite-ext": "^1.4.4",
+    "eslint": "^5.16.0",
+    "eslint-config-ali": "^4.1.1",
     "eslint-plugin-import": "*",
     "eslint-plugin-react": "*",
     "extract-text-webpack-plugin": "^3.0.2",
+    "fs-extra": "^6.0.1",
     "gulp": "4.0.2",
     "gulp-util": "2.2.20",
     "json-loader": "*",
-    "node-libs-browser": "2.0.0",
+    "node-libs-browser": "2.2.1",
     "node-sass": "^4.14.1",
     "opn": "^5.3.0",
     "raw-loader": "^0.5.1",
@@ -38,16 +54,5 @@
     "style-loader": "0.6.5",
     "webpack": "^3.12.0",
     "webpack-dev-server": "2.11.5"
-  },
-  "dependencies": {
-    "antd": "^3.26.20",
-    "classnames": "^2.2.6",
-    "core-decorators": "^0.20.0",
-    "js-cookie": "^2.2.0",
-    "react": "^16.13.1",
-    "react-dom": "^16.13.1",
-    "react-scroll": "^1.8.1",
-    "react-tilt": "^0.1.4",
-    "whatwg-fetch": "^2.0.4"
   }
 }
diff --git a/site_config/site.js b/site_config/site.js
old mode 100755
new mode 100644
index f9780c0..52f9537
--- a/site_config/site.js
+++ b/site_config/site.js
@@ -57,7 +57,7 @@ export default {
       {
         key: 'download',
         text: 'DOWNLOAD',
-        link: '/en-us/docs/release/download.html',
+        link: '/en-us/download/download.html',
       },
       { key: 'blog',
         text: 'BLOG',
@@ -66,7 +66,7 @@ export default {
       {
         key: 'development',
         text: 'DEVELOPMENT',
-        link: '/en-us/docs/development/subscribe.html',
+        link: '/en-us/docs/development/development-environment-setup.html',
       },
       {
         key: 'community',
@@ -218,7 +218,7 @@ export default {
       {
         key: 'download',
         text: '下载',
-        link: '/zh-cn/docs/release/download.html',
+        link: '/zh-cn/download/download.html',
       },
       {
         key: 'blog',
@@ -228,7 +228,7 @@ export default {
       {
         key: 'development',
         text: '开发者',
-        link: '/zh-cn/docs/development/subscribe.html',
+        link: '/zh-cn/docs/development/development-environment-setup.html',
       },
       {
         key: 'community',
diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx
index 40e2d68..82e5287 100755
--- a/src/components/header/index.jsx
+++ b/src/components/header/index.jsx
@@ -48,7 +48,7 @@ class Header extends React.Component {
   constructor(props) {
     super(props);
     this.state = {
-      current: '',
+      current: props.currentKey,
       menuBodyVisible: false,
       language: props.language,
       search: siteConfig.defaultSearch,
@@ -59,7 +59,7 @@ class Header extends React.Component {
   componentDidMount() {
     if(localStorage.getItem("currents") == null) {
       this.setState({
-        current: 'home'
+        current: window.location.pathname.split('/')[2] || 'home'
       });
     } else {
       this.setState({
@@ -215,8 +215,9 @@ class Header extends React.Component {
               {siteConfig[language].pageMenu.map(item => (
                 item.children ? <SubMenu
                   key={item.key}
+                  className={this.state.current === item.key ? 'ant-menu-item-selected' : ''}
                   title={
-                    <span className="submenu-title-wrapper">
+                    <span className="submenu-title-wrapper" onClick={() => this.handleClick(item)}>
                       <a href={getLink(item.link)} target={item.target || '_self'}>{item.text}</a>
                       <ul style={{display: 'none'}}>
                       {item.children.map(items => (
diff --git a/src/pages/blogDetail/index.md.jsx b/src/pages/blog/index.md.jsx
similarity index 100%
rename from src/pages/blogDetail/index.md.jsx
rename to src/pages/blog/index.md.jsx
diff --git a/src/pages/blogDetail/index.md.scss b/src/pages/blog/index.md.scss
similarity index 100%
rename from src/pages/blogDetail/index.md.scss
rename to src/pages/blog/index.md.scss
diff --git a/src/pages/documentation/index.md.jsx b/src/pages/docs/index.md.jsx
similarity index 90%
rename from src/pages/documentation/index.md.jsx
rename to src/pages/docs/index.md.jsx
index 01d0472..91e36b3 100755
--- a/src/pages/documentation/index.md.jsx
+++ b/src/pages/docs/index.md.jsx
@@ -14,7 +14,7 @@ import docsConfig4 from '../../../site_config/docs1-3-3';
 import docsConfig5 from '../../../site_config/docs1-3-4';
 import devConfig from '../../../site_config/development';
 
-class Documentation extends Md2Html(Language) {
+class Docs extends Md2Html(Language) {
 
   render() {
     const language = this.getLanguage();
@@ -42,7 +42,7 @@ class Documentation extends Md2Html(Language) {
     }
     const __html = this.props.__html || this.state.__html;
     return (
-      <div className="md2html documentation-page">
+      <div className="md2html docs-page">
         <Header
           currentKey="docs"
           type="normal"
@@ -65,6 +65,6 @@ class Documentation extends Md2Html(Language) {
   }
 }
 
-document.getElementById('root') && ReactDOM.render(<Documentation />, document.getElementById('root'));
+document.getElementById('root') && ReactDOM.render(<Docs />, document.getElementById('root'));
 
-export default Documentation;
+export default Docs;
diff --git a/src/pages/download/index.md.jsx b/src/pages/download/index.md.jsx
new file mode 100755
index 0000000..0c91438
--- /dev/null
+++ b/src/pages/download/index.md.jsx
@@ -0,0 +1,43 @@
+import React from 'react';
+import ReactDOM from 'react-dom';
+import Language from '../../components/language';
+import Header from '../../components/header';
+import Footer from '../../components/footer';
+import Md2Html from '../../components/md2html';
+import Bar from '../../components/bar';
+import Sidemenu from '../../components/sidemenu';
+import downloadConfig from '../../../site_config/download';
+
+class Download extends Md2Html(Language) {
+
+  render() {
+    const language = this.getLanguage();
+    let dataSource = downloadConfig[language];
+    const __html = this.props.__html || this.state.__html;
+    return (
+      <div className="md2html download-page">
+        <Header
+          currentKey="download"
+          type="normal"
+          logo="/img/hlogo_colorful.svg"
+          language={language}
+          onLanguageChange={this.onLanguageChange}
+        />
+        <Bar img="/img/system/download.png" text={dataSource.barText} />
+        <section className="content-section">
+          <Sidemenu dataSource={dataSource.sidemenu} />
+          <div
+            className="doc-content markdown-body"
+            ref={(node) => { this.markdownContainer = node; }}
+            dangerouslySetInnerHTML={{ __html }}
+          />
+        </section>
+        <Footer logo="/img/ds_gray.svg" language={language} />
+      </div>
+    );
+  }
+}
+
+document.getElementById('root') && ReactDOM.render(<Download />, document.getElementById('root'));
+
+export default Download;
diff --git a/webpack.config.js b/webpack.config.js
index ef22cbf..c73dd13 100755
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -29,7 +29,7 @@ fs.readdirSync(targetPath).forEach(page => {
 module.exports = {
   entry,
   output: {
-    path: path.join(__dirname, 'build'),
+    path: path.join(__dirname, 'dist/build'),
     filename: '[name].js',
   },
   externals: {