- Generate initial Payload CMS migration (all collections + globals) - Add sharp for image resizing support - Add .ts extensions to payload.config.ts imports (required for migrate:create with --disable-transpile) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
72 lines
2 KiB
TypeScript
72 lines
2 KiB
TypeScript
import path from 'path';
|
|
import { fileURLToPath } from 'url';
|
|
|
|
import { buildConfig } from 'payload';
|
|
import { postgresAdapter } from '@payloadcms/db-postgres';
|
|
import { lexicalEditor } from '@payloadcms/richtext-lexical';
|
|
import { formBuilderPlugin } from '@payloadcms/plugin-form-builder';
|
|
|
|
// Collections — .ts extensions required for tsx ESM resolution (migrate:create)
|
|
import { Users } from './payload/collections/Users.ts';
|
|
import { Media } from './payload/collections/Media.ts';
|
|
import { Services } from './payload/collections/Services.ts';
|
|
import { Categories } from './payload/collections/Categories.ts';
|
|
import { Posts } from './payload/collections/Posts.ts';
|
|
import { TeamMembers } from './payload/collections/TeamMembers.ts';
|
|
import { Testimonials } from './payload/collections/Testimonials.ts';
|
|
import { FAQs } from './payload/collections/FAQs.ts';
|
|
|
|
// Globals
|
|
import { Navigation } from './payload/globals/Navigation.ts';
|
|
import { Footer } from './payload/globals/Footer.ts';
|
|
import { SiteSettings } from './payload/globals/SiteSettings.ts';
|
|
|
|
const filename = fileURLToPath(import.meta.url);
|
|
const dirname = path.dirname(filename);
|
|
|
|
export default buildConfig({
|
|
serverURL: process.env.NEXT_PUBLIC_SITE_URL || 'http://localhost:3000',
|
|
|
|
secret: process.env.PAYLOAD_SECRET || 'dev-secret-change-in-production',
|
|
|
|
admin: {
|
|
user: 'users',
|
|
meta: {
|
|
titleSuffix: '— Axil Accountants CMS',
|
|
},
|
|
},
|
|
|
|
editor: lexicalEditor(),
|
|
|
|
db: postgresAdapter({
|
|
pool: {
|
|
connectionString: process.env.DATABASE_URI,
|
|
},
|
|
}),
|
|
|
|
collections: [Users, Media, Services, Categories, Posts, TeamMembers, Testimonials, FAQs],
|
|
|
|
globals: [Navigation, Footer, SiteSettings],
|
|
|
|
upload: {
|
|
limits: {
|
|
fileSize: 10_000_000, // 10MB
|
|
},
|
|
},
|
|
|
|
plugins: [
|
|
formBuilderPlugin({
|
|
fields: {
|
|
text: true,
|
|
email: true,
|
|
select: true,
|
|
checkbox: true,
|
|
textarea: true,
|
|
},
|
|
}),
|
|
],
|
|
|
|
typescript: {
|
|
outputFile: path.resolve(dirname, 'payload-types.ts'),
|
|
},
|
|
});
|