1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-08-19 07:31:24 +02:00

Refactor github stats

This commit is contained in:
Kamran Ahmed
2024-08-19 12:36:28 +01:00
parent bcc456d3d0
commit c6a4bff63e
3 changed files with 13 additions and 21 deletions

View File

@@ -6,7 +6,6 @@ import satori from 'satori';
import sharp from 'sharp';
import imageSize from 'image-size';
import { Resvg } from '@resvg/resvg-js';
import { getRepositoryRank } from '../src/lib/github';
const ALL_ROADMAP_DIR = path.join(process.cwd(), '/src/data/roadmaps');
const ALL_BEST_PRACTICE_DIR = path.join(
@@ -29,11 +28,6 @@ const alreadyGeneratedImages = await fs.readdir(
},
);
async function updateRank() {
const repoRank = await getRepositoryRank('kamranahmedse/developer-roadmap');
document.getElementById('repo-rank').innerText = `${repoRank} most starred GitHub project`;
}
async function getAllRoadmaps() {
const allRoadmapDirNames = await fs.readdir(ALL_ROADMAP_DIR);
@@ -148,8 +142,6 @@ async function getAllBestPracticeImageIds() {
}
async function generateResourceOpenGraph() {
await updateRank();
const allRoadmaps = (await getAllRoadmaps()).filter(
(roadmap) => !alreadyGeneratedImages.includes(`roadmaps/${roadmap.id}.png`),
);
@@ -379,8 +371,8 @@ function getRoadmapDefaultTemplate({ title, description }) {
/>
</svg>
</div>
<div tw="text-[30px] flex leading-[30px]" id="repo-rank">
Loading...
<div tw="text-[30px] flex leading-[30px]">
7th most starred GitHub project
</div>
</div>
<div tw="flex items-center mt-2.5">