chore: esm fixes in _community test dir

This commit is contained in:
Jarrod Flesch
2024-03-07 12:03:02 -05:00
parent 42eed07dfd
commit 5e368f486a
3 changed files with 120 additions and 117 deletions

View File

@@ -1,6 +1,6 @@
import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types' import type { CollectionConfig } from '../../../../packages/payload/src/collections/config/types.d.ts'
import { mediaSlug } from '../Media' import { mediaSlug } from '../Media/index.js'
export const postsSlug = 'posts' export const postsSlug = 'posts'
@@ -8,6 +8,9 @@ export const PostsCollection: CollectionConfig = {
admin: { admin: {
useAsTitle: 'text', useAsTitle: 'text',
}, },
versions: {
drafts: true,
},
fields: [ fields: [
{ {
name: 'text', name: 'text',

View File

@@ -1,11 +1,11 @@
import path from 'path' import path from 'path'
import getFileByPath from '../../packages/payload/src/uploads/getFileByPath' import getFileByPath from '../../packages/payload/src/uploads/getFileByPath.js'
import { buildConfigWithDefaults } from '../buildConfigWithDefaults' import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
import { devUser } from '../credentials' import { devUser } from '../credentials.js'
import { MediaCollection } from './collections/Media' import { MediaCollection } from './collections/Media/index.js'
import { PostsCollection, postsSlug } from './collections/Posts' import { PostsCollection, postsSlug } from './collections/Posts/index.js'
import { MenuGlobal } from './globals/Menu' import { MenuGlobal } from './globals/Menu/index.js'
export default buildConfigWithDefaults({ export default buildConfigWithDefaults({
// ...extend config here // ...extend config here

View File

@@ -6,30 +6,30 @@ import type { Config, SanitizedConfig } from '../packages/payload/src/config/typ
import { mongooseAdapter } from '../packages/db-mongodb/src/index.js' import { mongooseAdapter } from '../packages/db-mongodb/src/index.js'
import { postgresAdapter } from '../packages/db-postgres/src/index.js' import { postgresAdapter } from '../packages/db-postgres/src/index.js'
import { buildConfig as buildPayloadConfig } from '../packages/payload/src/config/build.js' import { buildConfig as buildPayloadConfig } from '../packages/payload/src/config/build.js'
// import { import {
// AlignFeature, AlignFeature,
// BlockQuoteFeature, BlockQuoteFeature,
// BlocksFeature, BlocksFeature,
// BoldFeature, BoldFeature,
// CheckListFeature, CheckListFeature,
// HeadingFeature, HeadingFeature,
// IndentFeature, IndentFeature,
// InlineCodeFeature, InlineCodeFeature,
// ItalicFeature, ItalicFeature,
// LinkFeature, LinkFeature,
// OrderedListFeature, OrderedListFeature,
// ParagraphFeature, ParagraphFeature,
// RelationshipFeature, RelationshipFeature,
// StrikethroughFeature, StrikethroughFeature,
// SubscriptFeature, SubscriptFeature,
// SuperscriptFeature, SuperscriptFeature,
// TreeViewFeature, TreeViewFeature,
// UnderlineFeature, UnderlineFeature,
// UnorderedListFeature, UnorderedListFeature,
// UploadFeature, UploadFeature,
// lexicalEditor, lexicalEditor,
// } from '../packages/richtext-lexical/src' } from '../packages/richtext-lexical/src/index.js'
import { slateEditor } from '../packages/richtext-slate/src/index.js' // import { slateEditor } from '../packages/richtext-slate/src/index.js'
import { CustomDashboard } from './CustomDashboard.js' import { CustomDashboard } from './CustomDashboard.js'
// process.env.PAYLOAD_DATABASE = 'postgres' // process.env.PAYLOAD_DATABASE = 'postgres'
@@ -74,42 +74,9 @@ export function buildConfigWithDefaults(testConfig?: Partial<Config>): Promise<S
}, },
}, },
}, },
editor: slateEditor({ // editor: slateEditor({
admin: { // admin: {
upload: { // upload: {
collections: {
media: {
fields: [
{
name: 'alt',
type: 'text',
},
],
},
},
},
},
}),
// editor: lexicalEditor({
// features: [
// ParagraphFeature(),
// RelationshipFeature(),
// LinkFeature({
// fields: [
// {
// name: 'description',
// type: 'text',
// },
// ],
// }),
// CheckListFeature(),
// UnorderedListFeature(),
// OrderedListFeature(),
// AlignFeature(),
// BlockQuoteFeature(),
// BoldFeature(),
// ItalicFeature(),
// UploadFeature({
// collections: { // collections: {
// media: { // media: {
// fields: [ // fields: [
@@ -120,56 +87,89 @@ export function buildConfigWithDefaults(testConfig?: Partial<Config>): Promise<S
// ], // ],
// }, // },
// }, // },
// }), // },
// UnderlineFeature(), // },
// StrikethroughFeature(),
// SubscriptFeature(),
// SuperscriptFeature(),
// InlineCodeFeature(),
// TreeViewFeature(),
// HeadingFeature(),
// IndentFeature(),
// BlocksFeature({
// blocks: [
// {
// slug: 'myBlock',
// fields: [
// {
// name: 'someText',
// type: 'text',
// },
// {
// name: 'someTextRequired',
// type: 'text',
// required: true,
// },
// {
// name: 'radios',
// type: 'radio',
// options: [
// {
// label: 'Option 1',
// value: 'option1',
// },
// {
// label: 'Option 2',
// value: 'option2',
// },
// {
// label: 'Option 3',
// value: 'option3',
// },
// ],
// validate: (value) => {
// return value !== 'option2' ? true : 'Cannot be option2'
// },
// },
// ],
// },
// ],
// }),
// ],
// }), // }),
editor: lexicalEditor({
features: [
ParagraphFeature(),
RelationshipFeature(),
LinkFeature({
fields: [
{
name: 'description',
type: 'text',
},
],
}),
CheckListFeature(),
UnorderedListFeature(),
OrderedListFeature(),
AlignFeature(),
BlockQuoteFeature(),
BoldFeature(),
ItalicFeature(),
UploadFeature({
collections: {
media: {
fields: [
{
name: 'alt',
type: 'text',
},
],
},
},
}),
UnderlineFeature(),
StrikethroughFeature(),
SubscriptFeature(),
SuperscriptFeature(),
InlineCodeFeature(),
TreeViewFeature(),
HeadingFeature(),
IndentFeature(),
BlocksFeature({
blocks: [
{
slug: 'myBlock',
fields: [
{
name: 'someText',
type: 'text',
},
{
name: 'someTextRequired',
type: 'text',
required: true,
},
{
name: 'radios',
type: 'radio',
options: [
{
label: 'Option 1',
value: 'option1',
},
{
label: 'Option 2',
value: 'option2',
},
{
label: 'Option 3',
value: 'option3',
},
],
validate: (value) => {
return value !== 'option2' ? true : 'Cannot be option2'
},
},
],
},
],
}),
],
}),
sharp, sharp,
telemetry: false, telemetry: false,
...testConfig, ...testConfig,