Skip to content

Commit 2fce597

Browse files
committed
feat: Migrate to next js v16
- Update dependencies - Add next 16 as peer dependency - Migrate middleware to proxy - Use pnpm catalog
1 parent 8dc23cf commit 2fce597

35 files changed

+2026
-2090
lines changed

.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ node_modules
55
# dotenv environment variables file
66
.env
77

8-
# Ignore dist
8+
# Output directories
99
dist
10-
11-
# Next.js
1210
.next
11+
tmp
1312

1413
# Nx
1514
.nx/cache

examples/basic/eslint.config.mjs

Lines changed: 31 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,31 @@
1-
import { FlatCompat } from "@eslint/eslintrc";
2-
import { dirname } from "path";
3-
import { fileURLToPath } from "url";
4-
5-
const __filename = fileURLToPath(import.meta.url);
6-
const __dirname = dirname(__filename);
7-
8-
const compat = new FlatCompat({
9-
baseDirectory: __dirname,
10-
});
11-
12-
const eslintConfig = [
13-
...compat.extends("next/core-web-vitals", "next/typescript"),
14-
{
15-
ignores: ["src/app/(payload)/"],
16-
},
17-
{
18-
rules: {
19-
"@typescript-eslint/ban-ts-comment": "warn",
20-
"@typescript-eslint/no-empty-object-type": "warn",
21-
"@typescript-eslint/no-explicit-any": "warn",
22-
"@typescript-eslint/no-unused-vars": [
23-
"warn",
24-
{
25-
vars: "all",
26-
args: "after-used",
27-
ignoreRestSiblings: false,
28-
argsIgnorePattern: "^_",
29-
varsIgnorePattern: "^_",
30-
destructuredArrayIgnorePattern: "^_",
31-
caughtErrorsIgnorePattern: "^(_|ignore)",
32-
},
33-
],
34-
},
35-
},
36-
];
37-
38-
export default eslintConfig;
1+
import nextCoreWebVitals from "eslint-config-next/core-web-vitals";
2+
import nextTypescript from "eslint-config-next/typescript";
3+
4+
const eslintConfig = [
5+
...nextCoreWebVitals,
6+
...nextTypescript,
7+
{
8+
ignores: ["src/app/(payload)/"],
9+
},
10+
{
11+
rules: {
12+
"@typescript-eslint/ban-ts-comment": "warn",
13+
"@typescript-eslint/no-empty-object-type": "warn",
14+
"@typescript-eslint/no-explicit-any": "warn",
15+
"@typescript-eslint/no-unused-vars": [
16+
"warn",
17+
{
18+
vars: "all",
19+
args: "after-used",
20+
ignoreRestSiblings: false,
21+
argsIgnorePattern: "^_",
22+
varsIgnorePattern: "^_",
23+
destructuredArrayIgnorePattern: "^_",
24+
caughtErrorsIgnorePattern: "^(_|ignore)",
25+
},
26+
],
27+
},
28+
},
29+
];
30+
31+
export default eslintConfig;

