Skip to content
This repository was archived by the owner on Dec 1, 2025. It is now read-only.

Commit b8b6d17

Browse files
committed
chore: migrate template to use latest beta of payload packages
1 parent f88a3df commit b8b6d17

27 files changed

Lines changed: 8814 additions & 7257 deletions

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
dev/tmp
22
dev/yarn.lock
3+
dev/.next
4+
dev/pnpm-lock.yaml
35

46
# Created by https://www.gitignore.io/api/node,macos,windows,webstorm,sublimetext,visualstudiocode
57

dev/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ dist
44
node_modules
55
.DS_Store
66
.env
7+
.next

dev/next-env.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/// <reference types="next" />
2+
/// <reference types="next/image-types/global" />
3+
4+
// NOTE: This file should not be edited
5+
// see https://nextjs.org/docs/basic-features/typescript for more information.

dev/package.json

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
11
{
2-
"name": "Payload2Blank",
2+
"name": "payload-blank-plugin",
33
"description": "A blank template to get started with Payload",
44
"version": "1.0.0",
55
"main": "dist/server.js",
66
"license": "MIT",
77
"scripts": {
8-
"dev": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts nodemon",
9-
"build:payload": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload build",
10-
"build:server": "tsc",
11-
"build": "yarn copyfiles && yarn build:payload && yarn build:server",
12-
"serve": "cross-env PAYLOAD_CONFIG_PATH=dist/payload.config.js NODE_ENV=production node dist/server.js",
13-
"copyfiles": "copyfiles -u 1 \"src/**/*.{html,css,scss,ttf,woff,woff2,eot,svg,jpg,png}\" dist/",
14-
"generate:types": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:types",
15-
"generate:graphQLSchema": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:graphQLSchema",
16-
"payload": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload"
8+
"dev": "cross-env NODE_OPTIONS=--no-deprecation next dev",
9+
"devsafe": "rm -rf .next && cross-env NODE_OPTIONS=--no-deprecation next dev",
10+
"build": "cross-env NODE_OPTIONS=--no-deprecation next build",
11+
"payload": "cross-env NODE_OPTIONS=--no-deprecation payload",
12+
"start": "cross-env NODE_OPTIONS=--no-deprecation next start",
13+
"lint": "cross-env NODE_OPTIONS=--no-deprecation next lint",
14+
"generate:types": "payload generate:types",
15+
"standalone-script": "tsx ./src/scripts/standalone-script.ts",
16+
"generate:graphQLSchema": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload generate:graphQLSchema"
1717
},
1818
"dependencies": {
19-
"@payloadcms/bundler-webpack": "^1.0.0",
20-
"@payloadcms/db-mongodb": "^1.0.0",
21-
"@payloadcms/plugin-cloud": "^2.0.0",
22-
"@payloadcms/richtext-slate": "^1.0.0",
19+
"@payloadcms/db-mongodb": "3.0.0-beta.10",
20+
"@payloadcms/next": "3.0.0-beta.10",
21+
"@payloadcms/richtext-lexical": "3.0.0-beta.10",
22+
"@payloadcms/ui": "3.0.0-beta.10",
2323
"cross-env": "^7.0.3",
2424
"dotenv": "^8.2.0",
25-
"express": "^4.17.1",
26-
"payload": "^2.0.0"
25+
"payload": "3.0.0-beta.10",
26+
"react": "^18.2.0",
27+
"sharp": "^0.33.3"
2728
},
2829
"devDependencies": {
29-
"@types/express": "^4.17.9",
30+
"@types/react": "^18.2.78",
3031
"copyfiles": "^2.4.1",
32+
"next": "^14.2.1",
3133
"nodemon": "^2.0.6",
3234
"ts-node": "^9.1.1",
33-
"typescript": "^4.8.4"
35+
"typescript": "^5.4.2"
3436
}
35-
}
37+
}

