Move payload-types dir

This commit is contained in:
tobias
2024-06-23 10:31:42 +02:00
parent e002125805
commit ace6e50b73
4 changed files with 26 additions and 184 deletions

View File

@ -1,5 +1,4 @@
import path from 'path'
// import { postgresAdapter } from '@payloadcms/db-postgres'
import { en } from 'payload/i18n/en'
import {
AlignFeature,
@ -19,28 +18,33 @@ import {
UnorderedListFeature,
UploadFeature,
} from '@payloadcms/richtext-lexical'
//import { slateEditor } from '@payloadcms/richtext-slate'
import { mongooseAdapter } from '@payloadcms/db-mongodb'
import { buildConfig } from 'payload/config'
import sharp from 'sharp'
import { fileURLToPath } from 'url'
import Media from '@payload/collections/Media'
import Authors from '@payload/collections/Authors'
import Posts from '@payload/collections/Posts'
import Users from '@payload/collections/Users'
const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)
export default buildConfig({
//editor: slateEditor({}),
admin: {
autoLogin: {
email: 'dev@payloadcms.com',
password: 'test',
prefillOnly: true,
},
},
editor: lexicalEditor(),
collections: [
{
slug: 'users',
auth: true,
access: {
delete: () => false,
update: () => false,
},
fields: [],
},
Users,
Posts,
Authors,
Media,
{
slug: 'pages',
admin: {
@ -57,45 +61,14 @@ export default buildConfig({
},
],
},
{
slug: 'media',
upload: true,
fields: [
{
name: 'text',
type: 'text',
},
],
},
],
secret: process.env.PAYLOAD_SECRET || '',
typescript: {
outputFile: path.resolve(dirname, 'payload-types.ts'),
outputFile: path.resolve(dirname, 'types/payload-types.ts'),
},
// db: postgresAdapter({
// pool: {
// connectionString: process.env.POSTGRES_URI || ''
// }
// }),
db: mongooseAdapter({
url: process.env.MONGODB_URI || '',
}),
/**
* Payload can now accept specific translations from 'payload/i18n/en'
* This is completely optional and will default to English if not provided
*/
i18n: {
supportedLanguages: { en },
},
admin: {
autoLogin: {
email: 'dev@payloadcms.com',
password: 'test',
prefillOnly: true,
},
},
async onInit(payload) {
const existingUsers = await payload.find({
collection: 'users',