Update documentation

This commit is contained in:
lowlighter
2021-03-02 10:29:01 +01:00
parent df6638fc9e
commit 5a821486ae
9 changed files with 25 additions and 8 deletions

4
.github/index.mjs vendored
View File

@@ -21,13 +21,13 @@
const staged = new Set()
//Load plugins metadata
const {plugins, templates} = await metadata({log:false})
const {plugins, templates, packaged} = await metadata({log:false})
//Update generated files
async function update({source, output, options = {}}) {
//Regenerate file
console.log(`Generating ${output}`)
const content = await ejs.renderFile(source, {plugins, templates}, {async:true, ...options})
const content = await ejs.renderFile(source, {plugins, templates, packaged}, {async:true, ...options})
//Save result
const file = paths.join(__metrics, output)
await fs.writeFile(file, content)

View File

@@ -5,7 +5,7 @@ While metrics targets mainly user accounts, it's possible to render metrics for
![Metrics (organization account)](https://github.com/lowlighter/lowlighter/blob/master/metrics.organization.svg)
<details>
<summary>💬 Metrics for organizations</summary>
<summary><b>💬 Metrics for organizations</b> <i>(click to expand)</i></summary>
Setup is the same as for user accounts, though you'll need to add `read:org` scope, **whether you're member of target organization or not**.
@@ -33,7 +33,7 @@ To support private repositories, add full `repo` scope to your personal token.
</details>
<details>
<summary>💬 Organizations memberships for user accounts</summary>
<summary><b>💬 Organizations memberships for user accounts</b> <i>(click to expand)</i></summary>
Only public memberships can be displayed by metrics by default.
You can manage your membership visibility in the `People` tab of your organization:

View File

@@ -1,5 +1,9 @@
Generate your metrics that you can embed everywhere, including your GitHub profile readme! It works for both user and organization accounts, and even for repositories!
<% if (/[.]0-beta$/.test(packaged.version)) { %>
<sup>*⚠️ This is the documentation of **v<%= packaged.version.replace(/[.]0-beta$/, "") %>-beta** (`@master` branch) which includes [unreleased features](https://github.com/lowlighter/metrics/compare/latest...master), see documentation of **v<%= (Number(packaged.version.replace(/[.]0-beta$/, ""))-0.1).toFixed(1) %>** (`@latest` branch) [here](https://github.com/lowlighter/metrics/blob/latest/README.md).*</sup>
<% } %>
<table>
<tr>
<th align="center">For user accounts</th>
@@ -13,6 +17,9 @@ Generate your metrics that you can embed everywhere, including your GitHub profi
let cell = 0
const elements = Object.entries(plugins).filter(([key, value]) => (value)&&(!["base", "core"].includes(key)))
%>
And you can customize these heavily with plugins, templates and hundreds of options!
<table>
<tr>
<th colspan="2" align="center">

View File

@@ -13,7 +13,7 @@ Assuming your username is `my-github-user`, you can then embed rendered metrics
```
<details>
<summary>💬 How to setup?</summary>
<summary><b>💬 How to setup?</b> <i>(click to expand)</i></summary>
### 0. Setup your personal repository

View File

@@ -9,7 +9,7 @@ For convenience, you can use the shared instance available at [metrics.lecoq.io]
This is mostly intended for previews, to enjoy all features consider using GitHub Action instead.
<details>
<summary>💬 Fair use</summary>
<summary><b>💬 Fair use</b> <i>(click to expand)</i></summary>
To ensure service availability, shared instance has a few limitations:
* Images are cached for 15 minutes

View File

@@ -11,7 +11,7 @@ Assuming your username is `my-github-user`, you can then embed rendered metrics
```
<details>
<summary>💬 How to setup?</summary>
<summary><b>💬 How to setup?</b> <i>(click to expand)</i></summary>
### 0. Prepare your server

View File

@@ -13,6 +13,7 @@
const __metrics = path.join(path.dirname(url.fileURLToPath(import.meta.url)), "../../..")
const __templates = path.join(__metrics, "source/templates")
const __plugins = path.join(__metrics, "source/plugins")
const __package = path.join(__metrics, "package.json")
//Init
const logger = log ? console.debug : () => null
@@ -45,8 +46,11 @@
const {classic, repository, community, ...templates} = Templates
Templates = {classic, repository, ...templates, community}
//Packaged metadata
const packaged = JSON.parse(`${await fs.promises.readFile(__package)}`)
//Metadata
return {plugins:Plugins, templates:Templates}
return {plugins:Plugins, templates:Templates, packaged}
}
/**Metadata extractor for templates */

View File

@@ -5,6 +5,9 @@ The recent *posts* plugin displays recent articles you wrote on an external sour
<table>
<td align="center">
<img src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.posts.svg">
<details><summary>With posts descriptions and cover images version</summary>
<img src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.posts.full.svg">
</details>
<img width="900" height="1" alt="">
</td>
</table>

View File

@@ -5,6 +5,9 @@ The recent *tweets* plugin displays your latest tweets from your [Twitter](https
<table>
<td align="center">
<img src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.tweets.svg">
<details><summary>With tweets attachments version</summary>
<img src="https://github.com/lowlighter/lowlighter/blob/master/metrics.plugin.tweets.attachments.svg">
</details>
<img width="900" height="1" alt="">
</td>
</table>