Skip to content

Commit

Permalink
refactor: Update hosting references from Cloudflare to Vercel and upg…
Browse files Browse the repository at this point in the history
…rade dependencies
  • Loading branch information
SivaramPg committed Dec 16, 2024
1 parent ecfa1a9 commit ef1d963
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 103 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# [SWAPI.INFO](https://swapi.info)

SWAPI.INFO is an Open Source no-server, file-based simple GET API provider & endpoint data explorer. Built using the latest Next.js App Router & hosted via Cloudflare Pages to utilize Cloudflares awesome & highly available CDN network to provide wicked-fast API resolution and page exploration experience. The architecture allows the provider to be highly resilient against DDoS attacks and network traffic surges.
SWAPI.INFO is an Open Source no-server, file-based simple GET API provider & endpoint data explorer. Built using the latest Next.js App Router & hosted via Vercel's awesome & highly available CDN network to provide wicked-fast API resolution and page exploration experience. The architecture allows the provider to be highly resilient against DDoS attacks and network traffic surges.

<!-- ![SWAPI.INFO](https://swapi.info/opengraph-image.png) -->

Expand Down
Binary file modified bun.lockb
Binary file not shown.
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@
},
"dependencies": {
"clsx": "^2.1.1",
"next": "14.2.10",
"next": "15.1.0",
"next-sitemap": "^4.2.3",
"next-themes": "^0.3.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"tailwind-merge": "^2.5.2",
"next-themes": "^0.4.4",
"react": "19.0.0",
"react-dom": "19.0.0",
"tailwind-merge": "^2.5.5",
"use-clipboard-copy": "^0.2.0",
"zod": "^3.23.8"
"zod": "^3.24.1"
},
"devDependencies": {
"@biomejs/biome": "^1.9.0",
"@types/bun": "^1.1.9",
"@types/node": "22.5.4",
"@types/react": "18.3.5",
"@types/react-dom": "18.3.0",
"@biomejs/biome": "^1.9.4",
"@types/bun": "^1.1.14",
"@types/node": "22.10.2",
"@types/react": "19.0.1",
"@types/react-dom": "19.0.2",
"autoprefixer": "10.4.20",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"postcss": "8.4.45",
"shiki": "^1.17.0",
"tailwindcss": "3.4.11",
"typescript": "5.6.2"
"husky": "^9.1.7",
"lint-staged": "^15.2.11",
"postcss": "8.4.49",
"shiki": "^1.24.2",
"tailwindcss": "3.4.16",
"typescript": "5.7.2"
},
"lint-staged": {
"*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [
Expand Down
7 changes: 0 additions & 7 deletions public/icons/cloudflare.svg

This file was deleted.

27 changes: 0 additions & 27 deletions scripts/generate-redirects-file.ts

This file was deleted.

3 changes: 0 additions & 3 deletions scripts/set-domain-in-json-files.ts

This file was deleted.

17 changes: 8 additions & 9 deletions src/app/[category]/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,32 +53,31 @@ function getFlattenedDetails(json: Record<string, string>) {
export async function generateMetadata({
params,
}: {
params: { category: string; slug: string }
params: Promise<{ category: string; slug: string }>
}) {
const json = await getCategorySlugJson(params.category, params.slug)
const { category, slug } = await params

const json = await getCategorySlugJson(category, slug)
return {
title:
`${json?.title || json?.name} | ` + `${params.category}/${params.slug}`,
title: `${json?.title || json?.name} | ` + `${category}/${slug}`,
description: `${
json?.opening_crawl?.replaceAll("\r\n", " ") ||
getFlattenedDetails(json) ||
metadata.description
}`,
alternates: {
canonical: `https://swapi.info/${params.category}/${params.slug}`,
canonical: `https://swapi.info/${category}/${slug}`,
},
openGraph: {
title:
`${json.title || json.name} | ` + `${params.category}/${params.slug}`,
title: `${json.title || json.name} | ` + `${category}/${slug}`,
description: `${
json?.opening_crawl?.replaceAll("\r\n", " ") ||
getFlattenedDetails(json) ||
metadata.description
}`,
},
twitter: {
title:
`${json.title || json.name} | ` + `${params.category}/${params.slug}`,
title: `${json.title || json.name} | ` + `${category}/${slug}`,
description: `${
json?.opening_crawl?.replaceAll("\r\n", " ") ||
getFlattenedDetails(json) ||
Expand Down
6 changes: 3 additions & 3 deletions src/app/_components/AboutTheProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export function AboutTheProject({ className }: AboutTheProjectProps) {
static files, this service does not require database or expensive
hosting to run. <br />
<br />
Currently hosted on the generosity of Cloudflare Pages, the only
barrier to utilization is a public facing domain. No other costs
associated with running this project yourself as well.
Currently hosted on the generosity of Vercl, the only barrier to
utilization is a public facing domain. No other costs associated with
running this project yourself as well.
<br />
<br />
{/* Created as a self-owned alternative to keep my older projects alive,
Expand Down
37 changes: 2 additions & 35 deletions src/app/_components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import SpriteIcon, { Icons } from "@/components/SpriteIcon"
import Image from "next/image"

export default function Footer() {
return (
<div className="w-full pt-8 pb-4 border-t">
<footer className="container flex flex-col items-center justify-around w-full gap-4 px-4 mx-auto h-fit">
<div className="flex flex-wrap items-center justify-between w-full gap-4 md:gap-8">
<div>
<p className="inline-flex items-center gap-1 text-lg font-medium whitespace-nowrap">
<p className="inline-flex items-center gap-1 font-medium whitespace-nowrap">
Made with
<SpriteIcon
id={Icons.heart}
Expand All @@ -32,7 +31,7 @@ export default function Footer() {
</div>

<div className="flex flex-wrap items-center justify-between w-full gap-8">
<p className="inline-flex items-center gap-2 text-sm sm:text-base md:text-lg font-medium whitespace-nowrap">
<p className="inline-flex items-center gap-2 text-sm sm:text-base font-medium whitespace-nowrap">
Credits:{" "}
<a
className="underline underline-offset-4"
Expand All @@ -52,38 +51,6 @@ export default function Footer() {
Juriy Bura
</a>
</p>

<p className="flex items-center gap-2 font-medium whitespace-nowrap">
Powered by:
<a
href="https://nextjs.org/"
target="_blank"
rel="noopener noreferrer"
>
<Image
priority
src="/icons/nextjs.svg"
alt="Nextjs"
width={48}
height={48}
className="hover:drop-shadow-md"
/>
</a>
<a
href="https://cloudflare.com"
target="_blank"
rel="noopener noreferrer"
>
<Image
priority
src="/icons/cloudflare.svg"
alt="Cloudflare"
width={64}
height={64}
className="hover:drop-shadow-md"
/>
</a>
</p>
</div>
</footer>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const metadata: Metadata = {
"swapi",
"sw-api",
"nextjs 13",
"cloudflare",
"vercel",
"swapi.dev alternative",
"swapi.co alternative",
"alternative",
Expand Down
44 changes: 44 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"trailingSlash": false,
"rewrites": [
{ "source": "/api", "destination": "/api/root.json" },

{ "source": "/api/people", "destination": "/api/people.json" },
{ "source": "/api/people/:id", "destination": "/api/people/:id.json" },
{ "source": "/api/planets", "destination": "/api/planets.json" },
{ "source": "/api/planets/:id", "destination": "/api/planets/:id.json" },
{ "source": "/api/films", "destination": "/api/films.json" },
{ "source": "/api/films/:id", "destination": "/api/films/:id.json" },
{ "source": "/api/species", "destination": "/api/species.json" },
{ "source": "/api/species/:id", "destination": "/api/species/:id.json" },
{ "source": "/api/vehicles", "destination": "/api/vehicles.json" },
{ "source": "/api/vehicles/:id", "destination": "/api/vehicles/:id.json" },
{ "source": "/api/starships", "destination": "/api/starships.json" },
{
"source": "/api/starships/:id",
"destination": "/api/starships/:id.json"
},

{
"source": "/api/people/schema",
"destination": "/api/people/schema.json"
},
{
"source": "/api/planets/schema",
"destination": "/api/planets/schema.json"
},
{ "source": "/api/films/schema", "destination": "/api/films/schema.json" },
{
"source": "/api/species/schema",
"destination": "/api/species/schema.json"
},
{
"source": "/api/vehicles/schema",
"destination": "/api/vehicles/schema.json"
},
{
"source": "/api/starships/schema",
"destination": "/api/starships/schema.json"
}
]
}

0 comments on commit ef1d963

Please sign in to comment.