From 6dc82808873a8f3f0c42cc2cfb78054a62607d18 Mon Sep 17 00:00:00 2001 From: Stavros Date: Mon, 22 Jan 2024 16:25:48 +0200 Subject: [PATCH] =?UTF-8?q?feat(readme-generator):=20move=20the=20readme?= =?UTF-8?q?=20file=20outside=20of=20the=20script=20an=E2=80=A6=20(#2271)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(readme-generator): move the readme file outside of the script and ignore deprecated apps * refactor(readme-generator): create a readme template --- .github/scripts/readme-generator.ts | 68 ++++++++++++++++++++++++ README.md | 18 +++---- readme-generator.ts | 81 ----------------------------- templates/README.md | 15 ++++++ 4 files changed, 91 insertions(+), 91 deletions(-) create mode 100644 .github/scripts/readme-generator.ts delete mode 100644 readme-generator.ts create mode 100644 templates/README.md diff --git a/.github/scripts/readme-generator.ts b/.github/scripts/readme-generator.ts new file mode 100644 index 00000000..df5ee562 --- /dev/null +++ b/.github/scripts/readme-generator.ts @@ -0,0 +1,68 @@ +import fs from "fs"; + +type App = { + name: string; + description: string; + link: string; +}; + +const getAppsList = async () => { + const apps: Record = {}; + // fetch apps from app store repo + const res = await fetch( + "https://api.github.com/repos/runtipi/runtipi-appstore/contents/apps" + ); + + const data = await res.json(); + const appNames = data.map((app) => app.name); + + for (const app of appNames) { + const config = await fetch( + `https://raw.githubusercontent.com/runtipi/runtipi-appstore/master/apps/${app}/config.json` + ); + const appConfig = await config.text(); + try { + const appConfigJson = JSON.parse(appConfig); + + if (!appConfigJson.deprecated) { + apps[app] = { + name: appConfigJson.name, + description: appConfigJson.short_desc, + link: appConfigJson.source, + }; + } + } catch (e) { + console.error(`Error parsing config for ${app}`); + } + } + + return { apps }; +}; + +const appToReadme = async (app) => { + return `- [${app.name}](${app.link}) - ${app.description}`; +}; + +const writeToReadme = (appsList) => { + const baseReadme = fs.readFileSync( + __dirname + "/../../templates/README.md", + "utf8" + ); + const finalReadme = baseReadme.replace("", appsList); + fs.writeFileSync(__dirname + "/../../README.md", finalReadme); +}; + +const main = async () => { + const apps = await getAppsList(); + const appKeys = Object.keys(apps["apps"]); + let appsList = ""; + + for (let i = 0; i < appKeys.length; i++) { + const appFinal = await appToReadme(apps["apps"][appKeys[i]]); + appsList += i == 0 ? appFinal : "\n" + appFinal; + } + + writeToReadme(appsList); +}; + +main(); diff --git a/README.md b/README.md index b933b622..c4c88d85 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # Tipi App Store ⛺️ -This is the official repository for the Tipi App Store. It contains all the apps that are available for download on [Tipi](https://github.com/meienberger/runtipi). - +This is the official repository for the Tipi App Store. It contains all the apps that are available for download on [Tipi](https://github.com/runtipi/runtipi). + ## Apps available - + - [2FAuth](https://github.com/Bubka/2FAuth) - Manage your Two-Factor Authentication codes. - [Activepieces](https://github.com/activepieces/activepieces) - True zapier alternative. - [Actual Budget](https://github.com/actualbudget/actual-server) - Local-first OpenSource Budget tool @@ -103,7 +103,6 @@ This is the official repository for the Tipi App Store. It contains all the apps - [Mastodon](https://github.com/mastodon/mastodon) - Your self-hosted, globally interconnected microblogging community - [Conduit](https://gitlab.com/famedly/conduit) - Conduit is a simple, fast and reliable chat server written in Rust - [Mealie](https://github.com/hay-kot/mealie) - Mealie is a self-hosted recipe manager and meal planner. -- [Mealie v0.5.6](https://github.com/hay-kot/mealie) - Mealie is a self-hosted recipe manager and meal planner. - [Memos](https://github.com/usememos/memos) - Memo hub for knowledge management and collaboration. - [MeTube](https://github.com/alexta69/metube) - youtube-dl web UI - [Mind](https://github.com/Casvt/MIND) - A simple self hosted reminder platform that uses push to send notifications to your device. @@ -183,7 +182,6 @@ This is the official repository for the Tipi App Store. It contains all the apps - [Tandoor](https://github.com/TandoorRecipes/recipes) - Recipe collection manager. - [Tasks.md](https://github.com/BaldissaraMatheus/Tasks.md) - A self-hosted, file based task management board. - [Tautulli](https://github.com/Tautulli/Tautulli) - Monitoring and tracking tool for Plex Media Server. -- [teddit](https://codeberg.org/teddit/teddit) - Alternative Reddit front-end focused on privacy https://teddit.net - [Tooljet](https://github.com/ToolJet/ToolJet) - Alternative to retool to construct CRM dashboard - [Traefik Certs Dumper](https://github.com/kereis/traefik-certs-dumper) - Dumps Let's Encrypt certificates of a specified domain which Traefik stores in acme.json. - [Transmission (VPN)](https://github.com/haugene/docker-transmission-openvpn) - BitTorrent client with VPN support. @@ -206,11 +204,11 @@ This is the official repository for the Tipi App Store. It contains all the apps - [Your Spotify](https://github.com/Yooooomi/your_spotify) - Self hosted Spotify tracking dashboard. - [ZeroTier](https://github.com/zerotier/ZeroTierOne) - Easy to use zero configuration VPN. - [Zipline](https://github.com/diced/zipline) - A ShareX/file upload server that is easy to use, packed with features, and with an easy setup! - + ## How to sumbit an app - + If you want to see new apps on Tipi you can either: - -- [Open an issue](https://github.com/meienberger/runtipi-appstore/issues) on this repository and members of the community will add it + +- [Create a discussion](https://github.com/runtipi/runtipi-appstore/discussions) on this repository and members of the community will add it - [Join the Discord](https://discord.gg/Bu9qEPnHsc) members of the community will add it. -- Fork this repo and create the necessary files for a Tipi app. Follow this [guide](<[https://github.com/meienberger/runtipi/wiki/Adding-your-own-app](https://www.runtipi.io/docs/contributing/adding-a-new-app)>) \ No newline at end of file +- Fork this repo and create the necessary files for a Tipi app. Follow this [guide](https://www.runtipi.io/docs/contributing/adding-a-new-app)` diff --git a/readme-generator.ts b/readme-generator.ts deleted file mode 100644 index 2ca46e37..00000000 --- a/readme-generator.ts +++ /dev/null @@ -1,81 +0,0 @@ -import fs from "fs"; - -type App = { - name: string; - description: string; - link: string; -}; - -const getAppsList = async () => { - const apps: Record = {}; - // fetch apps from app store repo - const res = await fetch( - "https://api.github.com/repos/runtipi/runtipi-appstore/contents/apps" - ); - - const data = await res.json(); - const appNames = data.map((app) => app.name); - - for (const app of appNames) { - const config = await fetch( - `https://raw.githubusercontent.com/runtipi/runtipi-appstore/master/apps/${app}/config.json` - ); - const appConfig = await config.text(); - try { - const appConfigJson = JSON.parse(appConfig); - - apps[app] = { - name: appConfigJson.name, - description: appConfigJson.short_desc, - link: appConfigJson.source, - }; - } catch (e) { - console.error(`Error parsing config for ${app}`); - } - } - - return { apps }; -}; - -const appToReadme = async (app) => { - return `- [${app.name}](${app.link}) - ${app.description}`; -}; - -const writeToReadme = async (appsList) => { - let finalReadme = `# Tipi App Store ⛺️ - -This is the official repository for the Tipi App Store. It contains all the apps that are available for download on [Tipi](https://github.com/meienberger/runtipi). - -## Apps available - -${appsList} - -## How to sumbit an app - -If you want to see new apps on Tipi you can either: - -- [Open an issue](https://github.com/meienberger/runtipi-appstore/issues) on this repository and members of the community will add it -- [Join the Discord](https://discord.gg/Bu9qEPnHsc) members of the community will add it. -- Fork this repo and create the necessary files for a Tipi app. Follow this [guide](<[https://github.com/meienberger/runtipi/wiki/Adding-your-own-app](https://www.runtipi.io/docs/contributing/adding-a-new-app)>)`; - - await fs.writeFileSync("README.md", finalReadme); -}; - -const main = async () => { - const apps = await getAppsList(); - const appKeys = Object.keys(apps["apps"]); - let appsList: string = ""; - - for (let i = 0; i < appKeys.length; i++) { - const appFinal = await appToReadme(apps["apps"][appKeys[i]]); - if (i == 0) { - appsList = appsList + appFinal; - } else { - appsList = appsList + "\n" + appFinal; - } - } - - await writeToReadme(appsList); -}; - -main(); diff --git a/templates/README.md b/templates/README.md new file mode 100644 index 00000000..12e55ff8 --- /dev/null +++ b/templates/README.md @@ -0,0 +1,15 @@ +# Tipi App Store ⛺️ + +This is the official repository for the Tipi App Store. It contains all the apps that are available for download on [Tipi](https://github.com/runtipi/runtipi). + +## Apps available + + + +## How to sumbit an app + +If you want to see new apps on Tipi you can either: + +- [Create a discussion](https://github.com/runtipi/runtipi-appstore/discussions) on this repository and members of the community will add it +- [Join the Discord](https://discord.gg/Bu9qEPnHsc) members of the community will add it. +- Fork this repo and create the necessary files for a Tipi app. Follow this [guide](https://www.runtipi.io/docs/contributing/adding-a-new-app)`