You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2021/11/10 09:25:09 UTC

[skywalking-website] branch master updated: Add showcase repo and doc (#354)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 5a4eb84  Add showcase repo and doc (#354)
5a4eb84 is described below

commit 5a4eb84faa64e934daf8109d8db848f44c410141
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Wed Nov 10 17:25:05 2021 +0800

    Add showcase repo and doc (#354)
---
 content/_index.html                        |  3 +-
 content/downloads/_index.md                |  1 +
 data/docs.yml                              | 25 ++++++++---
 doc.sh                                     | 13 ++++--
 docs.js                                    | 71 +++++++++++++-----------------
 themes/docsy/layouts/partials/scripts.html |  6 +++
 6 files changed, 66 insertions(+), 53 deletions(-)

diff --git a/content/_index.html b/content/_index.html
index 4b5eadd..9a0276a 100644
--- a/content/_index.html
+++ b/content/_index.html
@@ -5,7 +5,7 @@ linkTitle = "Apache SkyWalking"
 
 {{< blocks/cover title="Apache SkyWalking" image_anchor="top" height="full" color="dark" >}}
 <div class="mx-auto">
-    <a class="btn btn-lg btn-primary mr-3 mb-4" href="https://github.com/apache/skywalking/tree/master/docs">
+    <a class="btn btn-lg btn-primary mr-3 mb-4" href="/docs/skywalking-showcase/latest/readme/">
         Quick Start<i class="fas fa-arrow-alt-circle-right ml-2"></i>
     </a>
     <a class="btn btn-lg btn-secondary mb-4" href="https://github.com/apache/skywalking">
@@ -213,4 +213,3 @@ For announcement of latest features etc on <a href="https://twitter.com/asfskywa
 
 
 {{< /blocks/section >}}
-
diff --git a/content/downloads/_index.md b/content/downloads/_index.md
index 3af98c6..267cd60 100755
--- a/content/downloads/_index.md
+++ b/content/downloads/_index.md
@@ -3,6 +3,7 @@ title: "Downloads"
 linkTitle: "Downloads"
 descriptions: "Download the SkyWalking releases."
 ---
+
 # Download the SkyWalking recommended releases
 
 Use the links below to download the Apache SkyWalking from one of our mirrors.
diff --git a/data/docs.yml b/data/docs.yml
index 43db1fa..f3a5c83 100644
--- a/data/docs.yml
+++ b/data/docs.yml
@@ -1,3 +1,16 @@
+- type: Quick Start
+  description:
+  list:
+    - name: SkyWalking Showcase
+      icon: S
+      description: A demo music applicatioon to demonstrate featues of Apache SkyWalking
+      user: apache
+      repo: skywalking-showcase
+      repoUrl: https://github.com/apache/skywalking-showcase.git
+      docs:
+        - version: latest
+          link: /docs/skywalking-showcase/latest/readme/
+
 - type: General
   description:
   list:
@@ -12,7 +25,7 @@
           link: /docs/main/latest/readme/
         - version: v8.8.1
           link: /docs/main/v8.8.1/readme/
-          commitId: 96829da89ae0a7f4ef069ac97cbdc5b441efb434  
+          commitId: 96829da89ae0a7f4ef069ac97cbdc5b441efb434
         - version: v8.7.0
           link: /docs/main/v8.7.0/readme/
           commitId: 10f13c098d61ab149931860d11d347c9a960c8e2
@@ -84,7 +97,7 @@
       docs:
         - version: v0.5.0
           link: https://github.com/apache/skywalking-nginx-lua/tree/v0.5.0
-          
+
     - name: Kong Agent
       icon: K
       description: SkyWalking Kong Agent provides the native tracing capability.
@@ -121,7 +134,7 @@
       description: Watch, filter, and send Kubernetes events into Apache SkyWalking
       user: apache
       repo: skywalking-kubernetes-event-exporter
-      
+
     - name:
       description: More language agents maintained by our community
       descriptionLink: '#SkyAPM-dotnet'
@@ -176,7 +189,7 @@
       description: Query Protocol defines the communication protocol in query stage. SkyWalking native UI and CLI use this protocol to fetch data from the backend consistently.
       user: apache
       repo: skywalking-query-protocol
-      
+
     - name: Go API
       icon: G
       description: Apache SkyWalking APIs in Golang
@@ -295,7 +308,7 @@
       description: Java agent plugin extensions for Apache SkyWalking.
       user: SkyAPM
       repo: java-plugin-extensions
-      
+
     - name: Transporter Plugins
       icon: T
       description: 3rd-party transporter implementation of Apache SkyWalking.
@@ -307,7 +320,7 @@
       description: A tool helps on locating witness class for Apache SkyWalking plugin.
       user: SkyAPM
       repo: uranus
-      
+
     - name: (Retired) SkyAPM Node.js
       icon: O
       description: SkyAPM Node.js is the Node.js instrumentation agent, this project wouldn't have any update, it has been retired and archived.
diff --git a/doc.sh b/doc.sh
index 9012447..47eb3a3 100755
--- a/doc.sh
+++ b/doc.sh
@@ -1,5 +1,6 @@
 #!/bin/bash
 set -o errexit
+set -x
 
 repo=$1
 repoUrl=$2
@@ -19,10 +20,14 @@ fi
 
 mkdir ./${repo}
 cd ./${repo}
-git init
-git remote add origin ${repoUrl}
-git fetch origin ${commitId}
-git reset --hard FETCH_HEAD
+if [ "$commitId" = "latest" ]; then
+  git clone --depth=1 ${repoUrl} .
+else
+  git init
+  git remote add origin ${repoUrl}
+  git fetch origin "$commitId"
+  git reset --hard FETCH_HEAD
+fi
 
 if [ -d "../../${localPath}" ]; then
   rm -rf ../../${localPath}
diff --git a/docs.js b/docs.js
index 66544e2..847e899 100644
--- a/docs.js
+++ b/docs.js
@@ -70,7 +70,7 @@ function isImage(file) {
 
 function replaceMarkdownText(codeTxt, docInfo, filePath) {
   if (!/^([\s]*)(---[\s\S]*---)/.test(codeTxt)) {
-    const {repoUrl, commitId, date, docName, version} = docInfo;
+    const {repoUrl, commitId, docName, version} = docInfo;
     const prefix = repoUrl.replace('.git', '/tree') + `/${commitId}`;
     const depth = filePath.split('/docs')[1].match(/\//g).length - 2;
 
@@ -81,7 +81,6 @@ function replaceMarkdownText(codeTxt, docInfo, filePath) {
     codeTxt =
         `---
 title: ${title}
-date: ${date}
 type: projectDoc
 layout: baseof
 ---\n` + codeTxt;
@@ -146,46 +145,36 @@ async function traverseDocsList(result) {
       }
       for (const doc of item.docs) {
         const {repo, repoUrl, docs} = item;
+        if (!repoUrl) continue;
         let {version, commitId} = doc;
-        let date;
-        if (version === 'latest') {
-          const res = await axios.get(`https://api.github.com/repos/apache/${repo}/commits?page=1&per_page=1`)
-          commitId = res.data[0].sha;
-          date = res.data[0].commit.author.date;
-        }
-        if (commitId) {
-          if (!date) {
-            const res = await axios.get(`https://api.github.com/repos/apache/${repo}/commits/${commitId}`)
-            date = res.data.commit.author.date;
-          }
-          const docName = repo === 'skywalking' ? 'main' : repo;
-          const localPath = `/content/docs/${docName}/${version}`;
-          const menuFileName = `${docName.replace(/\-|\./g, '_')}${version.replace(/\-|v|\./g, '_')}`;
-          docsInfo.push({localPath, repoUrl, commitId, date, docName, version})
-
-          tpl += `{{ if in .File.Path "${localPath.split('/content/')[1]}" }}
-                    {{ $currentVersion := .Site.Data.docSidebar.${menuFileName}.version }}
-                    <h5>Documentation: 
-                    <select class="version-select">
-                    {{range .Site.Data.docSidebar.${menuFileName}.repoDocs}}
-                    {{$version := .version}}
-                    <option {{ cond (eq $currentVersion $version) "selected" "" }} value="{{$version}}">{{$version}}</option>
-                    {{end}}
-                    </select>
-                    </h5>
-                    
-                    {{ partial "sidebar-menu.html" .Site.Data.docSidebar.${menuFileName} }}
-                    <div class="commit-id">Commit Id: {{.Site.Data.docSidebar.${menuFileName}.commitId}}</div>
-                  {{ end }}\n`;
-
-          execSync(`"./doc.sh" ${repo} ${repoUrl} ${commitId} ${localPath} ${menuFileName}`);
-
-          await handleMenuFiles(`./data/docSidebar/${menuFileName}.yml`, {
-            version,
-            commitId,
-            docs,
-          }, `/docs/${docName}/${version}`)
-        }
+        commitId = commitId || version;
+        const docName = repo === 'skywalking' ? 'main' : repo;
+        const localPath = `/content/docs/${docName}/${version}`;
+        const menuFileName = `${docName.replace(/\-|\./g, '_')}${version.replace(/\-|v|\./g, '_')}`;
+        docsInfo.push({localPath, repoUrl, commitId, docName, version})
+
+        tpl += `{{ if in .File.Path "${localPath.split('/content/')[1]}" }}
+                  {{ $currentVersion := .Site.Data.docSidebar.${menuFileName}.version }}
+                  <h5>Documentation: 
+                  <select class="version-select">
+                  {{range .Site.Data.docSidebar.${menuFileName}.repoDocs}}
+                  {{$version := .version}}
+                  <option {{ cond (eq $currentVersion $version) "selected" "" }} value="{{$version}}">{{$version}}</option>
+                  {{end}}
+                  </select>
+                  </h5>
+                  
+                  {{ partial "sidebar-menu.html" .Site.Data.docSidebar.${menuFileName} }}
+                  <div class="commit-id">Commit Id: {{.Site.Data.docSidebar.${menuFileName}.commitId}}</div>
+                {{ end }}\n`;
+
+        execSync(`"./doc.sh" ${repo} ${repoUrl} ${commitId} ${localPath} ${menuFileName}`);
+
+        await handleMenuFiles(`./data/docSidebar/${menuFileName}.yml`, {
+          version,
+          commitId,
+          docs,
+        }, `/docs/${docName}/${version}`)
       }
 
     }
diff --git a/themes/docsy/layouts/partials/scripts.html b/themes/docsy/layouts/partials/scripts.html
index 7056ccc..b6dacdc 100644
--- a/themes/docsy/layouts/partials/scripts.html
+++ b/themes/docsy/layouts/partials/scripts.html
@@ -18,4 +18,10 @@
 {{ $js := $js | minify | fingerprint }}
 <script src="{{ $js.RelPermalink }}" integrity="{{ $js.Data.Integrity }}" crossorigin="anonymous"></script>
 {{ end }}
+
+<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
+<script>
+    window.onload = () => mermaid.init(undefined, ".language-mermaid");
+</script>
+
 {{ partial "hooks/body-end.html" . }}