Files
payloadcms/test/folders/config.ts
Jarrod Flesch 9581092995 feat(ui): use document drawers for folder edit/create (#12676)
This PR re-uses the document drawers for editing and creating folders.
This allows us to easily render document fields that are added inside
`collectionOverrides` on the folder config.

Not much changed, the folder drawer UI now resembles what you would
expect when you create a document in payload. It is a bit slimmed back
but generally very similar.
2025-06-04 16:52:49 -04:00

58 lines
1.4 KiB
TypeScript

import { fileURLToPath } from 'node:url'
import path from 'path'
const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)
import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
import { devUser } from '../credentials.js'
import { Autosave } from './collections/Autosave/index.js'
import { Drafts } from './collections/Drafts/index.js'
import { Media } from './collections/Media/index.js'
import { OmittedFromBrowseBy } from './collections/OmittedFromBrowseBy/index.js'
import { Posts } from './collections/Posts/index.js'
// import { seed } from './seed/index.js'
export default buildConfigWithDefaults({
admin: {
importMap: {
baseDir: path.resolve(dirname),
},
},
folders: {
// debug: true,
collectionOverrides: [
({ collection }) => {
collection.fields.push({
name: 'folderSlug',
type: 'text',
})
return collection
},
],
},
collections: [Posts, Media, Drafts, Autosave, OmittedFromBrowseBy],
globals: [
{
slug: 'global',
fields: [
{
name: 'title',
type: 'text',
},
],
},
],
onInit: async (payload) => {
await payload.create({
collection: 'users',
data: {
email: devUser.email,
password: devUser.password,
},
})
// await seed(payload)
},
typescript: {
outputFile: path.resolve(dirname, 'payload-types.ts'),
},
})