feat(readme-generator): move the readme file outside of the script an… (#2271)

* feat(readme-generator): move the readme file outside of the script and ignore deprecated apps

* refactor(readme-generator): create a readme template
This commit is contained in:
Stavros 2024-01-22 16:25:48 +02:00 committed by GitHub
parent d350914d45
commit 6dc8280887
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 91 additions and 91 deletions

68
.github/scripts/readme-generator.ts vendored Normal file
View File

@ -0,0 +1,68 @@
import fs from "fs";
type App = {
name: string;
description: string;
link: string;
};
const getAppsList = async () => {
const apps: Record<string, App> = {};
// 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>", 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();

View File

@ -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)>)
- 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)`

View File

@ -1,81 +0,0 @@
import fs from "fs";
type App = {
name: string;
description: string;
link: string;
};
const getAppsList = async () => {
const apps: Record<string, App> = {};
// 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();

15
templates/README.md Normal file
View File

@ -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
<!appsList>
## 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)`