Skip to content

Commit

Permalink
chore: support next.js 15 (#4387)
Browse files Browse the repository at this point in the history
* chore: upgrade to next.js 15

* fix: await cookies and headers in blitz auth

* chore: run codemod

* upgrade to latest react

* fix: add await to blitz rpc handler

* chore: upgrade to latest dynamic import

* fix: remaining type fixes

* Create wild-news-shop.md

* fix: react types

* upgrade testing library

* fix turbopack exports

* fix

* chore: remove outdated `@testing-library/react-hooks`

* Merge branch 'siddharth/upgrade-to-next-15' of https://github.com/blitz-js/blitz into siddharth/upgrade-to-next-15

* upgrade testing library

* fix turbopack exports

* fix

chore: remove outdated `@testing-library/react-hooks`

* upgrade to react 19

* fix unit tests

* fix

* fix

* fix again

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
siddhsuresh and kodiakhq[bot] authored Dec 23, 2024
1 parent 565db3c commit 3fa3a4e
Show file tree
Hide file tree
Showing 72 changed files with 1,132 additions and 721 deletions.
8 changes: 8 additions & 0 deletions .changeset/wild-news-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@blitzjs/auth": minor
"@blitzjs/next": minor
"@blitzjs/rpc": minor
"blitz": minor
---

chore: support next.js 15
10 changes: 5 additions & 5 deletions apps/next13/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
"@tanstack/react-query": "4.0.10",
"blitz": "2.1.4",
"flatted": "3.2.7",
"next": "14.2.15",
"next": "15.0.1",
"prisma": "^4.5.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react": "19.0.0",
"react-dom": "19.0.0",
"react-hook-form": "7.39.1",
"superjson": "1.11.0",
"zod": "3.23.8"
},
"devDependencies": {
"@types/node": "18.11.7",
"@types/react": "18.0.23",
"@types/react-dom": "18.0.7",
"@types/react": "npm:types-react@19.0.0",
"@types/react-dom": "npm:types-react-dom@19.0.0",
"eslint": "8.26.0",
"eslint-config-next": "13.0.0",
"typescript": "4.8.4"
Expand Down
2 changes: 1 addition & 1 deletion apps/next13/src/core/components/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {zodResolver} from "@hookform/resolvers/zod"
import {z} from "zod"

export interface FormProps<S extends z.ZodType<any, any>>
extends Omit<PropsWithoutRef<JSX.IntrinsicElements["form"]>, "onSubmit"> {
extends Omit<PropsWithoutRef<React.JSX.IntrinsicElements["form"]>, "onSubmit"> {
/** All your form fields */
children?: ReactNode
/** Text to display in the submit button */
Expand Down
5 changes: 3 additions & 2 deletions apps/next13/src/core/components/LabeledTextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import {forwardRef, PropsWithoutRef, ComponentPropsWithoutRef} from "react"
import {useFormContext} from "react-hook-form"
import {ErrorMessage} from "@hookform/error-message"

export interface LabeledTextFieldProps extends PropsWithoutRef<JSX.IntrinsicElements["input"]> {
export interface LabeledTextFieldProps
extends PropsWithoutRef<React.JSX.IntrinsicElements["input"]> {
/** Field name. */
name: string
/** Field label. */
label: string
/** Field type. Doesn't include radio buttons and checkboxes */
type?: "text" | "password" | "email" | "number"
outerProps?: PropsWithoutRef<JSX.IntrinsicElements["div"]>
outerProps?: PropsWithoutRef<React.JSX.IntrinsicElements["div"]>
labelProps?: ComponentPropsWithoutRef<"label">
}

Expand Down
11 changes: 5 additions & 6 deletions apps/toolkit-app-passportjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,22 @@
"@hookform/resolvers": "2.9.10",
"@prisma/client": "6.1.0",
"blitz": "2.1.4",
"next": "14.2.15",
"next": "15.0.1",
"openid-client": "5.2.1",
"prisma": "6.1.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react": "19.0.0",
"react-dom": "19.0.0",
"react-hook-form": "7.39.1",
"ts-node": "10.9.1",
"zod": "3.23.8"
},
"devDependencies": {
"@next/bundle-analyzer": "12.0.8",
"@testing-library/react": "13.4.0",
"@testing-library/react-hooks": "8.0.1",
"@testing-library/react": "16.0.1",
"@types/jest": "29.2.2",
"@types/node": "18.11.9",
"@types/preview-email": "2.0.1",
"@types/react": "18.0.25",
"@types/react": "npm:types-react@19.0.0",
"@typescript-eslint/eslint-plugin": "5.42.1",
"eslint": "8.27.0",
"eslint-config-next": "12.3.1",
Expand Down
2 changes: 1 addition & 1 deletion apps/toolkit-app-passportjs/src/core/components/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { zodResolver } from "@hookform/resolvers/zod"
import { z } from "zod"

export interface FormProps<S extends z.ZodType<any, any>>
extends Omit<PropsWithoutRef<JSX.IntrinsicElements["form"]>, "onSubmit"> {
extends Omit<PropsWithoutRef<React.JSX.IntrinsicElements["form"]>, "onSubmit"> {
/** All your form fields */
children?: ReactNode
/** Text to display in the submit button */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import { forwardRef, PropsWithoutRef, ComponentPropsWithoutRef } from "react"
import { useFormContext } from "react-hook-form"
import { ErrorMessage } from "@hookform/error-message"

export interface LabeledTextFieldProps extends PropsWithoutRef<JSX.IntrinsicElements["input"]> {
export interface LabeledTextFieldProps
extends PropsWithoutRef<React.JSX.IntrinsicElements["input"]> {
/** Field name. */
name: string
/** Field label. */
label: string
/** Field type. Doesn't include radio buttons and checkboxes */
type?: "text" | "password" | "email" | "number"
outerProps?: PropsWithoutRef<JSX.IntrinsicElements["div"]>
outerProps?: PropsWithoutRef<React.JSX.IntrinsicElements["div"]>
labelProps?: ComponentPropsWithoutRef<"label">
}

Expand Down
2 changes: 1 addition & 1 deletion apps/toolkit-app/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
11 changes: 5 additions & 6 deletions apps/toolkit-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,22 @@
"@hookform/resolvers": "2.9.10",
"@prisma/client": "6.1.0",
"blitz": "2.1.4",
"next": "14.2.15",
"next": "15.0.1",
"next-auth": "4.24.7",
"prisma": "6.1.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react": "19.0.0",
"react-dom": "19.0.0",
"react-hook-form": "7.39.1",
"ts-node": "10.9.1",
"zod": "3.23.8"
},
"devDependencies": {
"@next/bundle-analyzer": "12.0.8",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/react": "13.4.0",
"@testing-library/react-hooks": "8.0.1",
"@testing-library/react": "16.0.1",
"@types/node": "18.11.9",
"@types/preview-email": "2.0.1",
"@types/react": "18.0.25",
"@types/react": "npm:types-react@19.0.0",
"@typescript-eslint/eslint-plugin": "5.42.1",
"@vitejs/plugin-react": "2.2.0",
"eslint": "8.27.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/toolkit-app/src/core/components/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { zodResolver } from "@hookform/resolvers/zod"
import { z } from "zod"

export interface FormProps<S extends z.ZodType<any, any>>
extends Omit<PropsWithoutRef<JSX.IntrinsicElements["form"]>, "onSubmit"> {
extends Omit<PropsWithoutRef<React.JSX.IntrinsicElements["form"]>, "onSubmit"> {
/** All your form fields */
children?: ReactNode
/** Text to display in the submit button */
Expand Down
5 changes: 3 additions & 2 deletions apps/toolkit-app/src/core/components/LabelSelectField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import { ComponentPropsWithoutRef, forwardRef, PropsWithoutRef } from "react"
import { useFormContext } from "react-hook-form"
import { ErrorMessage } from "@hookform/error-message"

export interface LabeledSelectFieldProps extends PropsWithoutRef<JSX.IntrinsicElements["select"]> {
export interface LabeledSelectFieldProps
extends PropsWithoutRef<React.JSX.IntrinsicElements["select"]> {
/** Field name. */
name: string
/** Field label. */
label: string
/** Field type. Doesn't include radio buttons and checkboxes */
options: any[]
outerProps?: PropsWithoutRef<JSX.IntrinsicElements["div"]>
outerProps?: PropsWithoutRef<React.JSX.IntrinsicElements["div"]>
labelProps?: ComponentPropsWithoutRef<"label">
}

Expand Down
5 changes: 3 additions & 2 deletions apps/toolkit-app/src/core/components/LabeledTextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import { forwardRef, PropsWithoutRef, ComponentPropsWithoutRef } from "react"
import { useFormContext } from "react-hook-form"
import { ErrorMessage } from "@hookform/error-message"

export interface LabeledTextFieldProps extends PropsWithoutRef<JSX.IntrinsicElements["input"]> {
export interface LabeledTextFieldProps
extends PropsWithoutRef<React.JSX.IntrinsicElements["input"]> {
/** Field name. */
name: string
/** Field label. */
label: string
/** Field type. Doesn't include radio buttons and checkboxes */
type?: "text" | "password" | "email" | "number"
outerProps?: PropsWithoutRef<JSX.IntrinsicElements["div"]>
outerProps?: PropsWithoutRef<React.JSX.IntrinsicElements["div"]>
labelProps?: ComponentPropsWithoutRef<"label">
}

Expand Down
8 changes: 4 additions & 4 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@
"blitz": "2.1.4",
"jest": "29.3.0",
"jest-environment-jsdom": "29.3.0",
"next": "14.2.15",
"next": "15.0.1",
"passport-mock-strategy": "2.0.0",
"passport-twitter": "1.0.4",
"prisma": "6.1.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react": "19.0.0",
"react-dom": "19.0.0",
"ts-node": "10.9.1"
},
"devDependencies": {
"@next/bundle-analyzer": "12.0.8",
"@types/react": "18.0.25",
"@types/react": "npm:types-react@19.0.0",
"eslint": "8.27.0",
"typescript": "^4.8.4"
}
Expand Down
11 changes: 5 additions & 6 deletions integration-tests/auth-with-rpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,21 @@
"@prisma/client": "6.1.0",
"blitz": "2.1.4",
"delay": "5.0.0",
"next": "14.2.15",
"next": "15.0.1",
"prisma": "6.1.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react": "19.0.0",
"react-dom": "19.0.0",
"react-hook-form": "7.39.1",
"ts-node": "10.9.1",
"zod": "3.23.8"
},
"devDependencies": {
"@next/bundle-analyzer": "12.0.8",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/react": "13.4.0",
"@testing-library/react-hooks": "8.0.1",
"@testing-library/react": "16.0.1",
"@types/node": "18.11.9",
"@types/preview-email": "2.0.1",
"@types/react": "18.0.25",
"@types/react": "npm:types-react@19.0.0",
"@typescript-eslint/eslint-plugin": "5.42.1",
"@vitejs/plugin-react": "2.2.0",
"eslint": "8.27.0",
Expand Down
8 changes: 4 additions & 4 deletions integration-tests/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
"@prisma/client": "6.1.0",
"blitz": "2.1.4",
"lowdb": "3.0.0",
"next": "14.2.15",
"next": "15.0.1",
"prisma": "6.1.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react": "19.0.0",
"react-dom": "19.0.0",
"secure-password": "4.0.0",
"wait-port": "1.0.4"
},
Expand All @@ -36,7 +36,7 @@
"@types/fs-extra": "9.0.13",
"@types/node": "18.7.13",
"@types/node-fetch": "2.6.1",
"@types/react": "18.0.25",
"@types/react": "npm:types-react@19.0.0",
"b64-lite": "1.4.0",
"eslint": "8.27.0",
"fs-extra": "10.0.1",
Expand Down
8 changes: 4 additions & 4 deletions integration-tests/get-initial-props/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
"@prisma/client": "6.1.0",
"blitz": "2.1.4",
"lowdb": "2.1.0",
"next": "14.2.15",
"next": "15.0.1",
"prisma": "6.1.0",
"react": "18.2.0",
"react-dom": "18.2.0"
"react": "19.0.0",
"react-dom": "19.0.0"
},
"devDependencies": {
"@blitzjs/config": "2.1.4",
"@next/bundle-analyzer": "12.0.8",
"@types/express": "4.17.13",
"@types/fs-extra": "9.0.13",
"@types/node-fetch": "2.6.1",
"@types/react": "18.0.25",
"@types/react": "npm:types-react@19.0.0",
"b64-lite": "1.4.0",
"eslint": "8.27.0",
"fs-extra": "10.0.1",
Expand Down
8 changes: 4 additions & 4 deletions integration-tests/middleware/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
"@blitzjs/next": "2.1.4",
"@blitzjs/rpc": "2.1.4",
"blitz": "2.1.4",
"next": "14.2.15",
"react": "18.2.0",
"react-dom": "18.2.0"
"next": "15.0.1",
"react": "19.0.0",
"react-dom": "19.0.0"
},
"devDependencies": {
"@next/bundle-analyzer": "12.0.8",
"@types/express": "4.17.13",
"@types/fs-extra": "9.0.13",
"@types/node-fetch": "2.6.1",
"@types/react": "18.0.25",
"@types/react": "npm:types-react@19.0.0",
"eslint": "8.27.0",
"fs-extra": "10.0.1",
"get-port": "6.1.2",
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/next-13-app-dir/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
8 changes: 4 additions & 4 deletions integration-tests/next-13-app-dir/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
"@prisma/client": "6.1.0",
"blitz": "2.1.4",
"lowdb": "2.1.0",
"next": "14.2.15",
"next": "15.0.1",
"prisma": "6.1.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"react": "19.0.0",
"react-dom": "19.0.0",
"secure-password": "4.0.0",
"wait-port": "1.0.4"
},
Expand All @@ -37,7 +37,7 @@
"@types/fs-extra": "9.0.13",
"@types/node": "18.7.13",
"@types/node-fetch": "2.6.1",
"@types/react": "18.0.25",
"@types/react": "npm:types-react@19.0.0",
"b64-lite": "1.4.0",
"eslint": "8.27.0",
"fs-extra": "10.0.1",
Expand Down
8 changes: 4 additions & 4 deletions integration-tests/no-suspense/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
"@prisma/client": "6.1.0",
"blitz": "2.1.4",
"lowdb": "3.0.0",
"next": "14.2.15",
"next": "15.0.1",
"prisma": "6.1.0",
"react": "18.2.0",
"react-dom": "18.2.0"
"react": "19.0.0",
"react-dom": "19.0.0"
},
"devDependencies": {
"@blitzjs/config": "2.1.4",
"@next/bundle-analyzer": "12.0.8",
"@types/express": "4.17.13",
"@types/fs-extra": "9.0.13",
"@types/node-fetch": "2.6.1",
"@types/react": "18.0.25",
"@types/react": "npm:types-react@19.0.0",
"b64-lite": "1.4.0",
"eslint": "8.27.0",
"fs-extra": "10.0.1",
Expand Down
10 changes: 5 additions & 5 deletions integration-tests/qm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
"@prisma/client": "6.1.0",
"@tanstack/react-query": "4.0.10",
"blitz": "2.1.4",
"next": "14.2.15",
"next": "15.0.1",
"prisma": "6.1.0",
"react": "18.2.0",
"react-dom": "18.2.0"
"react": "19.0.0",
"react-dom": "19.0.0"
},
"devDependencies": {
"@testing-library/react": "13.4.0",
"@types/react": "18.0.25",
"@testing-library/react": "16.0.1",
"@types/react": "npm:types-react@19.0.0",
"@vitejs/plugin-react": "1.3.0",
"delay": "5.0.0",
"eslint": "8.27.0",
Expand Down
Loading

0 comments on commit 3fa3a4e

Please sign in to comment.