Files
payload/test/plugins/config.ts
Elliot DeNolf 7309d474ee feat!: type auto-generation (#6657)
Types are now auto-generated by default.

You can opt-out of this behavior by setting:
```ts
buildConfig({
  // Rest of config
  typescript: {
    autoGenerate: false
  },
})
```
2024-06-10 13:42:44 -04:00

49 lines
1004 B
TypeScript

import { fileURLToPath } from 'node:url'
import path from 'path'
import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
import { devUser } from '../credentials.js'
const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)
export const pagesSlug = 'pages'
export default buildConfigWithDefaults({
collections: [
{
slug: 'users',
auth: true,
fields: [],
},
],
plugins: [
(config) => ({
...config,
collections: [
...(config.collections || []),
{
slug: pagesSlug,
fields: [
{
name: 'title',
type: 'text',
},
],
},
],
}),
],
onInit: async (payload) => {
await payload.create({
collection: 'users',
data: {
email: devUser.email,
password: devUser.password,
},
})
},
typescript: {
outputFile: path.resolve(dirname, 'payload-types.ts'),
},
})