Update nextjs and other dependencies

This commit is contained in:
Ryan Freeman 2025-02-23 21:02:05 +00:00
parent 24acc69d20
commit 62e1d50585
4 changed files with 1246 additions and 685 deletions

View File

@ -1,13 +1,11 @@
import {NextResponse} from 'next/server' import {NextResponse} from 'next/server'
import {cookies} from 'next/headers' import {createClient} from '@/lib/supabase/server'
import {createServerComponentClient} from '@supabase/auth-helpers-nextjs'
import type {Database} from '@/types/database.types'
export async function GET(request: Request, {params}: { params: { slug: string } }) { export async function GET(request: Request, {params}: { params: { slug: string } }) {
if (typeof params.slug !== 'undefined') { const {slug} = await params
if (typeof slug !== 'undefined') {
try { try {
const supabase = createServerComponentClient<Database>({cookies}) const supabase = await createClient()
const slug = params.slug.toString()
const response = await supabase const response = await supabase
// @ts-ignore // @ts-ignore
.from('analytics') .from('analytics')
@ -27,10 +25,10 @@ export async function GET(request: Request, {params}: { params: { slug: string }
} }
export async function POST(request: Request, {params}: { params: { slug: string } }) { export async function POST(request: Request, {params}: { params: { slug: string } }) {
if (typeof params.slug !== 'undefined') { const {slug} = await params
if (typeof slug !== 'undefined') {
try { try {
const supabase = createServerComponentClient<Database>({cookies}) const supabase = await createClient()
const slug = params.slug.toString()
// @ts-ignore // @ts-ignore
await supabase.rpc('increment_views', {page_slug: slug}) await supabase.rpc('increment_views', {page_slug: slug})
return NextResponse.json({}) return NextResponse.json({})

View File

@ -1,10 +1,10 @@
'use client' 'use client'
import {createPagesBrowserClient} from '@supabase/auth-helpers-nextjs'
import {ElementType, useEffect} from 'react' import {ElementType, useEffect} from 'react'
import useSWR, {useSWRConfig} from 'swr' import useSWR, {useSWRConfig} from 'swr'
import fetcher from '@/lib/fetcher' import fetcher from '@/lib/fetcher'
import {numberFormat} from '@/lib/numberFormat' import {numberFormat} from '@/lib/numberFormat'
import {createClient} from '@/lib/supabase/client'
type ViewsProps = { type ViewsProps = {
as?: ElementType as?: ElementType
@ -15,7 +15,7 @@ type ViewsProps = {
} }
export function Views({as: Component = 'span', slug, className, shouldUpdateViews = true, shouldRender = true}: ViewsProps) { export function Views({as: Component = 'span', slug, className, shouldUpdateViews = true, shouldRender = true}: ViewsProps) {
const supabase = createPagesBrowserClient() const supabase = createClient()
const {data} = useSWR(`/api/views/${slug}`, fetcher) as { data: { views: number } } const {data} = useSWR(`/api/views/${slug}`, fetcher) as { data: { views: number } }
const {mutate} = useSWRConfig() const {mutate} = useSWRConfig()

1898
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,8 @@
"@mdx-js/react": "^2.3.0", "@mdx-js/react": "^2.3.0",
"@next/mdx": "^13.4.10", "@next/mdx": "^13.4.10",
"@supabase/auth-helpers-nextjs": "^0.7.3", "@supabase/auth-helpers-nextjs": "^0.7.3",
"@supabase/supabase-js": "^2.27.0", "@supabase/ssr": "^0.5.2",
"@supabase/supabase-js": "2.48.1",
"@tailwindcss/typography": "^0.5.8", "@tailwindcss/typography": "^0.5.8",
"@theguild/remark-mermaid": "^0.1.2", "@theguild/remark-mermaid": "^0.1.2",
"@types/mdx": "^2.0.5", "@types/mdx": "^2.0.5",
@ -28,16 +29,16 @@
"clsx": "^1.2.1", "clsx": "^1.2.1",
"encoding": "^0.1.13", "encoding": "^0.1.13",
"eslint": "8.31.0", "eslint": "8.31.0",
"eslint-config-next": "^14.1.0", "eslint-config-next": "^15.1.7",
"fast-glob": "^3.2.12", "fast-glob": "^3.2.12",
"feed": "^4.2.2", "feed": "^4.2.2",
"focus-visible": "^5.2.0", "focus-visible": "^5.2.0",
"next": "^14.2.10", "next": "^15.1.7",
"next-themes": "^0.2.1", "next-themes": "^0.2.1",
"postcss": "^8.4.21", "postcss": "^8.4.21",
"postcss-focus-visible": "^7.1.0", "postcss-focus-visible": "^7.1.0",
"react": "^18.2.0", "react": "^19.0.0",
"react-dom": "^18.2.0", "react-dom": "^19.0.0",
"remark-gfm": "^3.0.1", "remark-gfm": "^3.0.1",
"sharp": "^0.33.2", "sharp": "^0.33.2",
"supabase": "^1.50.2", "supabase": "^1.50.2",
@ -45,6 +46,6 @@
"tailwind-merge": "^1.9.0", "tailwind-merge": "^1.9.0",
"tailwindcss": "^3.3.0", "tailwindcss": "^3.3.0",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "4.9.4" "typescript": "5.7.3"
} }
} }