Update readme

This commit is contained in:
lowlighter committed 2020-10-24 18:41:57 +02:00
1 parent 265f981f49
commit f2fb214afe
7 files changed
+46 -7

No files matched your search

+1
View File
@@ -54,6 +54,7 @@ This way you'll be able to rapidly test SVG renders with your browser.
* `index.mjs` contains the metrics server entry point * `index.mjs` contains the metrics server entry point
* `src/app.mjs` contains the metrics server code which serves, renders, restricts/rate limit, etc. * `src/app.mjs` contains the metrics server code which serves, renders, restricts/rate limit, etc.
* `src/html/*` contains the metrics server static files
#### GitHub action #### GitHub action
+38
View File
@@ -98,6 +98,9 @@ jobs:
# Template to use (see src/templates to get a list of supported templates) # Template to use (see src/templates to get a list of supported templates)
template: classic template: classic
# Base content to include in metrics (list of comma-separated sections name as string)
base: "header, activity, community, repositories, metadata"
# Enable Google PageSpeed metrics for account attached website # Enable Google PageSpeed metrics for account attached website
# See https://developers.google.com/speed/docs/insights/v5/get-started for more informations # See https://developers.google.com/speed/docs/insights/v5/get-started for more informations
plugin_pagespeed: no plugin_pagespeed: no
@@ -111,7 +114,9 @@ jobs:
plugin_traffic: no plugin_traffic: no
# Enable coding habits metrics # Enable coding habits metrics
# You can also configure the number of activity events to base habits on (up to 100)
plugin_habits: no plugin_habits: no
plugin_habits_from: 100
# Skip commits flagged with [Skip GitHub Action] from commits count # Skip commits flagged with [Skip GitHub Action] from commits count
plugin_selfskip: no plugin_selfskip: no
@@ -359,6 +364,39 @@ The following errors code can be encountered if on a server instance :
Plugins are features which are disabled by default but they can provide additional metrics. Plugins are features which are disabled by default but they can provide additional metrics.
In return they may require additional configuration and tend to consume additional API requests. In return they may require additional configuration and tend to consume additional API requests.
#### Base content
By default, generated metrics contains the following sections :
* `header`, which usually contains your username, your two-week commits calendars and a few additional data
* `activity`, which contains your recent activity (commits, pull requests opened/reviewed, issues opened, comments, etc.)
* `community`, which contains your community stats (following, sponsors, stars, watching, organizations, etc.)
* `repositories`, which contains your repositories stats (license, forks, stars, watchers, packages, gists, etc.)
* `metadata`, which contains informations about generated metrics (last updated date, etc.)
<summary>💬 About</summary>
You can explicitely opt-out from them, if you want to keep only a few sections or if you want to use a plugin as standalone.
##### Setup with GitHub actions
Choose the parts you want to keep and update your workflow. For exemple, to keep only `header` and `repositories` sections, add the following to your workflow :
```yaml
- uses: lowlighter/metrics@latest
with:
# ... other options
base: "header, repositories" # opt-out from "activity", "community" and "metadata"
```
##### Setup in your own instance
Pass `?base.activity=0&base.` in url when generating metrics.
</details>
# Base content to include in metrics (list of comma-separated sections name as string)
#### ⏱️ PageSpeed #### ⏱️ PageSpeed
The *pagespeed* plugin allows you to add the performances of the website attached to the GitHub user account : The *pagespeed* plugin allows you to add the performances of the website attached to the GitHub user account :
+1 -1
View File
@@ -1 +1 @@
module.exports=(()=>{var __webpack_modules__={64563:(e,t,r)=>{"use strict";r.r(t);var n={};r.r(n);r.d(n,{default:()=>E_Users_lecoq_Documents_GitHub_gitstats_src_setup});var i={};r.r(i);r.d(i,{default:()=>metrics});var o=r(35747);var a=r.n(o);var s=r(85622);var l=r.n(s);async function E_Users_lecoq_Documents_GitHub_gitstats_src_setup({log:e=true}={}){const t=e?console.debug:()=>null;t(`metrics/setup > setup`);const n="src/templates";const i={templates:{},settings:{},statics:r.ab+"html",node_modules:l().resolve("node_modules")};t(`metrics/setup > load settings.json`);if(a().existsSync(r.ab+"settings.json")){i.settings=JSON.parse(`${await a().promises.readFile(l().resolve("settings.json"))}`);t(`metrics/setup > load settings.json > success`)}else t(`metrics/setup > load settings.json > (missing)`);if(!i.settings.templates)i.settings.templates={default:"classic",enabled:[]};if(!i.settings.plugins)i.settings.plugins={};i.settings.plugins.base={parts:["header","activity","community","repositories","metadata"]};if(i.settings.debug)t(i.settings);t(`metrics/setup > load package.json`);if(a().existsSync(r.ab+"package.json")){i.package=JSON.parse(`${await a().promises.readFile(l().resolve("package.json"))}`);t(`metrics/setup > load package.json > success`)}else{t(`metrics/setup > load package.json > (missing)`);i.package={version:"2.2.0",author:"lowlighter"}}if(a().existsSync(r.ab+"templates")){for(const e of await a().promises.readdir(n)){if(/.*[.]mjs$/.test(e))continue;t(`metrics/setup > load template [${e}]`);const r=[`${n}/${e}/query.graphql`,`${n}/${e}/image.svg`,`${n}/${e}/style.css`];const[o,s,c]=await Promise.all(r.map(async e=>`${await a().promises.readFile(l().resolve(e))}`));i.templates[e]={query:o,image:s,style:c};t(`metrics/setup > load template [${e}] > success`);if(i.settings.debug){Object.defineProperty(i.templates,e,{get(){t(`metrics/setup > reload template [${e}]`);const[n,i,o]=r.map(e=>`${a().readFileSync(l().resolve(e))}`);t(`metrics/setup > reload template [${e}] > success`);return{query:n,image:i,style:o}}})}}}else{t(`metrics/setup > load templates from build`);i.templates=JSON.parse(Buffer.from(`eyJjbGFzc2ljIjp7InF1ZXJ5IjoicXVlcnkgTWV0cmljcyB7XHJcbiAgdXNlcihsb2dpbjogJGxvZ2luKSB7XHJcbiAgICBkYXRhYmFzZUlkXHJcbiAgICBuYW1lXHJcbiAgICBsb2dpblxyXG4gICAgY3JlYXRlZEF0XHJcbiAgICBhdmF0YXJVcmxcclxuICAgIHdlYnNpdGVVcmxcclxuICAgIGdpc3RzIHtcclxuICAgICAgdG90YWxDb3VudFxyXG4gICAgfVxyXG4gICAgcmVwb3NpdG9yaWVzKGxhc3Q6ICRyZXBvc2l0b3JpZXMsIGlzRm9yazogZmFsc2UsIG93bmVyQWZmaWxpYXRpb25zOiBPV05FUikge1xyXG4gICAgICB0b3RhbENvdW50XHJcbiAgICAgIG5vZGVzIHtcclxuICAgICAgICBuYW1lXHJcbiAgICAgICAgd2F0Y2hlcnMge1xyXG4gICAgICAgICAgdG90YWxDb3VudFxyXG4gICAgICAgIH1cclxuICAgICAgICBzdGFyZ2F6ZXJzIHtcclxuICAgICAgICAgIHRvdGFsQ291bnRcclxuICAgICAgICB9XHJcbiAgICAgICAgbGFuZ3VhZ2VzKGZpcnN0OiA0KSB7XHJcbiAgICAgICAgICBlZGdlcyB7XHJcbiAgICAgICAgICAgIHNpemVcclxuICAgICAgICAgICAgbm9kZSB7XHJcbiAgICAgICAgICAgICAgY29sb3JcclxuICAgICAgICAgICAgICBuYW1lXHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgIH1cclxuICAgICAgICB9XHJcbiAgICAgICAgaXNzdWVzX29wZW46IGlzc3VlcyhzdGF0ZXM6IE9QRU4pIHtcclxuICAgICAgICAgIHRvdGFsQ291bnRcclxuICAgICAgICB9XHJcbiAgICAgICAgaXNzdWVzX2Nsb3NlZDogaXNzdWVzKHN0YXRlczogQ0xPU0VEKSB7XHJcbiAgICAgICAgICB0b3RhbENvdW50XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHByX29wZW46IHB1bGxSZXF1ZXN0cyhzdGF0ZXM6IE9QRU4pIHtcclxuICAgICAgICAgIHRvdGFsQ291bnRcclxuICAgICAgICB9XHJcbiAgICAgICAgcHJfbWVyZ2VkOiBwdWxsUmVxdWVzdHMoc3RhdGVzOiBNRVJHRUQpIHtcclxuICAgICAgICAgIHRvdGFsQ291bnRcclxuICAgICAgICB9XHJcbiAgICAgICAgZm9ya0NvdW50XHJcbiAgICAgICAgbGljZW5zZUluZm8ge1xyXG4gICAgICAgICAgc3BkeElkXHJcbiAgICAgICAgfVxyXG4gICAgICB9XHJcbiAgICB9XHJcbiAgICBwYWNrYWdlcyB7XHJcbiAgICAgIHRvdGFsQ291bnRcclxuICAgIH1cclxuICAgIHN0YXJyZWRSZXBvc2l0b3JpZXMge1xyXG4gICAgICB0b3RhbENvdW50XHJcbiAgICB9XHJcbiAgICB3YXRjaGluZyB7XHJcbiAgICAgIHRvdGFsQ291bnRcclxuICAgIH1cclxuICAgIHNwb25zb3JzaGlwc0FzU3BvbnNvciB7XHJcbiAgICAgIHRvdGFsQ291bnRcclxuICAgIH1cclxuICAgIHNwb25zb3JzaGlwc0FzTWFpbnRhaW5lciB7XHJcbiAgICAgIHRvdGFsQ291bnRcclxuICAgIH1cclxuICAgIGNvbnRyaWJ1dGlvbnNDb2xsZWN0aW9uIHtcclxuICAgICAgdG90YWxSZXBvc2l0b3JpZXNXaXRoQ29udHJpYnV0ZWRDb21taXRzXHJcbiAgICAgIHRvdGFsQ29tbWl0Q29udHJpYnV0aW9uc1xyXG4gICAgICByZXN0cmljdGVkQ29udHJpYnV0aW9uc0NvdW50XHJcbiAgICAgIHRvdGFsSXNzdWVDb250cmlidXRpb25zXHJcbiAgICAgIHRvdGFsUHVsbFJlcXVlc3RDb250cmlidXRpb25zXHJcbiAgICAgIHRvdGFsUHVsbFJlcXVlc3RSZXZpZXdDb250cmlidXRpb25zXHJcbiAgICB9XHJcbiAgICBjYWxlbmRhcjpjb250cmlidXRpb25zQ29sbGVjdGlvbihmcm9tOiAkY2FsZW5kYXIuZnJvbSwgdG86ICRjYWxlbmRhci50bykge1xyXG4gICAgICBjb250cmlidXRpb25DYWxlbmRhciB7XHJcbiAgICAgICAgd2Vla3Mge1xyXG4gICAgICAgICAgY29udHJpYnV0aW9uRGF5cyB7XHJcbiAgICAgICAgICAgIGNvbG9yXHJcbiAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgICB9XHJcbiAgICB9XHJcbiAgICByZXBvc2l0b3JpZXNDb250cmlidXRlZFRvIHtcclxuICAgICAgdG90YWxDb3VudFxyXG4gICAgfVxyXG4gICAgZm9sbG93ZXJzIHtcclxuICAgICAgdG90YWxDb3VudFxyXG4gICAgfVxyXG4gICAgZm9sbG93aW5nIHtcclxuICAgICAgdG90YWxDb3VudFxyXG4gICAgfVxyXG4gICAgaXNzdWVDb21tZW50cyB7XHJcbiAgICAgIHRvdGFsQ291bnRcclxuICAgIH1cclxuICAgIG9yZ2FuaXphdGlvbnMge1xyXG4gICAgICB0b3RhbENvdW50XHJcbi Line truncated module.exports=(()=>{var __webpack_modules__={64563:(e,t,r)=>{"use strict";r.r(t);var n={};r.r(n);r.d(n,{default:()=>E_Users_lecoq_Documents_GitHub_gitstats_src_setup});var i={};r.r(i);r.d(i,{default:()=>metrics});var o=r(35747);var a=r.n(o);var s=r(85622);var l=r.n(s);async function E_Users_lecoq_Documents_GitHub_gitstats_src_setup({log:e=true}={}){const t=e?console.debug:()=>null;t(`metrics/setup > setup`);const n="src/templates";const i={templates:{},settings:{},statics:r.ab+"html",node_modules:l().resolve("node_modules")};t(`metrics/setup > load settings.json`);if(a().existsSync(r.ab+"settings.json")){i.settings=JSON.parse(`${await a().promises.readFile(l().resolve("settings.json"))}`);t(`metrics/setup > load settings.json > success`)}else t(`metrics/setup > load settings.json > (missing)`);if(!i.settings.templates)i.settings.templates={default:"classic",enabled:[]};if(!i.settings.plugins)i.settings.plugins={};i.settings.plugins.base={parts:["header","activity","community","repositories","metadata"]};if(i.settings.debug)t(i.settings);t(`metrics/setup > load package.json`);if(a().existsSync(r.ab+"package.json")){i.package=JSON.parse(`${await a().promises.readFile(l().resolve("package.json"))}`);t(`metrics/setup > load package.json > success`)}else{t(`metrics/setup > load package.json > (missing)`);i.package={version:"2.2.0",author:"lowlighter"}}if(a().existsSync(r.ab+"templates")){for(const e of await a().promises.readdir(n)){if(/.*[.]mjs$/.test(e))continue;t(`metrics/setup > load template [${e}]`);const r=[`${n}/${e}/query.graphql`,`${n}/${e}/image.svg`,`${n}/${e}/style.css`];const[o,s,c]=await Promise.all(r.map(async e=>`${await a().promises.readFile(l().resolve(e))}`));i.templates[e]={query:o,image:s,style:c};t(`metrics/setup > load template [${e}] > success`);if(i.settings.debug){Object.defineProperty(i.templates,e,{get(){t(`metrics/setup > reload template [${e}]`);const[n,i,o]=r.map(e=>`${a().readFileSync(l().resolve(e))}`);t(`metrics/setup > reload template [${e}] > success`);return{query:n,image:i,style:o}}})}}}else{t(`metrics/setup > load templates from build`);i.templates=JSON.parse(Buffer.from(`eyJjbGFzc2ljIjp7InF1ZXJ5IjoicXVlcnkgTWV0cmljcyB7XHJcbiAgdXNlcihsb2dpbjogJGxvZ2luKSB7XHJcbiAgICBkYXRhYmFzZUlkXHJcbiAgICBuYW1lXHJcbiAgICBsb2dpblxyXG4gICAgY3JlYXRlZEF0XHJcbiAgICBhdmF0YXJVcmxcclxuICAgIHdlYnNpdGVVcmxcclxuICAgIGdpc3RzIHtcclxuICAgICAgdG90YWxDb3VudFxyXG4gICAgfVxyXG4gICAgcmVwb3NpdG9yaWVzKGxhc3Q6ICRyZXBvc2l0b3JpZXMsIGlzRm9yazogZmFsc2UsIG93bmVyQWZmaWxpYXRpb25zOiBPV05FUikge1xyXG4gICAgICB0b3RhbENvdW50XHJcbiAgICAgIG5vZGVzIHtcclxuICAgICAgICBuYW1lXHJcbiAgICAgICAgd2F0Y2hlcnMge1xyXG4gICAgICAgICAgdG90YWxDb3VudFxyXG4gICAgICAgIH1cclxuICAgICAgICBzdGFyZ2F6ZXJzIHtcclxuICAgICAgICAgIHRvdGFsQ291bnRcclxuICAgICAgICB9XHJcbiAgICAgICAgbGFuZ3VhZ2VzKGZpcnN0OiA0KSB7XHJcbiAgICAgICAgICBlZGdlcyB7XHJcbiAgICAgICAgICAgIHNpemVcclxuICAgICAgICAgICAgbm9kZSB7XHJcbiAgICAgICAgICAgICAgY29sb3JcclxuICAgICAgICAgICAgICBuYW1lXHJcbiAgICAgICAgICAgIH1cclxuICAgICAgICAgIH1cclxuICAgICAgICB9XHJcbiAgICAgICAgaXNzdWVzX29wZW46IGlzc3VlcyhzdGF0ZXM6IE9QRU4pIHtcclxuICAgICAgICAgIHRvdGFsQ291bnRcclxuICAgICAgICB9XHJcbiAgICAgICAgaXNzdWVzX2Nsb3NlZDogaXNzdWVzKHN0YXRlczogQ0xPU0VEKSB7XHJcbiAgICAgICAgICB0b3RhbENvdW50XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHByX29wZW46IHB1bGxSZXF1ZXN0cyhzdGF0ZXM6IE9QRU4pIHtcclxuICAgICAgICAgIHRvdGFsQ291bnRcclxuICAgICAgICB9XHJcbiAgICAgICAgcHJfbWVyZ2VkOiBwdWxsUmVxdWVzdHMoc3RhdGVzOiBNRVJHRUQpIHtcclxuICAgICAgICAgIHRvdGFsQ291bnRcclxuICAgICAgICB9XHJcbiAgICAgICAgZm9ya0NvdW50XHJcbiAgICAgICAgbGljZW5zZUluZm8ge1xyXG4gICAgICAgICAgc3BkeElkXHJcbiAgICAgICAgfVxyXG4gICAgICB9XHJcbiAgICB9XHJcbiAgICBwYWNrYWdlcyB7XHJcbiAgICAgIHRvdGFsQ291bnRcclxuICAgIH1cclxuICAgIHN0YXJyZWRSZXBvc2l0b3JpZXMge1xyXG4gICAgICB0b3RhbENvdW50XHJcbiAgICB9XHJcbiAgICB3YXRjaGluZyB7XHJcbiAgICAgIHRvdGFsQ291bnRcclxuICAgIH1cclxuICAgIHNwb25zb3JzaGlwc0FzU3BvbnNvciB7XHJcbiAgICAgIHRvdGFsQ291bnRcclxuICAgIH1cclxuICAgIHNwb25zb3JzaGlwc0FzTWFpbnRhaW5lciB7XHJcbiAgICAgIHRvdGFsQ291bnRcclxuICAgIH1cclxuICAgIGNvbnRyaWJ1dGlvbnNDb2xsZWN0aW9uIHtcclxuICAgICAgdG90YWxSZXBvc2l0b3JpZXNXaXRoQ29udHJpYnV0ZWRDb21taXRzXHJcbiAgICAgIHRvdGFsQ29tbWl0Q29udHJpYnV0aW9uc1xyXG4gICAgICByZXN0cmljdGVkQ29udHJpYnV0aW9uc0NvdW50XHJcbiAgICAgIHRvdGFsSXNzdWVDb250cmlidXRpb25zXHJcbiAgICAgIHRvdGFsUHVsbFJlcXVlc3RDb250cmlidXRpb25zXHJcbiAgICAgIHRvdGFsUHVsbFJlcXVlc3RSZXZpZXdDb250cmlidXRpb25zXHJcbiAgICB9XHJcbiAgICBjYWxlbmRhcjpjb250cmlidXRpb25zQ29sbGVjdGlvbihmcm9tOiAkY2FsZW5kYXIuZnJvbSwgdG86ICRjYWxlbmRhci50bykge1xyXG4gICAgICBjb250cmlidXRpb25DYWxlbmRhciB7XHJcbiAgICAgICAgd2Vla3Mge1xyXG4gICAgICAgICAgY29udHJpYnV0aW9uRGF5cyB7XHJcbiAgICAgICAgICAgIGNvbG9yXHJcbiAgICAgICAgICB9XHJcbiAgICAgICAgfVxyXG4gICAgICB9XHJcbiAgICB9XHJcbiAgICByZXBvc2l0b3JpZXNDb250cmlidXRlZFRvIHtcclxuICAgICAgdG90YWxDb3VudFxyXG4gICAgfVxyXG4gICAgZm9sbG93ZXJzIHtcclxuICAgICAgdG90YWxDb3VudFxyXG4gICAgfVxyXG4gICAgZm9sbG93aW5nIHtcclxuICAgICAgdG90YWxDb3VudFxyXG4gICAgfVxyXG4gICAgaXNzdWVDb21tZW50cyB7XHJcbiAgICAgIHRvdGFsQ291bnRcclxuICAgIH1cclxuICAgIG9yZ2FuaXphdGlvbnMge1xyXG4gICAgICB0b3RhbENvdW50XHJcbi Line truncated
-2
View File
@@ -66,8 +66,6 @@
//Base elements //Base elements
const base = {} const base = {}
let parts = (core.getInput("base")||"").split(",").map(part => part.trim()) let parts = (core.getInput("base")||"").split(",").map(part => part.trim())
if (!parts.length)
parts = conf.settings.plugins.base.parts
for (const part of conf.settings.plugins.base.parts) for (const part of conf.settings.plugins.base.parts)
base[`base.${part}`] = parts.includes(part) base[`base.${part}`] = parts.includes(part)
console.log(`Base parts | ${parts.join(", ")}`) console.log(`Base parts | ${parts.join(", ")}`)
+1 -1
View File
@@ -72,11 +72,11 @@
<template v-else> <template v-else>
<img class="metrics preview-inline" :src="templates.placeholder" alt="metrics"> <img class="metrics preview-inline" :src="templates.placeholder" alt="metrics">
</template> </template>
<div class="error" v-if="generated.error">An error occurred. Please try again later.</div>
</div> </div>
<template v-if="user"> <template v-if="user">
<button @click="generate" :disabled="generated.pending">{{ generated.pending ? "Working on it :)" : "Generate your metrics !" }}</button> <button @click="generate" :disabled="generated.pending">{{ generated.pending ? "Working on it :)" : "Generate your metrics !" }}</button>
</template> </template>
<div class="error" v-if="generated.error">An error occurred. Please try again later.</div>
</div> </div>
<div class="step"> <div class="step">
<h2>4. Embed these metrics on your GitHub profile</h2> <h2>4. Embed these metrics on your GitHub profile</h2>
+4 -2
View File
@@ -104,14 +104,16 @@
} }
.generator .preview-inliner { .generator .preview-inliner {
display: flex; display: flex;
flex-direction: column;
justify-content: center; justify-content: center;
align-items: center;
} }
.generator .preview-inline .metrics { .generator .preview-inliner .metrics {
width: 100%; width: 100%;
max-width: 480px; max-width: 480px;
} }
@media only screen and (min-width: 1180px) { @media only screen and (min-width: 1180px) {
.generator .preview-inline { .generator .preview-inliner {
display: none; display: none;
} }
.generator .preview { .generator .preview {
+1 -1
View File
@@ -12,7 +12,7 @@
export default async function build() { export default async function build() {
//Build code //Build code
let {code} = await ncc(`${__dirname}/index.mjs`, { let {code} = await ncc(`${__dirname}/index.mjs`, {
//minify:true, minify:true,
sourceMap:false, sourceMap:false,
sourceMapRegister:false, sourceMapRegister:false,
}) })