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 2023/02/01 11:44:25 UTC
[skywalking-website] branch master updated: remove contributions graph (#564)
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 440b6051a0c remove contributions graph (#564)
440b6051a0c is described below
commit 440b6051a0caaf237f833bb38154730d30afc553
Author: Juntao Zhang <71...@qq.com>
AuthorDate: Wed Feb 1 19:44:21 2023 +0800
remove contributions graph (#564)
---
content/team/_index.md | 6 --
package.json | 2 +-
scripts/team.js | 112 +------------------------
themes/docsy/layouts/partials/script-team.html | 6 +-
4 files changed, 5 insertions(+), 121 deletions(-)
diff --git a/content/team/_index.md b/content/team/_index.md
index 413ccbf9e64..0092110564f 100644
--- a/content/team/_index.md
+++ b/content/team/_index.md
@@ -111,9 +111,3 @@ The SkyWalking team is comprised of Members and Contributors, and the growth has
</div>
{{< contributors >}}
-
-## Contributions over time
-
-<div class="graph-wrapper">
-<div id="mergedGraph" style="height: 300px"></div>
-</div>
diff --git a/package.json b/package.json
index 7a29966e4d2..9f8d878a5e3 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,7 @@
"scripts": {
"build": "npm install && hugo",
"build-with-docs": "npm install && npm run docs && npm run team && hugo && npm run cp",
- "build-preview": "npm install && npm run docs && hugo && npm run cp",
+ "build-preview": "npm install && npm run docs && npm run team && hugo && npm run cp",
"docs": "node ./docs.js",
"team": "node ./scripts/team.js",
"cp": "cp ./.htaccess ./public && cp ./.asf.yaml ./public",
diff --git a/scripts/team.js b/scripts/team.js
index 9695e1572c2..ce27339774e 100644
--- a/scripts/team.js
+++ b/scripts/team.js
@@ -7,9 +7,8 @@ const axios = require('axios');
const {promises} = fs;
const docsFile = path.join(__dirname, '../data/docs.yml')
const teamFile = path.join(__dirname, '../data/team.yml')
-const mergedDataFile = path.join(__dirname, '../themes/docsy/static/js/mergedData.js')
-const sleep = (ms = 8 * 1000) => {
+const sleep = (ms = 2 * 1000) => {
console.log('waiting...');
return new Promise(resolve => setTimeout(() => resolve(), ms));
}
@@ -18,7 +17,6 @@ class GenerateTeamYaml {
constructor(docsFile, teamFile) {
this.docsFile = docsFile;
this.teamFile = teamFile;
- this.mergedDataFile = mergedDataFile;
this.nativeObject = [];
this.logins = {};
this.mergedData = [];
@@ -38,121 +36,17 @@ class GenerateTeamYaml {
async getAllRepoData() {
const promiseList = [];
- const mergedPromiseList = [];
for (const k of this.nativeObject) {
for (const item of k.list) {
const {user, repo, extraContributors} = item;
const list = [];
if (user && repo) {
promiseList.push(this.getRepoContributors({user, repo, extraContributors, list, item}));
- mergedPromiseList.push(this.getMergedData({user, repo}));
}
await sleep()
}
}
await Promise.all(promiseList)
- await Promise.all(mergedPromiseList)
- }
-
- async getMergedData({user, repo}) {
- const that = this;
- let count = 0;
- const NUM = 8;
- const FAIL_TIPS = `${user}/${repo}/graphs failed!`;
-
- try {
- await getContributionsGraphs()
- } catch (e) {
- console.log(FAIL_TIPS);
- process.exit(1)
- }
-
- async function getContributionsGraphs() {
- ++count;
- if (count > 1) {
- console.log(`${user}/${repo}: retry ${count} ...`);
- }
- try {
- const res = await axios.get(`https://github.com/${user}/${repo}/graphs/contributors-data`, {
- headers: {
- 'accept': 'application/json',
- 'User-Agent': '',
- },
- });
- const {status, data: source = []} = res
- if (status === 200 && source.length) {
- source.repo = repo;
- that.mergedData.push(source);
- console.log(`${user}/${repo}/graphs success!`);
- } else {
- console.log(`${user}/${repo}/graphs: res.status ${status}!`);
- if (count < NUM) {
- await sleep()
- await getContributionsGraphs()
- }
-
- }
- } catch (e) {
- console.log(`${user}/${repo}/`, e);
- if (count < NUM) {
- await sleep()
- await getContributionsGraphs()
- }
- }
- }
- }
-
- buildMergedData(sources) {
- const maxSource = this.getMaxData(sources);
- const maxWeekLen = maxSource[0].weeks.length;
- const data = [];
- const date = [];
-
- const x = new Date();
- const timepoint = x.setFullYear(2021, 7, 25);
-
- for (let i = 0; i < maxWeekLen; i++) {
- let num = 0;
- const {w: week} = maxSource[0].weeks[i];
-
- const now = new Date(+(week + '000'));
- date.push([now.getFullYear(), now.getMonth() + 1, now.getDate()].join('/'));
-
- sources.forEach((source = []) => {
- if (!source[0] || !source[0].weeks) {
- return;
- }
- const len = source[0].weeks.length;
-
- for (let k = 0; k < len; k++) {
- const usersCount = source.length;
- const curWeek = source[0].weeks[k] && source[0].weeks[k].w;
- if (curWeek === week) {
- for (let j = 0; j < usersCount; j++) {
- const {c} = source[j] && source[j].weeks[k];
- if (source.repo !== 'skywalking-java' || now > timepoint) {
- num += c
- }
- }
- }
- }
- })
-
- data.push(num)
- }
- return {data, date}
- }
-
- getMaxData(sources) {
- let maxWeekLen = 0;
- let maxSource;
- sources.forEach(item => {
- if (item.length > maxWeekLen) {
- maxWeekLen = item.length
- maxSource = item
- }
- })
- return maxSource
}
async writeFile() {
@@ -163,10 +57,6 @@ class GenerateTeamYaml {
const yamlString = YAML.stringify(data);
await promises.writeFile(this.teamFile, yamlString, 'utf8');
console.log('team.yml success!');
-
- const mergedGraphData = this.buildMergedData(this.mergedData)
- await promises.writeFile(this.mergedDataFile, `var mergedData = ${JSON.stringify(mergedGraphData)}`, 'utf8');
- console.log('mergedData.js success!');
}
async loadYaml() {
diff --git a/themes/docsy/layouts/partials/script-team.html b/themes/docsy/layouts/partials/script-team.html
index a1da2c19606..2697fc8abad 100644
--- a/themes/docsy/layouts/partials/script-team.html
+++ b/themes/docsy/layouts/partials/script-team.html
@@ -1,6 +1,6 @@
-<script src="/js/echarts.min.js"></script>
-<script src="/js/mergedData.js"></script>
-<script src="/js/initMergedGraph.js?t=20220810"></script>
+<!--<script src="/js/echarts.min.js"></script>-->
+<!--<script src="/js/mergedData.js"></script>-->
+<!--<script src="/js/initMergedGraph.js?t=20220810"></script>-->
<script>
$('.item').on('click', function (e) {
e.preventDefault();