MCPcopy Create free account
hub / github.com/codename-co/stack / getRepoStars

Function getRepoStars

packages/website/src/helpers/repo.ts:1–19  ·  view source on GitHub ↗
(repo: string)

Source from the content-addressed store, hash-verified

1export const getRepoStars = async (repo: string) => {
2 const isGithub = repo.startsWith("https://github.com/");
3 if (!isGithub) {
4 return undefined;
5 }
6
7 const url = new URL(repo);
8 url.hostname = "api.github.com";
9 url.pathname = `/repos${url.pathname}`;
10 console.log(url.toString());
11 try {
12 const data = await (await fetch(url)).json();
13 console.log(data.stargazers_count);
14 return data.stargazers_count;
15 } catch (error) {
16 console.error(error);
17 return undefined;
18 }
19};

Callers

nothing calls this directly

Calls 1

logMethod · 0.80

Tested by

no test coverage detected