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'
@@ -8,6 +8,9 @@ export const PostsCollection: CollectionConfig = {
admin: {
useAsTitle: 'text',
},
versions: {
drafts: true,
},
fields: [
{
name: 'text',

View File

@@ -1,11 +1,11 @@
import path from 'path'
import getFileByPath from '../../packages/payload/src/uploads/getFileByPath'
import { buildConfigWithDefaults } from '../buildConfigWithDefaults'
import { devUser } from '../credentials'
import { MediaCollection } from './collections/Media'
import { PostsCollection, postsSlug } from './collections/Posts'
import { MenuGlobal } from './globals/Menu'
import getFileByPath from '../../packages/payload/src/uploads/getFileByPath.js'
import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
import { devUser } from '../credentials.js'
import { MediaCollection } from './collections/Media/index.js'
import { PostsCollection, postsSlug } from './collections/Posts/index.js'
import { MenuGlobal } from './globals/Menu/index.js'
export default buildConfigWithDefaults({
// ...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 { postgresAdapter } from '../packages/db-postgres/src/index.js'
import { buildConfig as buildPayloadConfig } from '../packages/payload/src/config/build.js'
// import {
// AlignFeature,
// BlockQuoteFeature,
// BlocksFeature,
// BoldFeature,
// CheckListFeature,
// HeadingFeature,
// IndentFeature,
// InlineCodeFeature,
// ItalicFeature,
// LinkFeature,
// OrderedListFeature,
// ParagraphFeature,
// RelationshipFeature,
// StrikethroughFeature,
// SubscriptFeature,
// SuperscriptFeature,
// TreeViewFeature,
// UnderlineFeature,
// UnorderedListFeature,
// UploadFeature,
// lexicalEditor,
// } from '../packages/richtext-lexical/src'
import { slateEditor } from '../packages/richtext-slate/src/index.js'
import {
AlignFeature,
BlockQuoteFeature,
BlocksFeature,
BoldFeature,
CheckListFeature,
HeadingFeature,
IndentFeature,
InlineCodeFeature,
ItalicFeature,
LinkFeature,
OrderedListFeature,
ParagraphFeature,
RelationshipFeature,
StrikethroughFeature,
SubscriptFeature,
SuperscriptFeature,
TreeViewFeature,
UnderlineFeature,
UnorderedListFeature,
UploadFeature,
lexicalEditor,
} from '../packages/richtext-lexical/src/index.js'
// import { slateEditor } from '../packages/richtext-slate/src/index.js'
import { CustomDashboard } from './CustomDashboard.js'
// process.env.PAYLOAD_DATABASE = 'postgres'
@@ -74,42 +74,9 @@ export function buildConfigWithDefaults(testConfig?: Partial<Config>): Promise<S
},
},
},
editor: slateEditor({
admin: {
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({
// editor: slateEditor({
// admin: {
// upload: {
// collections: {
// media: {
// 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,
telemetry: false,
...testConfig,