Skip to content

Commit 4e34130

Browse files
authored
templates: bump templates to Next.js 16.2.0 (#16003)
This PR bumps all our templates to use Next.js 16.2.0. As part of that process, we're renaming the next.config.mjs files to next.config.ts. --- - To see the specific tasks where the Asana app for GitHub is being used, see below: - https://app.asana.com/0/0/1213725260670238
1 parent 5c935aa commit 4e34130

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1001
-798
lines changed

docs/getting-started/installation.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Payload requires the following software:
1616
- `15.2.9` - `15.2.x`
1717
- `15.3.9` - `15.3.x`
1818
- `15.4.11` - `15.4.x`
19-
- `16.2.0-canary.10`+
19+
- `16.2.0`+
2020
- Any [compatible database](/docs/database/overview) (MongoDB, Postgres or SQLite)
2121

2222
<Banner type="warning">

pnpm-lock.yaml

Lines changed: 585 additions & 560 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import { withPayload } from '@payloadcms/next/withPayload'
2+
import type { NextConfig } from 'next'
3+
import path from 'path'
4+
import { fileURLToPath } from 'url'
25

3-
/** @type {import('next').NextConfig} */
4-
const nextConfig = {
5-
// Your Next.js config here
6+
const __filename = fileURLToPath(import.meta.url)
7+
const dirname = path.dirname(__filename)
8+
9+
const nextConfig: NextConfig = {
610
webpack: (webpackConfig) => {
711
webpackConfig.resolve.extensionAlias = {
812
'.cjs': ['.cts', '.cjs'],
@@ -12,6 +16,9 @@ const nextConfig = {
1216

1317
return webpackConfig
1418
},
19+
turbopack: {
20+
root: path.resolve(dirname),
21+
},
1522
}
1623

1724
export default withPayload(nextConfig, { devBundleServerPackages: false })

templates/_template/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"devsafe": "rm -rf .next && cross-env NODE_OPTIONS=--no-deprecation next dev",
1111
"generate:importmap": "cross-env NODE_OPTIONS=--no-deprecation payload generate:importmap",
1212
"generate:types": "cross-env NODE_OPTIONS=--no-deprecation payload generate:types",
13-
"lint": "cross-env NODE_OPTIONS=--no-deprecation next lint",
13+
"lint": "cross-env NODE_OPTIONS=--no-deprecation eslint .",
1414
"payload": "cross-env NODE_OPTIONS=--no-deprecation payload",
1515
"start": "cross-env NODE_OPTIONS=--no-deprecation next start",
1616
"test": "pnpm run test:int && pnpm run test:e2e",
@@ -24,22 +24,22 @@
2424
"@payloadcms/ui": "latest",
2525
"cross-env": "^7.0.3",
2626
"graphql": "^16.8.1",
27-
"next": "15.4.11",
27+
"next": "16.2.0",
2828
"payload": "latest",
29-
"react": "19.2.1",
30-
"react-dom": "19.2.1",
29+
"react": "19.2.4",
30+
"react-dom": "19.2.4",
3131
"sharp": "0.34.2"
3232
},
3333
"devDependencies": {
3434
"@eslint/eslintrc": "^3.2.0",
3535
"@playwright/test": "1.58.2",
3636
"@testing-library/react": "16.3.0",
3737
"@types/node": "22.19.9",
38-
"@types/react": "19.2.9",
38+
"@types/react": "19.2.14",
3939
"@types/react-dom": "19.2.3",
4040
"@vitejs/plugin-react": "4.5.2",
4141
"eslint": "^9.16.0",
42-
"eslint-config-next": "15.4.11",
42+
"eslint-config-next": "16.2.0",
4343
"jsdom": "28.0.0",
4444
"prettier": "^3.4.2",
4545
"tsx": "4.21.0",

templates/_template/tsconfig.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"moduleResolution": "bundler",
1616
"resolveJsonModule": true,
1717
"isolatedModules": true,
18-
"jsx": "preserve",
18+
"jsx": "react-jsx",
1919
"incremental": true,
2020
"plugins": [
2121
{
@@ -30,13 +30,14 @@
3030
"./src/payload.config.ts"
3131
]
3232
},
33-
"target": "ES2022",
33+
"target": "ES2022"
3434
},
3535
"include": [
3636
"next-env.d.ts",
3737
"**/*.ts",
3838
"**/*.tsx",
39-
".next/types/**/*.ts"
39+
".next/types/**/*.ts",
40+
".next/dev/types/**/*.ts"
4041
],
4142
"exclude": [
4243
"node_modules"
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import { withPayload } from '@payloadcms/next/withPayload'
2+
import type { NextConfig } from 'next'
3+
import path from 'path'
4+
import { fileURLToPath } from 'url'
25

3-
/** @type {import('next').NextConfig} */
4-
const nextConfig = {
5-
// Your Next.js config here
6+
const __filename = fileURLToPath(import.meta.url)
7+
const dirname = path.dirname(__filename)
8+
9+
const nextConfig: NextConfig = {
610
webpack: (webpackConfig) => {
711
webpackConfig.resolve.extensionAlias = {
812
'.cjs': ['.cts', '.cjs'],
@@ -12,6 +16,9 @@ const nextConfig = {
1216

1317
return webpackConfig
1418
},
19+
turbopack: {
20+
root: path.resolve(dirname),
21+
},
1522
}
1623

1724
export default withPayload(nextConfig, { devBundleServerPackages: false })

templates/blank/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"devsafe": "rm -rf .next && cross-env NODE_OPTIONS=--no-deprecation next dev",
1111
"generate:importmap": "cross-env NODE_OPTIONS=--no-deprecation payload generate:importmap",
1212
"generate:types": "cross-env NODE_OPTIONS=--no-deprecation payload generate:types",
13-
"lint": "cross-env NODE_OPTIONS=--no-deprecation next lint",
13+
"lint": "cross-env NODE_OPTIONS=--no-deprecation eslint .",
1414
"payload": "cross-env NODE_OPTIONS=--no-deprecation payload",
1515
"start": "cross-env NODE_OPTIONS=--no-deprecation next start",
1616
"test": "pnpm run test:int && pnpm run test:e2e",
@@ -25,21 +25,21 @@
2525
"cross-env": "^7.0.3",
2626
"dotenv": "16.4.7",
2727
"graphql": "^16.8.1",
28-
"next": "15.4.11",
28+
"next": "16.2.0",
2929
"payload": "workspace:*",
30-
"react": "19.2.1",
31-
"react-dom": "19.2.1",
30+
"react": "19.2.4",
31+
"react-dom": "19.2.4",
3232
"sharp": "0.34.2"
3333
},
3434
"devDependencies": {
3535
"@playwright/test": "1.58.2",
3636
"@testing-library/react": "16.3.0",
3737
"@types/node": "22.19.9",
38-
"@types/react": "19.2.9",
38+
"@types/react": "19.2.14",
3939
"@types/react-dom": "19.2.3",
4040
"@vitejs/plugin-react": "4.5.2",
4141
"eslint": "^9.16.0",
42-
"eslint-config-next": "15.4.11",
42+
"eslint-config-next": "16.2.0",
4343
"jsdom": "28.0.0",
4444
"prettier": "^3.4.2",
4545
"tsx": "4.21.0",

templates/blank/src/payload-types.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ export interface Config {
9090
globals: {};
9191
globalsSelect: {};
9292
locale: null;
93+
widgets: {
94+
collections: CollectionsWidget;
95+
};
9396
user: User;
9497
jobs: {
9598
tasks: unknown;
@@ -312,6 +315,16 @@ export interface PayloadMigrationsSelect<T extends boolean = true> {
312315
updatedAt?: T;
313316
createdAt?: T;
314317
}
318+
/**
319+
* This interface was referenced by `Config`'s JSON-Schema
320+
* via the `definition` "collections_widget".
321+
*/
322+
export interface CollectionsWidget {
323+
data?: {
324+
[k: string]: unknown;
325+
};
326+
width: 'full';
327+
}
315328
/**
316329
* This interface was referenced by `Config`'s JSON-Schema
317330
* via the `definition` "auth".

templates/blank/tsconfig.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"moduleResolution": "bundler",
1616
"resolveJsonModule": true,
1717
"isolatedModules": true,
18-
"jsx": "preserve",
18+
"jsx": "react-jsx",
1919
"incremental": true,
2020
"plugins": [
2121
{
@@ -30,15 +30,16 @@
3030
"./src/payload.config.ts"
3131
]
3232
},
33-
"target": "ES2022",
33+
"target": "ES2022"
3434
},
3535
"include": [
3636
"next-env.d.ts",
3737
"**/*.ts",
3838
"**/*.tsx",
39-
".next/types/**/*.ts"
39+
".next/types/**/*.ts",
40+
".next/dev/types/**/*.ts"
4041
],
4142
"exclude": [
4243
"node_modules"
43-
],
44+
]
4445
}
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
import { withPayload } from '@payloadcms/next/withPayload'
2+
import type { NextConfig } from 'next'
3+
import path from 'path'
4+
import { fileURLToPath } from 'url'
25

3-
import redirects from './redirects.js'
6+
const __filename = fileURLToPath(import.meta.url)
7+
const dirname = path.dirname(__filename)
8+
import { redirects } from './redirects'
49

510
const NEXT_PUBLIC_SERVER_URL = process.env.NEXT_PUBLIC_SERVER_URL || 'http://localhost:3000'
611

7-
/** @type {import('next').NextConfig} */
8-
const nextConfig = {
12+
const nextConfig: NextConfig = {
913
images: {
14+
qualities: [90, 100],
1015
remotePatterns: [
1116
...[NEXT_PUBLIC_SERVER_URL /* 'https://example.com' */].map((item) => {
1217
const url = new URL(item)
1318

1419
return {
1520
hostname: url.hostname,
16-
protocol: url.protocol.replace(':', ''),
21+
protocol: url.protocol.replace(':', '') as 'http' | 'https',
1722
}
1823
}),
1924
],
@@ -29,6 +34,9 @@ const nextConfig = {
2934

3035
return webpackConfig
3136
},
37+
turbopack: {
38+
root: path.resolve(dirname),
39+
},
3240
}
3341

3442
export default withPayload(nextConfig)

0 commit comments

Comments
 (0)