Update payload to 2.18.3
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
tobias 2024-05-27 11:24:42 +02:00
parent d62e7d788e
commit f37a1719b7
5 changed files with 2680 additions and 1712 deletions

View File

@ -14,10 +14,14 @@
"generate:types:listen": "nodemon --watch src --ext ts --exec 'npm run generate:types'" "generate:types:listen": "nodemon --watch src --ext ts --exec 'npm run generate:types'"
}, },
"dependencies": { "dependencies": {
"@payloadcms/bundler-webpack": "^1.0.6",
"@payloadcms/db-mongodb": "^1.5.1",
"@payloadcms/plugin-cloud": "^3.0.1",
"@payloadcms/richtext-slate": "^1.5.2",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"dotenv": "^16.3.1", "dotenv": "^16.3.1",
"express": "^4.17.1", "express": "^4.17.1",
"payload": "^1.15.6", "payload": "^2.18.3",
"tsconfig-paths": "^4.2.0" "tsconfig-paths": "^4.2.0"
}, },
"devDependencies": { "devDependencies": {

View File

@ -3,6 +3,7 @@ import { isAdmin } from "@/access/isAdmin";
import { isEditor } from "@/access/isEditor"; import { isEditor } from "@/access/isEditor";
import { isSSG } from "@/access/isSSG"; import { isSSG } from "@/access/isSSG";
import { isUser } from "@/access/isUser"; import { isUser } from "@/access/isUser";
import { slateEditor } from '@payloadcms/richtext-slate'
const Posts: CollectionConfig = { const Posts: CollectionConfig = {
slug: "posts", slug: "posts",
@ -68,26 +69,28 @@ const Posts: CollectionConfig = {
required: true, required: true,
}, },
{ {
name: "content", name: 'content',
type: "richText", type: 'richText',
admin: { editor: slateEditor({
elements: ["h2", "h3", "h4", "link", "ol", "ul", "upload", "blockquote", "indent"], admin: {
leaves: ["bold", "italic", "underline"], elements: ["h2", "h3", "h4", "link", "ol", "ul", "upload", "blockquote", "indent"],
upload: { leaves: ["bold", "italic", "underline", "strikethrough"],
collections: { upload: {
media: { collections: {
fields: [ media: {
{ fields: [
name: "image", {
type: "upload", name: "image",
relationTo: "media", type: "upload",
required: true, relationTo: "media",
}, required: true,
], },
],
},
}, },
}, },
}, },
}, })
}, },
{ {
name: "author", name: "author",

View File

@ -5,10 +5,16 @@ import Users from "@/collections/Users";
import Authors from "./collections/Authors"; import Authors from "./collections/Authors";
import Media from "@/collections/Media"; import Media from "@/collections/Media";
import { payloadCloud } from '@payloadcms/plugin-cloud'
import { mongooseAdapter } from '@payloadcms/db-mongodb'
import { webpackBundler } from '@payloadcms/bundler-webpack'
import { slateEditor } from '@payloadcms/richtext-slate'
export default buildConfig({ export default buildConfig({
serverURL: process.env.PAYLOAD_URL, serverURL: process.env.PAYLOAD_URL,
admin: { admin: {
user: Users.slug, user: Users.slug,
bundler: webpackBundler(),
webpack: (config) => ({ webpack: (config) => ({
...config, ...config,
resolve: { resolve: {
@ -24,4 +30,9 @@ export default buildConfig({
typescript: { typescript: {
outputFile: path.resolve("../", "payload-types.ts"), outputFile: path.resolve("../", "payload-types.ts"),
}, },
}); plugins: [payloadCloud()],
editor: slateEditor({}),
db: mongooseAdapter({
url: process.env.MONGODB_URI,
}),
});

View File

@ -10,7 +10,7 @@ app.get("/", (_, res) => {
payload.init({ payload.init({
secret: process.env.PAYLOAD_SECRET, secret: process.env.PAYLOAD_SECRET,
mongoURL: process.env.MONGODB_URI, //mongoURL: process.env.MONGODB_URI,
express: app, express: app,
onInit: () => { onInit: () => {
payload.logger.info(`Payload Admin URL: ${payload.getAdminURL()}`); payload.logger.info(`Payload Admin URL: ${payload.getAdminURL()}`);

File diff suppressed because it is too large Load Diff