import { Octokit } from '@octokit/rest' ; import { numberFormatter } from './number-formatter' ; const octokit = new Octokit ( { auth : process . env . GITHUB_TOKEN } ) ; export async function getGithubStars ( ) { let count ; try { const repo = await octokit . repos . get ( { owner : 'chakra-ui' , repo : 'chakra-ui' , } ) ; count = repo . data . stargazers_count ; } catch ( error ) { console . log ( error . toString ( ) ) ; count = 19700 ; } return { count , prettyCount : numberFormatter . format ( count ) , } ; }