@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 22 lines 964 Bytes
Raw
1 // Runs at build time, so each deploy picks up the current count.
2 async function fetchGithubStars(): Promise<string> {
3 const token = process.env.GITHUB_TOKEN;
4 try {
5 const response = await fetch("https://api.github.com/repos/pingdotgg/t3code", {
6 headers: token ? { Authorization: `Bearer ${token}` } : {},
7 });
8 if (!response.ok) throw new Error(`GitHub API responded ${response.status}`);
9 const { stargazers_count: stars } = (await response.json()) as { stargazers_count: number };
10 return stars < 1000 ? String(stars) : `${Math.floor(stars / 1000)}k+`;
11 } catch (error) {
12 // A deploy must not ship a made-up count; offline dev should still render.
13 if (import.meta.env.PROD) throw new Error("Could not fetch GitHub stars", { cause: error });
14 console.warn("Could not fetch GitHub stars", error);
15 return "?";
16 }
17 }
18
19 export const MARKETING_STATS = {
20 githubStars: await fetchGithubStars(),
21 users: "500,000",
22 } as const;