From 08c08e78e3f6ac09a872b38662a3c2a7da4fd117 Mon Sep 17 00:00:00 2001 From: nyagami Date: Mon, 18 Mar 2024 23:38:18 +0700 Subject: [PATCH] Count plugins (#839) * add plugins counting to README * add total.svg to dist branch * test * change to LNReader --- README.md | 3 ++- host.ps1 | 2 +- host.sh | 2 +- scripts/json_plugins.ts | 9 +++++++++ 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c67a3da..a55c782 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ # LNReader Plugins

-GitHub issues by-label +LNReader plugins counting +GitHub issues by-label GitHub issues by-label

diff --git a/host.ps1 b/host.ps1 index 93b8e31..62ea012 100644 --- a/host.ps1 +++ b/host.ps1 @@ -20,7 +20,7 @@ rm -r -fo .js npm run clearMultisrc npm run generate npm run json -git add -f icons .dist .js/plugins +git add -f icons .dist .js/plugins total.svg git commit -m "Host plugins" git push -f origin $dist diff --git a/host.sh b/host.sh index 67c85cc..7a4d0ab 100755 --- a/host.sh +++ b/host.sh @@ -20,7 +20,7 @@ rm -rf .js npm run clearMultisrc npm run generate npm run json -git add -f icons .dist .js/plugins +git add -f icons .dist .js/plugins total.svg git commit -m "Host plugins" git push -f origin $dist diff --git a/scripts/json_plugins.ts b/scripts/json_plugins.ts index c6df734..39d22e8 100644 --- a/scripts/json_plugins.ts +++ b/scripts/json_plugins.ts @@ -46,6 +46,7 @@ if (!fs.existsSync(path.join(outRoot, ".dist"))) { const jsonPath = path.join(outRoot, ".dist", "plugins.json"); const jsonMinPath = path.join(outRoot, ".dist", "plugins.min.json"); const pluginSet = new Set(); +let totalPlugins = 0; for (let language in languages) { // language with English name @@ -80,6 +81,7 @@ for (let language in languages) { pluginSet.add(id); } json[language].push(info); + totalPlugins += 1; console.log(name, "✅"); }); } @@ -88,6 +90,13 @@ for (let lang in json) json[lang].sort((a, b) => a.id.localeCompare(b.id)); fs.writeFileSync(jsonMinPath, JSON.stringify(json)); fs.writeFileSync(jsonPath, JSON.stringify(json, null, "\t")); +if(CURRENT_BRANCH === 'dist'){ + fetch(`https://img.shields.io/badge/Plugins-${totalPlugins}-blue`) + .then(res => res.text()) + .then(data => { + fs.writeFileSync('total.svg', data, {encoding: 'utf-8'}); + }) +} // check for broken plugins for (let language in languages) {