dev/src/app/(app)/globals.scss

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
html,
2+
body {
3+
font-family: 'Roboto', 'Inter', sans-serif;
4+
}
5+
6+
.container {
7+
max-width: 37.5rem;
8+
padding: 0 2rem;
9+
margin-left: auto;
10+
margin-right: auto;
11+
}
12+
13+
h1 {
14+
font-size: 4rem;
15+
}
16+
17+
.rainbow {
18+
font-family: monospace;
19+
letter-spacing: 5px;
20+
background: linear-gradient(to right, #6666ff, #0099ff, #00ff00, #ff3399, #6666ff);
21+
-webkit-background-clip: text;
22+
background-clip: text;
23+
color: transparent;
24+
animation: rainbow_animation 6s ease-in-out infinite;
25+
background-size: 400% 100%;
26+
}
27+
28+
@keyframes rainbow_animation {
29+
0%,
30+
100% {
31+
background-position: 0 0;
32+
}
33+
34+
50% {
35+
background-position: 100% 0;
36+
}
37+
}

dev/src/app/(app)/layout.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from 'react'
2+
import './globals.scss'
3+
4+
/* Our app sits here to not cause any conflicts with payload's root layout */
5+
const Layout: React.FC<{ children: React.ReactNode }> = ({ children }) => {
6+
return (
7+
<html>
8+
<body>
9+
<main>{children}</main>
10+
</body>
11+
</html>
12+
)
13+
}
14+
15+
export default Layout

dev/src/app/(app)/page.tsx

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import Example from '@/components/Example'
2+
import Link from 'next/link'
3+
import React from 'react'
4+
5+
const Page = () => {
6+
return (
7+
<article className={['container'].filter(Boolean).join(' ')}>
8+
<h1>
9+
Payload 3.0 <span className="rainbow">BETA</span>!
10+
</h1>
11+
<p>
12+
This BETA is rapidly evolving, you can report any bugs against{' '}
13+
<a href="https://github.com/payloadcms/payload-3.0-demo/issues" target="_blank">
14+
the repo
15+
</a>{' '}
16+
or in the{' '}
17+
<a
18+
href="https://discord.com/channels/967097582721572934/1215659716538273832"
19+
target="_blank"
20+
>
21+
dedicated channel in Discord
22+
</a>
23+
.
24+
</p>
25+
26+
<p>
27+
<strong>
28+
Payload is running at <Link href="/admin">/admin</Link>
29+
</strong>
30+
</p>
31+
32+
<p>
33+
<Link href="/my-route" target="_blank">
34+
/my-route
35+
</Link>{' '}
36+
contains an example of a custom route running the Local API.
37+
</p>
38+
39+
<Example />
40+
41+
<p>You can use the Local API in your server components like this:</p>
42+
<pre>
43+
<code>
44+
{`import { getPayload } from 'payload'
45+
import configPromise from "@payload-config";
46+
const payload = await getPayload({ config: configPromise })
47+
48+
const data = await payload.find({
49+
collection: 'posts',
50+
})`}
51+
</code>
52+
</pre>
53+
</article>
54+
)
55+
}
56+
57+
export default Page
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
2+
import type { Metadata } from 'next'
3+
4+
import config from '@payload-config'
5+
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
6+
import { NotFoundPage, generatePageMetadata } from '@payloadcms/next/views'
7+
8+
type Args = {
9+
params: {
10+
segments: string[]
11+
}
12+
searchParams: {
13+
[key: string]: string | string[]
14+
}
15+
}
16+
17+
export const generateMetadata = ({ params, searchParams }: Args): Promise<Metadata> =>
18+
generatePageMetadata({ config, params, searchParams })
19+
20+
const NotFound = ({ params, searchParams }: Args) => NotFoundPage({ config, params, searchParams })
21+
22+
export default NotFound
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
2+
import config from '@payload-config'
3+
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
4+
import { RootPage } from '@payloadcms/next/views'
5+
6+
type Args = {
7+
params: {
8+
segments: string[]
9+
}
10+
searchParams: {
11+
[key: string]: string | string[]
12+
}
13+
}
14+
15+
const Page = ({ params, searchParams }: Args) => RootPage({ config, params, searchParams })
16+
17+
export default Page
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
2+
/* DO NOT MODIFY it because it could be re-written at any time. */
3+
import config from '@payload-config'
4+
import { REST_DELETE, REST_GET, REST_PATCH, REST_POST } from '@payloadcms/next/routes'
5+
6+
export const GET = REST_GET(config)
7+
export const POST = REST_POST(config)
8+
export const DELETE = REST_DELETE(config)
9+
export const PATCH = REST_PATCH(config)

0 commit comments

Comments
 (0)