diff --git a/README.md b/README.md index 08ac887..3df849b 100644 --- a/README.md +++ b/README.md @@ -31,14 +31,15 @@ GitHub repository information. "id": 313641207, "name": "h3", "repo": "unjs/h3", - "description": "Minimal h(ttp) framework built for high performance and portability ⚡️", + "description": "⚡️ Minimal H(TTP) framework built for high performance and portability ", "createdAt": "2020-11-17T14:15:44Z", - "updatedAt": "2022-11-05T21:38:43Z", - "pushedAt": "2022-11-06T06:48:23Z", - "stars": 1168, - "watchers": 1168, - "forks": 59, - "defaultBranch": "main" + "updatedAt": "2024-11-09T15:43:41Z", + "pushedAt": "2024-11-07T10:48:51Z", + "stars": 3665, + "watchers": 16, + "forks": 218, + "defaultBranch": "main", + "language": "TypeScript" } } ``` @@ -235,11 +236,13 @@ GitHub organization repositories overview. "repo": "unjs/redirect-ssl", "description": "Connect/Express middleware to enforce https using is-https", "createdAt": "2017-07-19T19:04:11Z", - "updatedAt": "2022-09-22T09:47:25Z", - "pushedAt": "2022-04-08T20:29:48Z", - "stars": 93, - "watchers": 93, - "forks": 14 + "updatedAt": "2024-10-18T12:48:35Z", + "pushedAt": "2024-04-29T10:13:46Z", + "stars": 100, + "watchers": 100, + "forks": 15, + "defaultBranch": "main", + "language": "TypeScript" } ] } @@ -300,7 +303,8 @@ Get user repositories. "updatedAt": "2024-01-04T17:20:53Z", "watchers": 51, "forks": 0, - "defaultBranch": "main" + "defaultBranch": "main", + "language": "TypeScript" } ] } diff --git a/routes/orgs/[owner]/repos.ts b/routes/orgs/[owner]/repos.ts index 8fdcf54..49cb5be 100644 --- a/routes/orgs/[owner]/repos.ts +++ b/routes/orgs/[owner]/repos.ts @@ -1,29 +1,30 @@ -import type { GithubRepo } from "~types"; +import type {GithubRepo} from "~types"; export default eventHandler(async (event) => { - // TODO: Do pagination - const rawRepos = await ghFetch( - `orgs/${event.context.params.owner}/repos?per_page=100`, - ); + // TODO: Do pagination + const rawRepos = await ghFetch( + `orgs/${event.context.params.owner}/repos?per_page=100`, + ); - const repos = rawRepos.map( - (rawRepo) => - { - id: rawRepo.id, - name: rawRepo.name, - repo: rawRepo.full_name, - description: rawRepo.description, - createdAt: rawRepo.created_at, - updatedAt: rawRepo.updated_at, - pushedAt: rawRepo.pushed_at, - stars: rawRepo.stargazers_count, - watchers: rawRepo.watchers, - forks: rawRepo.forks, - defaultBranch: rawRepo.default_branch, - }, - ); + const repos = rawRepos.map( + (rawRepo) => + { + id: rawRepo.id, + name: rawRepo.name, + repo: rawRepo.full_name, + description: rawRepo.description, + createdAt: rawRepo.created_at, + updatedAt: rawRepo.updated_at, + pushedAt: rawRepo.pushed_at, + stars: rawRepo.stargazers_count, + watchers: rawRepo.watchers, + forks: rawRepo.forks, + defaultBranch: rawRepo.default_branch, + language: rawRepo.language + }, + ); - return { - repos, - }; + return { + repos, + }; }); diff --git a/routes/repos/[owner]/[repo]/index.ts b/routes/repos/[owner]/[repo]/index.ts index 76a15cf..1f77d2d 100644 --- a/routes/repos/[owner]/[repo]/index.ts +++ b/routes/repos/[owner]/[repo]/index.ts @@ -1,24 +1,25 @@ -import type { GithubRepo } from "~types"; +import type {GithubRepo} from "~types"; export default eventHandler(async (event) => { - const rawRepo = await ghRepo( - `${event.context.params.owner}/${event.context.params.repo}`, - ); - const repo = { - id: rawRepo.id, - name: rawRepo.name, - repo: rawRepo.full_name, - description: rawRepo.description, - createdAt: rawRepo.created_at, - updatedAt: rawRepo.updated_at, - pushedAt: rawRepo.pushed_at, - stars: rawRepo.stargazers_count, - watchers: rawRepo.subscribers_count, - forks: rawRepo.forks, - defaultBranch: rawRepo.default_branch, - }; + const rawRepo = await ghRepo( + `${event.context.params.owner}/${event.context.params.repo}`, + ); + const repo = { + id: rawRepo.id, + name: rawRepo.name, + repo: rawRepo.full_name, + description: rawRepo.description, + createdAt: rawRepo.created_at, + updatedAt: rawRepo.updated_at, + pushedAt: rawRepo.pushed_at, + stars: rawRepo.stargazers_count, + watchers: rawRepo.subscribers_count, + forks: rawRepo.forks, + defaultBranch: rawRepo.default_branch, + language: rawRepo.language + }; - return { - repo, - }; + return { + repo, + }; }); diff --git a/routes/users/[name]/repos.ts b/routes/users/[name]/repos.ts index aa6acd1..813cade 100644 --- a/routes/users/[name]/repos.ts +++ b/routes/users/[name]/repos.ts @@ -1,28 +1,29 @@ -import type { GithubRepo } from "~types"; +import type {GithubRepo} from "~types"; export default eventHandler(async (event) => { - const name = getRouterParam(event, "name"); - // TODO: Do pagination - const rawRepos = await ghFetch(`users/${name}/repos?per_page=100`); + const name = getRouterParam(event, "name"); + // TODO: Do pagination + const rawRepos = await ghFetch(`users/${name}/repos?per_page=100`); - const repos = rawRepos.map( - (rawRepo) => - { - id: rawRepo.id, - name: rawRepo.name, - repo: rawRepo.full_name, - description: rawRepo.description, - createdAt: rawRepo.created_at, - updatedAt: rawRepo.updated_at, - pushedAt: rawRepo.pushed_at, - stars: rawRepo.stargazers_count, - watchers: rawRepo.watchers, - forks: rawRepo.forks, - defaultBranch: rawRepo.default_branch, - }, - ); + const repos = rawRepos.map( + (rawRepo) => + { + id: rawRepo.id, + name: rawRepo.name, + repo: rawRepo.full_name, + description: rawRepo.description, + createdAt: rawRepo.created_at, + updatedAt: rawRepo.updated_at, + pushedAt: rawRepo.pushed_at, + stars: rawRepo.stargazers_count, + watchers: rawRepo.watchers, + forks: rawRepo.forks, + defaultBranch: rawRepo.default_branch, + language: rawRepo.language + }, + ); - return { - repos, - }; + return { + repos, + }; }); diff --git a/types/index.ts b/types/index.ts index 18e2563..5eb9639 100644 --- a/types/index.ts +++ b/types/index.ts @@ -10,6 +10,7 @@ export interface GithubRepo { watchers: number; forks: number; defaultBranch: string; + language: string; } export interface GithubOrg {