chore: lint

This commit is contained in:
James 2024-03-08 15:22:02 -05:00
parent cd9ff7703e
commit 40d360127a

View File

@ -1,55 +1,64 @@
import path from "path"; import path from "path";
// import { postgresAdapter } from '@payloadcms/db-postgres' // import { postgresAdapter } from '@payloadcms/db-postgres'
import { import {
AlignFeature, BlockQuoteFeature, AlignFeature,
BlocksFeature, BoldFeature, CheckListFeature, HeadingFeature, IndentFeature, InlineCodeFeature, ItalicFeature, BlockQuoteFeature,
BlocksFeature,
BoldFeature,
CheckListFeature,
HeadingFeature,
IndentFeature,
InlineCodeFeature,
ItalicFeature,
lexicalEditor, lexicalEditor,
LinkFeature, OrderedListFeature, LinkFeature,
OrderedListFeature,
ParagraphFeature, ParagraphFeature,
RelationshipFeature, UnorderedListFeature, RelationshipFeature,
UnorderedListFeature,
UploadFeature, UploadFeature,
} from '@payloadcms/richtext-lexical' } from "@payloadcms/richtext-lexical";
//import { slateEditor } from '@payloadcms/richtext-slate' //import { slateEditor } from '@payloadcms/richtext-slate'
import { mongooseAdapter } from "@payloadcms/db-mongodb"; import { mongooseAdapter } from "@payloadcms/db-mongodb";
import { buildConfig } from "payload/config"; import { buildConfig } from "payload/config";
import sharp from 'sharp' import sharp from "sharp";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
const filename = fileURLToPath(import.meta.url) const filename = fileURLToPath(import.meta.url);
const dirname = path.dirname(filename) const dirname = path.dirname(filename);
export default buildConfig({ export default buildConfig({
//editor: slateEditor({}), //editor: slateEditor({}),
editor: lexicalEditor(), editor: lexicalEditor(),
collections: [ collections: [
{ {
slug: 'pages', slug: "pages",
admin: { admin: {
useAsTitle: 'title', useAsTitle: "title",
}, },
fields: [ fields: [
{ {
name: 'title', name: "title",
type: 'text', type: "text",
}, },
{ {
name: 'content', name: "content",
type: 'richText', type: "richText",
} },
] ],
}, },
{ {
slug: 'media', slug: "media",
upload: true, upload: true,
fields: [ fields: [
{ {
name: 'text', name: "text",
type: 'text', type: "text",
} },
] ],
} },
], ],
secret: process.env.PAYLOAD_SECRET || '', secret: process.env.PAYLOAD_SECRET || "",
typescript: { typescript: {
outputFile: path.resolve(dirname, "payload-types.ts"), outputFile: path.resolve(dirname, "payload-types.ts"),
}, },
@ -59,33 +68,33 @@ export default buildConfig({
// } // }
// }), // }),
db: mongooseAdapter({ db: mongooseAdapter({
url: process.env.MONGODB_URI || '', url: process.env.MONGODB_URI || "",
}), }),
admin: { admin: {
autoLogin: { autoLogin: {
email: 'dev@payloadcms.com', email: "dev@payloadcms.com",
password: 'test', password: "test",
prefillOnly: true, prefillOnly: true,
} },
}, },
async onInit(payload) { async onInit(payload) {
const existingUsers = await payload.find({ const existingUsers = await payload.find({
collection: 'users', collection: "users",
limit: 1, limit: 1,
}) });
if (existingUsers.docs.length === 0) { if (existingUsers.docs.length === 0) {
await payload.create({ await payload.create({
collection: 'users', collection: "users",
data: { data: {
email: 'dev@payloadcms.com', email: "dev@payloadcms.com",
password: 'test', password: "test",
} },
}) });
} }
}, },
// Sharp is now an optional dependency - // Sharp is now an optional dependency -
// if you want to resize images, crop, set focal point, etc. // if you want to resize images, crop, set focal point, etc.
// make sure to install it and pass it to the config. // make sure to install it and pass it to the config.
// This is temporary - we may make an adapter pattern // This is temporary - we may make an adapter pattern