c17c64e4c9
* Align repository URLs with the renamed GitHub repo - Point repository.url at vercel-labs/native in all eight platform packages so npm provenance validation passes (the v0.4.1 publish failed on the first package) - Guard in check-version-sync.js: platform repository.url and homepage must match the main package - Sweep remaining vercel-labs/zero-native links and zero-native.dev domains across docs, templates, and fixtures to the new canonical names * Sync repository and homepage fields in sync-version.js - version:sync now stamps repository and homepage from the main package into each platform package, making the check script's remediation hint accurate
21 lines
604 B
TypeScript
21 lines
604 B
TypeScript
const REPO = "vercel-labs/native";
|
|
const REVALIDATE = 86400;
|
|
|
|
export async function getStarCount(): Promise<string> {
|
|
try {
|
|
const res = await fetch(`https://api.github.com/repos/${REPO}`, {
|
|
headers: { Accept: "application/vnd.github.v3+json" },
|
|
next: { revalidate: REVALIDATE },
|
|
});
|
|
if (!res.ok) return "";
|
|
const data = await res.json();
|
|
const count = data.stargazers_count;
|
|
if (typeof count !== "number") return "";
|
|
if (count >= 1000)
|
|
return `${(count / 1000).toFixed(count >= 10000 ? 0 : 1)}k`;
|
|
return String(count);
|
|
} catch {
|
|
return "";
|
|
}
|
|
}
|