examples/basic/package.json

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,37 @@
55
"private": true,
66
"type": "module",
77
"scripts": {
8-
"build": "cross-env NODE_OPTIONS=--no-deprecation next build",
8+
"build": "cross-env NODE_OPTIONS=--no-deprecation next build --webpack",
99
"dev": "cross-env NODE_OPTIONS=--no-deprecation next dev",
10-
"dev:turbo": "cross-env NODE_OPTIONS=--no-deprecation next dev --turbopack",
1110
"devsafe": "rm -rf .next && cross-env NODE_OPTIONS=--no-deprecation next dev",
1211
"generate:importmap": "cross-env NODE_OPTIONS=--no-deprecation payload generate:importmap",
1312
"generate:types": "cross-env NODE_OPTIONS=--no-deprecation payload generate:types",
14-
"lint": "cross-env NODE_OPTIONS=--no-deprecation next lint",
13+
"lint": "cross-env NODE_OPTIONS=--no-deprecation eslint .",
1514
"payload": "cross-env NODE_OPTIONS=--no-deprecation payload",
1615
"start": "cross-env NODE_OPTIONS=--no-deprecation next start"
1716
},
1817
"dependencies": {
19-
"@payloadcms/db-postgres": "3.58.0",
20-
"@payloadcms/next": "3.58.0",
21-
"@payloadcms/richtext-lexical": "3.58.0",
18+
"@payloadcms/db-postgres": "catalog:",
19+
"@payloadcms/next": "catalog:",
20+
"@payloadcms/richtext-lexical": "catalog:",
2221
"cross-env": "^10.1.0",
23-
"graphql": "^16.11.0",
24-
"next": "15.5.4",
25-
"next-auth": "5.0.0-beta.29",
26-
"payload": "3.58.0",
22+
"graphql": "^16.12.0",
23+
"next": "catalog:",
24+
"next-auth": "catalog:",
25+
"payload": "catalog:",
2726
"payload-authjs": "workspace:*",
28-
"react": "19.2.0",
29-
"react-dom": "19.2.0",
30-
"sharp": "0.34.4"
27+
"react": "catalog:",
28+
"react-dom": "catalog:",
29+
"sharp": "0.34.5"
3130
},
3231
"devDependencies": {
33-
"@eslint/eslintrc": "^3.3.1",
34-
"@next/eslint-plugin-next": "^15.5.4",
35-
"@types/node": "^24.7.0",
36-
"@types/react": "19.2.0",
37-
"@types/react-dom": "19.2.0",
38-
"eslint": "^9.37.0",
39-
"eslint-config-next": "15.5.4",
40-
"eslint-plugin-react-hooks": "^5.2.0",
32+
"@next/eslint-plugin-next": "^16.0.5",
33+
"@types/node": "^24.10.1",
34+
"@types/react": "catalog:",
35+
"@types/react-dom": "catalog:",
36+
"eslint": "^9.39.1",
37+
"eslint-config-next": "16.0.5",
38+
"eslint-plugin-react-hooks": "^7.0.1",
4139
"typescript": "5.9.3"
4240
},
4341
"engines": {

examples/basic/project.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
"dev": {
77
"dependsOn": ["^build"]
88
},
9-
"dev:turbo": {
10-
"dependsOn": ["^build"]
11-
},
129
"build": {
1310
"cache": true
1411
},

examples/basic/src/payload-types.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,23 @@ export interface Config {
6868
blocks: {};
6969
collections: {
7070
users: User;
71+
'payload-kv': PayloadKv;
7172
'payload-locked-documents': PayloadLockedDocument;
7273
'payload-preferences': PayloadPreference;
7374
'payload-migrations': PayloadMigration;
7475
};
7576
collectionsJoins: {};
7677
collectionsSelect: {
7778
users: UsersSelect<false> | UsersSelect<true>;
79+
'payload-kv': PayloadKvSelect<false> | PayloadKvSelect<true>;
7880
'payload-locked-documents': PayloadLockedDocumentsSelect<false> | PayloadLockedDocumentsSelect<true>;
7981
'payload-preferences': PayloadPreferencesSelect<false> | PayloadPreferencesSelect<true>;
8082
'payload-migrations': PayloadMigrationsSelect<false> | PayloadMigrationsSelect<true>;
8183
};
8284
db: {
8385
defaultIDType: number;
8486
};
87+
fallbackLocale: null;
8588
globals: {};
8689
globalsSelect: {};
8790
locale: null;
@@ -132,6 +135,23 @@ export interface User {
132135
updatedAt: string;
133136
createdAt: string;
134137
}
138+
/**
139+
* This interface was referenced by `Config`'s JSON-Schema
140+
* via the `definition` "payload-kv".
141+
*/
142+
export interface PayloadKv {
143+
id: number;
144+
key: string;
145+
data:
146+
| {
147+
[k: string]: unknown;
148+
}
149+
| unknown[]
150+
| string
151+
| number
152+
| boolean
153+
| null;
154+
}
135155
/**
136156
* This interface was referenced by `Config`'s JSON-Schema
137157
* via the `definition` "payload-locked-documents".
@@ -205,6 +225,14 @@ export interface UsersSelect<T extends boolean = true> {
205225
updatedAt?: T;
206226
createdAt?: T;
207227
}
228+
/**
229+
* This interface was referenced by `Config`'s JSON-Schema
230+
* via the `definition` "payload-kv_select".
231+
*/
232+
export interface PayloadKvSelect<T extends boolean = true> {
233+
key?: T;
234+
data?: T;
235+
}
208236
/**
209237
* This interface was referenced by `Config`'s JSON-Schema
210238
* via the `definition` "payload-locked-documents_select".

examples/basic/src/proxy.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export { auth as proxy } from "./auth";
2+
3+
export const config = {
4+
matcher: ["/((?!api|_next/static|_next/image|favicon.ico|admin).*)"],
5+
};

examples/basic/tsconfig.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"esModuleInterop": true,
1313
"resolveJsonModule": true,
1414
"isolatedModules": true,
15-
"jsx": "preserve",
15+
"jsx": "react-jsx",
1616
"incremental": true,
1717
"plugins": [
1818
{
@@ -24,6 +24,12 @@
2424
"@payload-config": ["./src/payload.config.ts"]
2525
}
2626
},
27-
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
27+
"include": [
28+
"next-env.d.ts",
29+
"**/*.ts",
30+
"**/*.tsx",
31+
".next/types/**/*.ts",
32+
".next/dev/types/**/*.ts"
33+
],
2834
"exclude": ["node_modules"]
2935
}
Lines changed: 31 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,31 @@
1-
import { FlatCompat } from "@eslint/eslintrc";
2-
import { dirname } from "path";
3-
import { fileURLToPath } from "url";
4-
5-
const __filename = fileURLToPath(import.meta.url);
6-
const __dirname = dirname(__filename);
7-
8-
const compat = new FlatCompat({
9-
baseDirectory: __dirname,
10-
});
11-
12-
const eslintConfig = [
13-
...compat.extends("next/core-web-vitals", "next/typescript"),
14-
{
15-
ignores: ["src/app/(payload)/"],
16-
},
17-
{
18-
rules: {
19-
"@typescript-eslint/ban-ts-comment": "warn",
20-
"@typescript-eslint/no-empty-object-type": "warn",
21-
"@typescript-eslint/no-explicit-any": "warn",
22-
"@typescript-eslint/no-unused-vars": [
23-
"warn",
24-
{
25-
vars: "all",
26-
args: "after-used",
27-
ignoreRestSiblings: false,
28-
argsIgnorePattern: "^_",
29-
varsIgnorePattern: "^_",
30-
destructuredArrayIgnorePattern: "^_",
31-
caughtErrorsIgnorePattern: "^(_|ignore)",
32-
},
33-
],
34-
},
35-
},
36-
];
37-
38-
export default eslintConfig;
1+
import nextCoreWebVitals from "eslint-config-next/core-web-vitals";
2+
import nextTypescript from "eslint-config-next/typescript";
3+
4+
const eslintConfig = [
5+
...nextCoreWebVitals,
6+
...nextTypescript,
7+
{
8+
ignores: ["src/app/(payload)/"],
9+
},
10+
{
11+
rules: {
12+
"@typescript-eslint/ban-ts-comment": "warn",
13+
"@typescript-eslint/no-empty-object-type": "warn",
14+
"@typescript-eslint/no-explicit-any": "warn",
15+
"@typescript-eslint/no-unused-vars": [
16+
"warn",
17+
{
18+
vars: "all",
19+
args: "after-used",
20+
ignoreRestSiblings: false,
21+
argsIgnorePattern: "^_",
22+
varsIgnorePattern: "^_",
23+
destructuredArrayIgnorePattern: "^_",
24+
caughtErrorsIgnorePattern: "^(_|ignore)",
25+
},
26+
],
27+
},
28+
},
29+
];
30+
31+
export default eslintConfig;

