--- import Layout from "@layouts/Layout.astro"; import Navbar from "@components/widgets/Navbar.astro"; import Container from "@components/atoms/Container.astro"; import { PROJECTS } from "~/config"; import Button from "~/components/widgets/Button.astro"; for (const project of PROJECTS) { try { const rawRepository = await fetch( `https://api.github.com/repos/${project.link.slice(19)}`, { headers: { Authorization: `Bearer ${import.meta.env.GITHUB_ACCESS_TOKEN}`, }, } ).catch(console.log); if (!rawRepository) { project.stats = { forks: 0, stars: 0, }; continue; } const repository = await rawRepository.json(); project.stats = { forks: repository.forks, stars: repository.stargazers_count, }; } catch (e) { console.log(e); } } PROJECTS.sort((a, b) => a.name.localeCompare(b.name)); --- ({ "@type": "ListItem", position: i + 1, name: project.name, url: project.link, })), }} >

Projects

{ PROJECTS.map((project) => (

{project.name}

{project.stats!.stars}

{" "}

{project.stats!.forks}

{project.desc}

)) }