1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2026-06-05 19:15:30 -04:00

refactor: remove @t3-oss/env-nextjs, use process.env directly

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-19 14:12:42 -05:00
parent c30197ccc5
commit 6f86fd1ca9
28 changed files with 91 additions and 287 deletions
+3 -3
View File
@@ -2,7 +2,7 @@ import { JsonLd } from "react-schemaorg";
import type { VideoObject } from "schema-dts";
import { PageTitle } from "@/components/layout/page-title";
import { Video } from "@/components/video";
import { env } from "@/lib/env";
import { createMetadata } from "@/lib/metadata";
import thumbnail from "./thumbnail.png";
@@ -31,8 +31,8 @@ const Page = () => (
description: metadata.description as string,
contentUrl:
"https://ijyxfbpcm3itvdly.public.blob.vercel-storage.com/birthday-pavk1LBK4H6xF8ZWeR0oTcaabGuQ8T.webm",
thumbnailUrl: `${env.NEXT_PUBLIC_BASE_URL}${thumbnail.src}`,
embedUrl: `${env.NEXT_PUBLIC_BASE_URL}/birthday`,
thumbnailUrl: `${process.env.NEXT_PUBLIC_BASE_URL}${thumbnail.src}`,
embedUrl: `${process.env.NEXT_PUBLIC_BASE_URL}/birthday`,
uploadDate: "1996-02-06T00:00:00Z",
duration: "PT6M10S",
}}
+3 -3
View File
@@ -2,7 +2,7 @@ import { JsonLd } from "react-schemaorg";
import type { VideoObject } from "schema-dts";
import { PageTitle } from "@/components/layout/page-title";
import { Video } from "@/components/video";
import { env } from "@/lib/env";
import { createMetadata } from "@/lib/metadata";
import thumbnail from "./thumbnail.png";
@@ -32,8 +32,8 @@ const Page = () => (
description: metadata.description as string,
contentUrl:
"https://ijyxfbpcm3itvdly.public.blob.vercel-storage.com/convention-ZTUBLwMcmOE8EJ4tNAhpCli4NAHKcG.webm",
thumbnailUrl: `${env.NEXT_PUBLIC_BASE_URL}${thumbnail.src}`,
embedUrl: `${env.NEXT_PUBLIC_BASE_URL}/hillary`,
thumbnailUrl: `${process.env.NEXT_PUBLIC_BASE_URL}${thumbnail.src}`,
embedUrl: `${process.env.NEXT_PUBLIC_BASE_URL}/hillary`,
uploadDate: "2016-07-25T00:00:00Z",
duration: "PT1M51S",
}}
+11 -9
View File
@@ -8,7 +8,7 @@ import { Providers } from "@/components/providers";
import { Toaster } from "@/components/ui/sonner";
import authorConfig from "@/lib/config/author";
import siteConfig from "@/lib/config/site";
import { env } from "@/lib/env";
import { Inter, JetBrainsMono } from "@/lib/fonts";
import { defaultMetadata } from "@/lib/metadata";
@@ -18,7 +18,7 @@ export const metadata = defaultMetadata;
const RootLayout = ({ children }: Readonly<{ children: React.ReactNode }>) => (
<html
lang={env.NEXT_PUBLIC_SITE_LOCALE}
lang={process.env.NEXT_PUBLIC_SITE_LOCALE}
className={`${Inter.variable} ${JetBrainsMono.variable}`}
suppressHydrationWarning
>
@@ -27,12 +27,14 @@ const RootLayout = ({ children }: Readonly<{ children: React.ReactNode }>) => (
item={{
"@context": "https://schema.org",
"@type": "Person",
"@id": `${env.NEXT_PUBLIC_BASE_URL}/#person`,
"@id": `${process.env.NEXT_PUBLIC_BASE_URL}/#person`,
name: authorConfig.name,
url: env.NEXT_PUBLIC_BASE_URL,
image: [`${env.NEXT_PUBLIC_BASE_URL}/opengraph-image.jpg`],
// biome-ignore lint/style/noNonNullAssertion: expected to be set in env
url: process.env.NEXT_PUBLIC_BASE_URL!,
image: [`${process.env.NEXT_PUBLIC_BASE_URL}/opengraph-image.jpg`],
sameAs: [
env.NEXT_PUBLIC_BASE_URL,
// biome-ignore lint/style/noNonNullAssertion: expected to be set in env
process.env.NEXT_PUBLIC_BASE_URL!,
`https://${authorConfig.social?.mastodon}`,
`https://github.com/${authorConfig.social?.github}`,
`https://bsky.app/profile/${authorConfig.social?.bluesky}`,
@@ -49,12 +51,12 @@ const RootLayout = ({ children }: Readonly<{ children: React.ReactNode }>) => (
item={{
"@context": "https://schema.org",
"@type": "WebSite",
"@id": `${env.NEXT_PUBLIC_BASE_URL}/#website`,
"@id": `${process.env.NEXT_PUBLIC_BASE_URL}/#website`,
name: siteConfig.name,
url: env.NEXT_PUBLIC_BASE_URL,
url: process.env.NEXT_PUBLIC_BASE_URL,
author: authorConfig.name,
description: siteConfig.description,
inLanguage: env.NEXT_PUBLIC_SITE_LOCALE,
inLanguage: process.env.NEXT_PUBLIC_SITE_LOCALE,
license: `https://spdx.org/licenses/${siteConfig.license}.html`,
}}
/>
+3 -3
View File
@@ -2,7 +2,7 @@ import { JsonLd } from "react-schemaorg";
import type { VideoObject } from "schema-dts";
import { PageTitle } from "@/components/layout/page-title";
import { Video } from "@/components/video";
import { env } from "@/lib/env";
import { createMetadata } from "@/lib/metadata";
import thumbnail from "./thumbnail.png";
@@ -31,8 +31,8 @@ const Page = () => (
description: metadata.description as string,
contentUrl:
"https://ijyxfbpcm3itvdly.public.blob.vercel-storage.com/leo-uoCXHS9gViyRnQhr8CEGXFvj4VGh5Y.webm",
thumbnailUrl: `${env.NEXT_PUBLIC_BASE_URL}${thumbnail.src}`,
embedUrl: `${env.NEXT_PUBLIC_BASE_URL}/leo`,
thumbnailUrl: `${process.env.NEXT_PUBLIC_BASE_URL}${thumbnail.src}`,
embedUrl: `${process.env.NEXT_PUBLIC_BASE_URL}/leo`,
uploadDate: "2007-05-10T00:00:00Z",
duration: "PT1M48S",
}}
+1 -2
View File
@@ -1,6 +1,5 @@
import type { MetadataRoute } from "next";
import siteConfig from "@/lib/config/site";
import { env } from "@/lib/env";
const manifest = (): MetadataRoute.Manifest => {
return {
@@ -8,7 +7,7 @@ const manifest = (): MetadataRoute.Manifest => {
// eslint-disable-next-line camelcase
short_name: siteConfig.name,
description: siteConfig.description,
lang: env.NEXT_PUBLIC_SITE_LOCALE,
lang: process.env.NEXT_PUBLIC_SITE_LOCALE,
icons: [
{
src: "/icon.png",
+2 -2
View File
@@ -3,7 +3,7 @@ import path from "node:path";
import { notFound } from "next/navigation";
import { ImageResponse } from "next/og";
import siteConfig from "@/lib/config/site";
import { env } from "@/lib/env";
import { loadGoogleFont } from "@/lib/og-utils";
import { getFrontMatter, getSlugs, POSTS_DIR } from "@/lib/posts";
@@ -214,7 +214,7 @@ const OpenGraphImage = async ({
}}
>
{new Date(frontmatter.date).toLocaleDateString(
env.NEXT_PUBLIC_SITE_LOCALE,
process.env.NEXT_PUBLIC_SITE_LOCALE,
{
year: "numeric",
month: "long",
+5 -5
View File
@@ -17,7 +17,7 @@ import { CommentsSkeleton } from "@/components/comments/comments-skeleton";
import { ViewCounter } from "@/components/view-counter";
import authorConfig from "@/lib/config/author";
import siteConfig from "@/lib/config/site";
import { env } from "@/lib/env";
import { createMetadata } from "@/lib/metadata";
import { getFrontMatter, getSlugs, POSTS_DIR } from "@/lib/posts";
import { size as ogImageSize } from "./opengraph-image";
@@ -94,18 +94,18 @@ const Page = async ({ params }: { params: Promise<{ slug: string }> }) => {
url: frontmatter?.permalink,
image: {
"@type": "ImageObject",
contentUrl: `${env.NEXT_PUBLIC_BASE_URL}/${POSTS_DIR}/${frontmatter?.slug}/opengraph-image`,
contentUrl: `${process.env.NEXT_PUBLIC_BASE_URL}/${POSTS_DIR}/${frontmatter?.slug}/opengraph-image`,
width: `${ogImageSize.width}`,
height: `${ogImageSize.height}`,
},
keywords: frontmatter?.tags?.join(", "),
datePublished: frontmatter?.date,
dateModified: frontmatter?.date,
inLanguage: env.NEXT_PUBLIC_SITE_LOCALE,
inLanguage: process.env.NEXT_PUBLIC_SITE_LOCALE,
license: `https://spdx.org/licenses/${siteConfig.license}.html`,
author: {
// defined in app/layout.tsx
"@id": `${env.NEXT_PUBLIC_BASE_URL}/#person`,
"@id": `${process.env.NEXT_PUBLIC_BASE_URL}/#person`,
},
}}
/>
@@ -146,7 +146,7 @@ const Page = async ({ params }: { params: Promise<{ slug: string }> }) => {
)}
<Link
href={`https://github.com/${env.NEXT_PUBLIC_GITHUB_REPO}/blob/main/${POSTS_DIR}/${frontmatter?.slug}/index.mdx`}
href={`https://github.com/${process.env.NEXT_PUBLIC_GITHUB_REPO}/blob/main/${POSTS_DIR}/${frontmatter?.slug}/index.mdx`}
title={`Edit "${frontmatter?.title}" on GitHub`}
className={
"flex flex-nowrap items-center gap-1.5 whitespace-nowrap text-foreground/70 hover:no-underline"
+4 -5
View File
@@ -4,7 +4,6 @@ import { graphql } from "@octokit/graphql";
import type { Repository, User } from "@octokit/graphql-schema";
import * as cheerio from "cheerio";
import { cacheLife } from "next/cache";
import { env } from "@/lib/env";
export const getContributions = async (): Promise<
Array<{
@@ -19,10 +18,10 @@ export const getContributions = async (): Promise<
// thanks @grubersjoe! :) https://github.com/grubersjoe/github-contributions-api/blob/main/src/scrape.ts
try {
const response = await fetch(
`https://github.com/users/${env.NEXT_PUBLIC_GITHUB_USERNAME}/contributions`,
`https://github.com/users/${process.env.NEXT_PUBLIC_GITHUB_USERNAME}/contributions`,
{
headers: {
referer: `https://github.com/${env.NEXT_PUBLIC_GITHUB_USERNAME}`,
referer: `https://github.com/${process.env.NEXT_PUBLIC_GITHUB_USERNAME}`,
"x-requested-with": "XMLHttpRequest",
},
},
@@ -116,12 +115,12 @@ export const getRepos = async (): Promise<Repository[] | undefined> => {
}
`,
{
username: env.NEXT_PUBLIC_GITHUB_USERNAME,
username: process.env.NEXT_PUBLIC_GITHUB_USERNAME,
sort: "STARGAZERS",
limit: 12,
headers: {
accept: "application/vnd.github.v3+json",
authorization: `token ${env.GITHUB_TOKEN}`,
authorization: `token ${process.env.GITHUB_TOKEN}`,
},
},
);
+14 -14
View File
@@ -7,21 +7,21 @@ import { PageTitle } from "@/components/layout/page-title";
import { RelativeTime } from "@/components/relative-time";
import { Button } from "@/components/ui/button";
import { Skeleton } from "@/components/ui/skeleton";
import { env } from "@/lib/env";
import { createMetadata } from "@/lib/metadata";
import { cn } from "@/lib/utils";
import { getContributions, getRepos } from "./github";
export const metadata = createMetadata({
title: "Projects",
description: `Most-starred repositories by @${env.NEXT_PUBLIC_GITHUB_USERNAME} on GitHub`,
description: `Most-starred repositories by @${process.env.NEXT_PUBLIC_GITHUB_USERNAME} on GitHub`,
canonical: "/projects",
});
const Page = async () => {
// don't fail the entire site build if the required config for this page is missing, just return a 404 since this page
// would be mostly blank anyways.
if (!env.GITHUB_TOKEN) {
if (!process.env.GITHUB_TOKEN) {
console.error(
"[/projects] I can't fetch anything from GitHub without 'GITHUB_TOKEN' set!",
);
@@ -40,7 +40,7 @@ const Page = async () => {
<h2 className="my-3.5 font-medium text-xl">
<a
href={`https://github.com/${env.NEXT_PUBLIC_GITHUB_USERNAME}`}
href={`https://github.com/${process.env.NEXT_PUBLIC_GITHUB_USERNAME}`}
target="_blank"
rel="noopener noreferrer"
className="text-secondary-foreground hover:no-underline"
@@ -63,7 +63,7 @@ const Page = async () => {
<h2 className="my-3.5 font-medium text-xl">
<a
href={`https://github.com/${env.NEXT_PUBLIC_GITHUB_USERNAME}?tab=repositories&sort=stargazers`}
href={`https://github.com/${process.env.NEXT_PUBLIC_GITHUB_USERNAME}?tab=repositories&sort=stargazers`}
target="_blank"
rel="noopener noreferrer"
className="text-secondary-foreground hover:no-underline"
@@ -113,7 +113,7 @@ const Page = async () => {
{repo?.stargazerCount > 0 && (
<a
href={`${repo?.url}/stargazers`}
title={`${Intl.NumberFormat(env.NEXT_PUBLIC_SITE_LOCALE).format(repo?.stargazerCount)} ${repo?.stargazerCount === 1 ? "star" : "stars"}`}
title={`${Intl.NumberFormat(process.env.NEXT_PUBLIC_SITE_LOCALE).format(repo?.stargazerCount)} ${repo?.stargazerCount === 1 ? "star" : "stars"}`}
target="_blank"
rel="noopener noreferrer"
className="inline-flex flex-nowrap items-center gap-2 text-muted-foreground hover:text-primary hover:no-underline"
@@ -123,9 +123,9 @@ const Page = async () => {
aria-hidden="true"
/>
<span>
{Intl.NumberFormat(env.NEXT_PUBLIC_SITE_LOCALE).format(
repo?.stargazerCount,
)}
{Intl.NumberFormat(
process.env.NEXT_PUBLIC_SITE_LOCALE,
).format(repo?.stargazerCount)}
</span>
</a>
)}
@@ -135,7 +135,7 @@ const Page = async () => {
href={`${repo?.url}/network/members`}
target="_blank"
rel="noopener noreferrer"
title={`${Intl.NumberFormat(env.NEXT_PUBLIC_SITE_LOCALE).format(repo?.forkCount)} ${repo?.forkCount === 1 ? "fork" : "forks"}`}
title={`${Intl.NumberFormat(process.env.NEXT_PUBLIC_SITE_LOCALE).format(repo?.forkCount)} ${repo?.forkCount === 1 ? "fork" : "forks"}`}
className="inline-flex flex-nowrap items-center gap-2 text-muted-foreground hover:text-primary hover:no-underline"
>
<GitForkIcon
@@ -143,9 +143,9 @@ const Page = async () => {
aria-hidden="true"
/>
<span>
{Intl.NumberFormat(env.NEXT_PUBLIC_SITE_LOCALE).format(
repo?.forkCount,
)}
{Intl.NumberFormat(
process.env.NEXT_PUBLIC_SITE_LOCALE,
).format(repo?.forkCount)}
</span>
</a>
)}
@@ -170,7 +170,7 @@ const Page = async () => {
<p className="mt-6 mb-0 text-center font-medium text-base">
<Button variant="secondary" asChild>
<a
href={`https://github.com/${env.NEXT_PUBLIC_GITHUB_USERNAME}?tab=repositories&type=source&sort=stargazers`}
href={`https://github.com/${process.env.NEXT_PUBLIC_GITHUB_USERNAME}?tab=repositories&type=source&sort=stargazers`}
target="_blank"
rel="noopener noreferrer"
>
+1 -2
View File
@@ -1,5 +1,4 @@
import type { MetadataRoute } from "next";
import { env } from "@/lib/env";
const robots = (): MetadataRoute.Robots => ({
rules: [
@@ -8,7 +7,7 @@ const robots = (): MetadataRoute.Robots => ({
disallow: ["/api/", "/404", "/500"],
},
],
sitemap: `${env.NEXT_PUBLIC_BASE_URL}/sitemap.xml`,
sitemap: `${process.env.NEXT_PUBLIC_BASE_URL}/sitemap.xml`,
});
export default robots;
+6 -5
View File
@@ -1,7 +1,7 @@
import path from "node:path";
import glob from "fast-glob";
import type { MetadataRoute } from "next";
import { env } from "@/lib/env";
import { getFrontMatter } from "@/lib/posts";
// routes in /app (in other words, directories containing a page.tsx/mdx file) are automatically included; add a route
@@ -19,12 +19,13 @@ const sitemap = async (): Promise<MetadataRoute.Sitemap> => {
const routes: MetadataRoute.Sitemap = [
{
// homepage
url: env.NEXT_PUBLIC_BASE_URL,
// biome-ignore lint/style/noNonNullAssertion: expected to be set in env
url: process.env.NEXT_PUBLIC_BASE_URL!,
priority: 1.0,
lastModified: new Date(),
},
{ url: `${env.NEXT_PUBLIC_BASE_URL}/tweets` },
{ url: `${env.NEXT_PUBLIC_BASE_URL}/y2k` },
{ url: `${process.env.NEXT_PUBLIC_BASE_URL}/tweets` },
{ url: `${process.env.NEXT_PUBLIC_BASE_URL}/y2k` },
];
const [staticRoutes, frontmatter] = await Promise.all([
@@ -46,7 +47,7 @@ const sitemap = async (): Promise<MetadataRoute.Sitemap> => {
staticRoutes.forEach((route) => {
routes.push({
// remove matching page.(tsx|mdx) file and make all URLs absolute
url: `${env.NEXT_PUBLIC_BASE_URL}/${route.replace(/\/page\.(tsx|mdx)$/, "")}`,
url: `${process.env.NEXT_PUBLIC_BASE_URL}/${route.replace(/\/page\.(tsx|mdx)$/, "")}`,
});
});