Add features section

This commit is contained in:
lowlighter
2021-05-18 23:55:13 +02:00
parent 5627ef434d
commit 2a701caa4f
4 changed files with 17 additions and 4 deletions

4
.github/index.mjs vendored
View File

@@ -21,13 +21,13 @@
const staged = new Set()
//Load plugins metadata
const {plugins, templates, packaged} = await metadata({log:false})
const {plugins, templates, packaged, descriptor} = 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, packaged}, {async:true, ...options})
const content = await ejs.renderFile(source, {plugins, templates, packaged, descriptor}, {async:true, ...options})
//Save result
const file = paths.join(__metrics, output)
await fs.writeFile(file, content)

View File

@@ -2,6 +2,6 @@
![Build](https://github.com/lowlighter/metrics/workflows/Build/badge.svg) [![Metrics (examples)](https://github.com/lowlighter/lowlighter/actions/workflows/metrics.yml/badge.svg)](https://github.com/lowlighter/lowlighter/actions/workflows/metrics.yml)
<% for (const partial of ["introduction", "shared", "setup", "documentation", "license", "references"]) { -%>
<% for (const partial of ["introduction", "features", "shared", "setup", "documentation", "license", "references"]) { -%>
<%- await include(`/partials/${partial}.md`) %>
<% } %>

9
.github/readme/partials/features.md vendored Normal file
View File

@@ -0,0 +1,9 @@
## 🐙 Features
* Create infographics from **<%= Object.entries(plugins).filter(([key, value]) => (value)&&(!["base", "core"].includes(key))).length %> plugins**, **<%= Object.entries(templates).filter(([key, value]) => (value)&&(!["community"].includes(key))).length %> templates** and **<%= Object.entries(descriptor.inputs).length %> options**!
* Even more **customization** with [community templates](source/templates/community) or by [forking this repository](https://github.com/lowlighter/metrics/network/members) and editing HTML/CSS/EJS
* Support **users** and **organizations** accounts, and even **repositories**!
* Save your metrics as **images** (SVG, PNG or JPG), **markdown**, **PDF** or **JSON**!
* Upload them through commits, pull request and gists, or handle output manually
* Test it live on [metrics.lecoq.io](https://metrics.lecoq.io)!
* Get a quick overview of any user with [✨ metrics insights](https://metrics.lecoq.io/about)

View File

@@ -14,6 +14,7 @@ export default async function metadata({log = true} = {}) {
const __templates = path.join(__metrics, "source/templates")
const __plugins = path.join(__metrics, "source/plugins")
const __package = path.join(__metrics, "package.json")
const __descriptor = path.join(__metrics, "action.yml")
//Init
const logger = log ? console.debug : () => null
@@ -49,8 +50,11 @@ export default async function metadata({log = true} = {}) {
//Packaged metadata
const packaged = JSON.parse(`${await fs.promises.readFile(__package)}`)
//Descriptor metadata
const descriptor = yaml.load(`${await fs.promises.readFile(__descriptor, "utf-8")}`)
//Metadata
return {plugins:Plugins, templates:Templates, packaged}
return {plugins:Plugins, templates:Templates, packaged, descriptor}
}
/**Metadata extractor for templates */