From e2ebfc167145934f2edd253120d60371ca0d308d Mon Sep 17 00:00:00 2001 From: Frankzhaopku Date: Wed, 19 Aug 2020 12:11:25 +0800 Subject: [PATCH] feat: file framework --- .gitignore | 5 ++++ CONTRIBUTING.md | 3 ++ README.md | 3 +- REPORT.md | 0 REPORT_TEMPLATE.md | 3 ++ docs/.nojekyll | 0 docs/CONTRIBUTING.md | 1 + docs/_coverpage.md | 7 +++++ docs/_navbar.md | 2 ++ docs/_sidebar.md | 0 docs/index.html | 29 ++++++++++++++++++++ docs/zh-cn/CONTRIBUTING.md | 1 + sqls/total-developer-count/manifest.json | 4 +++ sqls/total-developer-count/post-processor.js | 6 ++++ sqls/total-developer-count/sql | 1 + sqls/total-record-count/manifest.json | 4 +++ sqls/total-record-count/post-processor.js | 6 ++++ sqls/total-record-count/sql | 1 + sqls/total-repo-count/manifest.json | 4 +++ sqls/total-repo-count/post-processor.js | 6 ++++ sqls/total-repo-count/sql | 1 + 21 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 .gitignore create mode 100644 CONTRIBUTING.md create mode 100644 REPORT.md create mode 100644 REPORT_TEMPLATE.md create mode 100644 docs/.nojekyll create mode 100644 docs/CONTRIBUTING.md create mode 100644 docs/_coverpage.md create mode 100644 docs/_navbar.md create mode 100644 docs/_sidebar.md create mode 100644 docs/index.html create mode 100644 docs/zh-cn/CONTRIBUTING.md create mode 100644 sqls/total-developer-count/manifest.json create mode 100644 sqls/total-developer-count/post-processor.js create mode 100644 sqls/total-developer-count/sql create mode 100644 sqls/total-record-count/manifest.json create mode 100644 sqls/total-record-count/post-processor.js create mode 100644 sqls/total-record-count/sql create mode 100644 sqls/total-repo-count/manifest.json create mode 100644 sqls/total-repo-count/post-processor.js create mode 100644 sqls/total-repo-count/sql diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..51a1a2ff9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.vscode +.idea +.DS_Store +*.swp +*.lock diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..c0f8f127d --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,3 @@ +# Contributing Guide + +If you want to contribute to this report, you may need to read our [Contributing guide](./docs/CONTRIBUTING.md) first. diff --git a/README.md b/README.md index 3a99d039a..f031147eb 100644 --- a/README.md +++ b/README.md @@ -1,2 +1 @@ -# github-analysis-report-2020 -GitHub digital report 2020 +# GitHub Analysis Report 2020 diff --git a/REPORT.md b/REPORT.md new file mode 100644 index 000000000..e69de29bb diff --git a/REPORT_TEMPLATE.md b/REPORT_TEMPLATE.md new file mode 100644 index 000000000..ad9dd9470 --- /dev/null +++ b/REPORT_TEMPLATE.md @@ -0,0 +1,3 @@ +# GitHub Analysis Report 2020 + +We anaylsis {{slqs['total-record-count'].text}} records of GitHub logs, there are {{sqls['total-repo-count']}} active repositories and {{sqls['total-developer-count']}} active developers on GitHub during year {{year}}. diff --git a/docs/.nojekyll b/docs/.nojekyll new file mode 100644 index 000000000..e69de29bb diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md new file mode 100644 index 000000000..4f1c99f7a --- /dev/null +++ b/docs/CONTRIBUTING.md @@ -0,0 +1 @@ +# Contributing Guide diff --git a/docs/_coverpage.md b/docs/_coverpage.md new file mode 100644 index 000000000..ac0035e2a --- /dev/null +++ b/docs/_coverpage.md @@ -0,0 +1,7 @@ +# GitHub Analysis Report 2020 + +> An open source collaborate report for GitHub + +- Full access to all records on GitHub +- Global collaborate +- Case study supported diff --git a/docs/_navbar.md b/docs/_navbar.md new file mode 100644 index 000000000..c0212cc88 --- /dev/null +++ b/docs/_navbar.md @@ -0,0 +1,2 @@ +* [En](/) +* [中文](/zh-cn/) diff --git a/docs/_sidebar.md b/docs/_sidebar.md new file mode 100644 index 000000000..e69de29bb diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 000000000..ceac0e2fc --- /dev/null +++ b/docs/index.html @@ -0,0 +1,29 @@ + + + + + + GitHub Analysis Report 2020 + + + + + + + +
+ + + + + diff --git a/docs/zh-cn/CONTRIBUTING.md b/docs/zh-cn/CONTRIBUTING.md new file mode 100644 index 000000000..692df6ab8 --- /dev/null +++ b/docs/zh-cn/CONTRIBUTING.md @@ -0,0 +1 @@ +# 贡献指南 diff --git a/sqls/total-developer-count/manifest.json b/sqls/total-developer-count/manifest.json new file mode 100644 index 000000000..de2353b5a --- /dev/null +++ b/sqls/total-developer-count/manifest.json @@ -0,0 +1,4 @@ +{ + "config": {}, + "description": "Return the total active developer count of year {{year}}" +} diff --git a/sqls/total-developer-count/post-processor.js b/sqls/total-developer-count/post-processor.js new file mode 100644 index 000000000..321a98ac4 --- /dev/null +++ b/sqls/total-developer-count/post-processor.js @@ -0,0 +1,6 @@ +export default async function(data) { + if (!Number.isInteger(data[0].count)) { + throw new Error('Invalid data'); + } + return data[0].count; +} diff --git a/sqls/total-developer-count/sql b/sqls/total-developer-count/sql new file mode 100644 index 000000000..28c39076b --- /dev/null +++ b/sqls/total-developer-count/sql @@ -0,0 +1 @@ +SELECT COUNTDistinct(actor_id) as count FROM {{table}} diff --git a/sqls/total-record-count/manifest.json b/sqls/total-record-count/manifest.json new file mode 100644 index 000000000..453af8ff5 --- /dev/null +++ b/sqls/total-record-count/manifest.json @@ -0,0 +1,4 @@ +{ + "config": {}, + "description": "Return the total record count of year {{year}}" +} diff --git a/sqls/total-record-count/post-processor.js b/sqls/total-record-count/post-processor.js new file mode 100644 index 000000000..321a98ac4 --- /dev/null +++ b/sqls/total-record-count/post-processor.js @@ -0,0 +1,6 @@ +export default async function(data) { + if (!Number.isInteger(data[0].count)) { + throw new Error('Invalid data'); + } + return data[0].count; +} diff --git a/sqls/total-record-count/sql b/sqls/total-record-count/sql new file mode 100644 index 000000000..29979a607 --- /dev/null +++ b/sqls/total-record-count/sql @@ -0,0 +1 @@ +SELECT COUNT(*) as count FROM {{table}} diff --git a/sqls/total-repo-count/manifest.json b/sqls/total-repo-count/manifest.json new file mode 100644 index 000000000..23b38bd87 --- /dev/null +++ b/sqls/total-repo-count/manifest.json @@ -0,0 +1,4 @@ +{ + "config": {}, + "description": "Return the total active repo count of year {{year}}" +} diff --git a/sqls/total-repo-count/post-processor.js b/sqls/total-repo-count/post-processor.js new file mode 100644 index 000000000..321a98ac4 --- /dev/null +++ b/sqls/total-repo-count/post-processor.js @@ -0,0 +1,6 @@ +export default async function(data) { + if (!Number.isInteger(data[0].count)) { + throw new Error('Invalid data'); + } + return data[0].count; +} diff --git a/sqls/total-repo-count/sql b/sqls/total-repo-count/sql new file mode 100644 index 000000000..8b83cd9ba --- /dev/null +++ b/sqls/total-repo-count/sql @@ -0,0 +1 @@ +SELECT COUNTDistinct(repo_id) as count FROM {{table}}