Skip to content

Commit

Permalink
Merge pull request #12 from cletqui/dev
Browse files Browse the repository at this point in the history
v0.8.1
  • Loading branch information
cletqui committed Jul 16, 2024
2 parents 7189764 + 2e3a699 commit 7bf526c
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 67 deletions.
72 changes: 38 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "petithub",
"version": "0.8.0",
"version": "0.8.1",
"private": false,
"description": "PetitHub - Explore obscure GitHub repositories",
"author": {
Expand Down Expand Up @@ -30,16 +30,16 @@
"deploy": "$npm_execpath run build && wrangler pages deploy"
},
"dependencies": {
"@hono/swagger-ui": "^0.3.0",
"@hono/swagger-ui": "^0.4.0",
"@hono/zod-openapi": "^0.14.9",
"hono": "^4.4.13",
"hono": "^4.5.0",
"octokit": "^4.0.2"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20240712.0",
"@hono/vite-cloudflare-pages": "^0.4.2",
"@hono/vite-dev-server": "^0.12.2",
"vite": "^5.3.3",
"@hono/vite-dev-server": "^0.13.1",
"vite": "^5.3.4",
"vitest": "^2.0.3",
"wrangler": "^3.64.0"
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/repository.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const Repository = async ({
>;
}) => {
return (
<Suspense fallback={<div>{"prout"}</div>}>
<Suspense fallback={<div>{"error"}</div>}>
<Container repository={await repository} />
</Suspense>
);
Expand Down Expand Up @@ -200,7 +200,7 @@ const Container = ({
{description && <p>{description}</p>}
{topics && topics?.length > 0 && (
<div>
{topics.map((topic: any) => (
{topics.map((topic: string) => (
<a
class="topic"
target="_blank"
Expand Down
4 changes: 2 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ app.get(
);

/* DEFAULT */
/* app.get(
app.get(
"*",
(c: Context<{ Bindings: Bindings; Variables: Variables }>): Response => {
return c.redirect("/", 301);
}
); */
);

export default app;
55 changes: 31 additions & 24 deletions src/routes/api.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Context } from "hono";
import { poweredBy } from "hono/powered-by";
import { prettyJSON } from "hono/pretty-json";
import { trimTrailingSlash } from 'hono/trailing-slash'
import { cors } from "hono/cors";
import { createRoute, OpenAPIHono } from "@hono/zod-openapi";
import { swaggerUI } from "@hono/swagger-ui";
Expand All @@ -18,6 +19,7 @@ const app = new OpenAPIHono<{ Bindings: Bindings; Variables: Variables }>();
/* MIDDLEWARES */
app.use(poweredBy());
app.use(prettyJSON());
app.use(trimTrailingSlash())
app.use(cors({ origin: "*", allowMethods: ["GET"], credentials: true }));
app.use(handleMaxId);
app.use(handleTokens);
Expand All @@ -31,31 +33,36 @@ app.openAPIRegistry.registerComponent("securitySchemes", "Bearer", {

/* SWAGGER */
app.get("/swagger", swaggerUI({ url: `/api/swagger.json`, version: "3.1" }));
app.doc31("/swagger.json", (c) => {
return {
openapi: "3.1.0",
info: {
title: "API",
version: version,
description: "PetitHub - [GitHub](https://github.com/cletqui/petithub)",
contact: {
name: "cletqui",
url: "https://github.com/cletqui/petithub/issues",
},
license: {
name: "MIT",
url: "https://opensource.org/license/MIT",
},
},
servers: [{ url: `${new URL(c.req.url).origin}/api`, description: "API" }],
tags: [
{
name: "API",
description: "Default API",
app.doc31(
"/swagger.json",
(c: Context<{ Bindings: Bindings; Variables: Variables }>) => {
return {
openapi: "3.1.0",
info: {
title: "API",
version: version,
description: "PetitHub - [GitHub](https://github.com/cletqui/petithub)",
contact: {
name: "cletqui",
url: "https://github.com/cletqui/petithub/issues",
},
license: {
name: "MIT",
url: "https://opensource.org/license/MIT",
},
},
],
};
});
servers: [
{ url: `${new URL(c.req.url).origin}/api`, description: "API" },
],
tags: [
{
name: "API",
description: "Default API",
},
],
};
}
);

/* ROUTES */
const route = createRoute({
Expand Down

0 comments on commit 7bf526c

Please sign in to comment.