### What? Migrates the `form-builder` example to payload `3.0`. `Updates`: - Now has a next app directly along side payload. - Removes `form-builder/next-app` & `form-builder/next-pages` example front-ends and only uses new recommended approach (i.e admin panel & front-end on the same port - `3000`)
68 lines
1.7 KiB
TypeScript
68 lines
1.7 KiB
TypeScript
import { mongooseAdapter } from '@payloadcms/db-mongodb'
|
|
import { formBuilderPlugin } from '@payloadcms/plugin-form-builder'
|
|
import {
|
|
BoldFeature,
|
|
FixedToolbarFeature,
|
|
HeadingFeature,
|
|
InlineToolbarFeature,
|
|
ItalicFeature,
|
|
lexicalEditor,
|
|
LinkFeature,
|
|
} from '@payloadcms/richtext-lexical'
|
|
import path from 'path'
|
|
import { buildConfig } from 'payload'
|
|
import { fileURLToPath } from 'url'
|
|
|
|
import { Pages } from './collections/Pages'
|
|
import { Users } from './collections/Users'
|
|
import { MainMenu } from './globals/MainMenu'
|
|
|
|
const filename = fileURLToPath(import.meta.url)
|
|
const dirname = path.dirname(filename)
|
|
|
|
// eslint-disable-next-line no-restricted-exports
|
|
export default buildConfig({
|
|
admin: {
|
|
importMap: {
|
|
baseDir: path.resolve(dirname),
|
|
},
|
|
user: Users.slug,
|
|
},
|
|
collections: [Pages, Users],
|
|
// We need to set CORS rules pointing to our hosted domains for the frontend to be able to submit to our API
|
|
cors: [process.env.NEXT_PUBLIC_PAYLOAD_URL || ''],
|
|
db: mongooseAdapter({
|
|
url: process.env.DATABASE_URI || '',
|
|
}),
|
|
editor: lexicalEditor({
|
|
features: () => {
|
|
return [
|
|
BoldFeature(),
|
|
ItalicFeature(),
|
|
LinkFeature({ enabledCollections: ['pages'] }),
|
|
HeadingFeature({ enabledHeadingSizes: ['h1', 'h2', 'h3'] }),
|
|
FixedToolbarFeature(),
|
|
InlineToolbarFeature(),
|
|
]
|
|
},
|
|
}),
|
|
globals: [MainMenu],
|
|
graphQL: {
|
|
schemaOutputFile: path.resolve(dirname, 'generated-schema.graphql'),
|
|
},
|
|
plugins: [
|
|
formBuilderPlugin({
|
|
fields: {
|
|
payment: false,
|
|
},
|
|
formOverrides: {
|
|
fields: undefined,
|
|
},
|
|
}),
|
|
],
|
|
secret: process.env.PAYLOAD_SECRET || '',
|
|
typescript: {
|
|
outputFile: path.resolve(dirname, 'payload-types.ts'),
|
|
},
|
|
})
|