From 5a821486ae966cf069b0acab6f7559aae582ff0d Mon Sep 17 00:00:00 2001 From: lowlighter <22963968+lowlighter@users.noreply.github.com> Date: Tue, 2 Mar 2021 10:29:01 +0100 Subject: [PATCH] Update documentation --- .github/index.mjs | 4 ++-- .github/readme/partials/documentation/organizations.md | 4 ++-- .github/readme/partials/introduction.md | 7 +++++++ .github/readme/partials/setup/action.md | 2 +- .github/readme/partials/setup/shared.md | 2 +- .github/readme/partials/setup/web.md | 2 +- source/app/metrics/metadata.mjs | 6 +++++- source/plugins/posts/README.md | 3 +++ source/plugins/tweets/README.md | 3 +++ 9 files changed, 25 insertions(+), 8 deletions(-) diff --git a/.github/index.mjs b/.github/index.mjs index dfd4d420..55383ff4 100644 --- a/.github/index.mjs +++ b/.github/index.mjs @@ -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) diff --git a/.github/readme/partials/documentation/organizations.md b/.github/readme/partials/documentation/organizations.md index 126ff534..a480d02b 100644 --- a/.github/readme/partials/documentation/organizations.md +++ b/.github/readme/partials/documentation/organizations.md @@ -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)
-💬 Metrics for organizations +💬 Metrics for organizations (click to expand) 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.
-💬 Organizations memberships for user accounts +💬 Organizations memberships for user accounts (click to expand) Only public memberships can be displayed by metrics by default. You can manage your membership visibility in the `People` tab of your organization: diff --git a/.github/readme/partials/introduction.md b/.github/readme/partials/introduction.md index 71623b37..93b5d4b0 100644 --- a/.github/readme/partials/introduction.md +++ b/.github/readme/partials/introduction.md @@ -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)) { %> +*⚠️ 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).* +<% } %> + @@ -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! +
For user accounts
diff --git a/.github/readme/partials/setup/action.md b/.github/readme/partials/setup/action.md index 9c2605d7..552647aa 100644 --- a/.github/readme/partials/setup/action.md +++ b/.github/readme/partials/setup/action.md @@ -13,7 +13,7 @@ Assuming your username is `my-github-user`, you can then embed rendered metrics ```
-💬 How to setup? +💬 How to setup? (click to expand) ### 0. Setup your personal repository diff --git a/.github/readme/partials/setup/shared.md b/.github/readme/partials/setup/shared.md index 09308ae8..cde94fc5 100644 --- a/.github/readme/partials/setup/shared.md +++ b/.github/readme/partials/setup/shared.md @@ -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.
-💬 Fair use +💬 Fair use (click to expand) To ensure service availability, shared instance has a few limitations: * Images are cached for 15 minutes diff --git a/.github/readme/partials/setup/web.md b/.github/readme/partials/setup/web.md index 40afeae2..b25f29af 100644 --- a/.github/readme/partials/setup/web.md +++ b/.github/readme/partials/setup/web.md @@ -11,7 +11,7 @@ Assuming your username is `my-github-user`, you can then embed rendered metrics ```
-💬 How to setup? +💬 How to setup? (click to expand) ### 0. Prepare your server diff --git a/source/app/metrics/metadata.mjs b/source/app/metrics/metadata.mjs index 72fa5f8c..5408c767 100644 --- a/source/app/metrics/metadata.mjs +++ b/source/app/metrics/metadata.mjs @@ -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 */ diff --git a/source/plugins/posts/README.md b/source/plugins/posts/README.md index e63ea6eb..3eacee9d 100644 --- a/source/plugins/posts/README.md +++ b/source/plugins/posts/README.md @@ -5,6 +5,9 @@ The recent *posts* plugin displays recent articles you wrote on an external sour
+
With posts descriptions and cover images version + +
diff --git a/source/plugins/tweets/README.md b/source/plugins/tweets/README.md index c20734c9..fd794bf6 100644 --- a/source/plugins/tweets/README.md +++ b/source/plugins/tweets/README.md @@ -5,6 +5,9 @@ The recent *tweets* plugin displays your latest tweets from your [Twitter](https
+
With tweets attachments version + +