Update readme

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

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
* `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

View File

@@ -98,6 +98,9 @@ jobs:
# Template to use (see src/templates to get a list of supported templates)
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
# See https://developers.google.com/speed/docs/insights/v5/get-started for more informations
plugin_pagespeed: no
@@ -111,7 +114,9 @@ jobs:
plugin_traffic: no
# 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_from: 100
# Skip commits flagged with [Skip GitHub Action] from commits count
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.
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
The *pagespeed* plugin allows you to add the performances of the website attached to the GitHub user account :

File diff suppressed because one or more lines are too long

View File

@@ -66,8 +66,6 @@
//Base elements
const base = {}
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)
base[`base.${part}`] = parts.includes(part)
console.log(`Base parts | ${parts.join(", ")}`)

View File

@@ -72,11 +72,11 @@
<template v-else>
<img class="metrics preview-inline" :src="templates.placeholder" alt="metrics">
</template>
<div class="error" v-if="generated.error">An error occurred. Please try again later.</div>
</div>
<template v-if="user">
<button @click="generate" :disabled="generated.pending">{{ generated.pending ? "Working on it :)" : "Generate your metrics !" }}</button>
</template>
<div class="error" v-if="generated.error">An error occurred. Please try again later.</div>
</div>
<div class="step">
<h2>4. Embed these metrics on your GitHub profile</h2>

View File

@@ -104,14 +104,16 @@
}
.generator .preview-inliner {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.generator .preview-inline .metrics {
.generator .preview-inliner .metrics {
width: 100%;
max-width: 480px;
}
@media only screen and (min-width: 1180px) {
.generator .preview-inline {
.generator .preview-inliner {
display: none;
}
.generator .preview {

View File

@@ -12,7 +12,7 @@
export default async function build() {
//Build code
let {code} = await ncc(`${__dirname}/index.mjs`, {
//minify:true,
minify:true,
sourceMap:false,
sourceMapRegister:false,
})