examples/multiple-auth-collections/package.json

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,37 @@
55
"private": true,
66
"type": "module",
77
"scripts": {
8-
"build": "cross-env NODE_OPTIONS=--no-deprecation next build",
8+
"build": "cross-env NODE_OPTIONS=--no-deprecation next build --webpack",
99
"dev": "cross-env NODE_OPTIONS=--no-deprecation next dev",
10-
"dev:turbo": "cross-env NODE_OPTIONS=--no-deprecation next dev --turbopack",
1110
"devsafe": "rm -rf .next && cross-env NODE_OPTIONS=--no-deprecation next dev",
1211
"generate:importmap": "cross-env NODE_OPTIONS=--no-deprecation payload generate:importmap",
1312
"generate:types": "cross-env NODE_OPTIONS=--no-deprecation payload generate:types",
14-
"lint": "cross-env NODE_OPTIONS=--no-deprecation next lint",
13+
"lint": "cross-env NODE_OPTIONS=--no-deprecation eslint .",
1514
"payload": "cross-env NODE_OPTIONS=--no-deprecation payload",
1615
"start": "cross-env NODE_OPTIONS=--no-deprecation next start"
1716
},
1817
"dependencies": {
19-
"@payloadcms/db-postgres": "3.58.0",
20-
"@payloadcms/next": "3.58.0",
21-
"@payloadcms/richtext-lexical": "3.58.0",
18+
"@payloadcms/db-postgres": "catalog:",
19+
"@payloadcms/next": "catalog:",
20+
"@payloadcms/richtext-lexical": "catalog:",
2221
"cross-env": "^10.1.0",
23-
"graphql": "^16.11.0",
24-
"next": "15.5.4",
25-
"next-auth": "5.0.0-beta.29",
26-
"payload": "3.58.0",
22+
"graphql": "^16.12.0",
23+
"next": "catalog:",
24+
"next-auth": "catalog:",
25+
"payload": "catalog:",
2726
"payload-authjs": "workspace:*",
28-
"react": "19.2.0",
29-
"react-dom": "19.2.0",
30-
"sharp": "0.34.4"
27+
"react": "catalog:",
28+
"react-dom": "catalog:",
29+
"sharp": "0.34.5"
3130
},
3231
"devDependencies": {
33-
"@eslint/eslintrc": "^3.3.1",
34-
"@next/eslint-plugin-next": "^15.5.4",
35-
"@types/node": "^24.7.0",
36-
"@types/react": "19.2.0",
37-
"@types/react-dom": "19.2.0",
38-
"eslint": "^9.37.0",
39-
"eslint-config-next": "15.5.4",
40-
"eslint-plugin-react-hooks": "^5.2.0",
32+
"@next/eslint-plugin-next": "^16.0.5",
33+
"@types/node": "^24.10.1",
34+
"@types/react": "catalog:",
35+
"@types/react-dom": "catalog:",
36+
"eslint": "^9.39.1",
37+
"eslint-config-next": "16.0.5",
38+
"eslint-plugin-react-hooks": "^7.0.1",
4139
"typescript": "5.9.3"
4240
},
4341
"engines": {

0 commit comments

Comments
 (0)