feat: match next.js env file loading behavior in bin scripts & importConfig, clean up installed packages & mismatching package versions (#6601)

This commit is contained in:
Alessio Gravili
2024-06-03 17:23:05 -04:00
committed by GitHub
parent 1aece399f7
commit 59cde0dbb3
33 changed files with 503 additions and 939 deletions

View File

@@ -1,5 +1,6 @@
import type { Payload } from 'payload'
import { fileURLToPath } from 'node:url'
import path from 'path'
import { getFileByPath } from 'payload/uploads'
import { mapAsync } from 'payload/utilities'
@@ -16,6 +17,9 @@ const title = 'title'
let restClient: NextRESTClient
let payload: Payload
const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)
describe('collections-graphql', () => {
beforeAll(async () => {
;({ payload, restClient } = await initPayloadInt(config))
@@ -1077,7 +1081,7 @@ describe('collections-graphql', () => {
})
it('should query upload enabled docs', async () => {
const file = await getFileByPath(path.resolve(__dirname, '../uploads/test-image.jpg'))
const file = await getFileByPath(path.resolve(dirname, '../uploads/test-image.jpg'))
const mediaDoc = await payload.create({
collection: 'media',

View File

@@ -30,7 +30,7 @@ describe('create-payload-app', () => {
const projectDir = tempy.directory()
beforeEach(async () => {
if (fs.existsSync(projectDir)) {
fs.rmdirSync(projectDir, { recursive: true })
fs.rmSync(projectDir, { recursive: true })
}
// Create dir for Next.js project
@@ -57,7 +57,7 @@ describe('create-payload-app', () => {
afterEach(() => {
if (fs.existsSync(projectDir)) {
fs.rmdirSync(projectDir, { recursive: true })
fs.rmSync(projectDir, { recursive: true })
}
})

View File

@@ -575,6 +575,14 @@ describe('lexicalBlocks', () => {
// reload page and assert again
await page.reload()
await wait(300)
await newSubLexicalAndUploadBlock.scrollIntoViewIfNeeded()
await expect(newSubLexicalAndUploadBlock).toBeVisible()
await newSubLexicalAndUploadBlock
.locator('.field-type.upload .file-meta__url a')
.scrollIntoViewIfNeeded()
await expect(
newSubLexicalAndUploadBlock.locator('.field-type.upload .file-meta__url a'),
).toBeVisible()
await expect(
newSubLexicalAndUploadBlock.locator('.field-type.upload .file-meta__url a'),

View File

@@ -42,19 +42,22 @@
"@payloadcms/storage-vercel-blob": "workspace:*",
"@payloadcms/translations": "workspace:*",
"@payloadcms/ui": "workspace:*",
"@sentry/react": "^7.77.0",
"@types/react": "npm:types-react@19.0.0-beta.2",
"@types/react-dom": "npm:types-react-dom@19.0.0-beta.2",
"babel-plugin-react-compiler": "0.0.0-experimental-592953e-20240517",
"comment-json": "^4.2.3",
"create-payload-app": "workspace:*",
"dotenv": "8.6.0",
"dotenv": "16.4.5",
"eslint-plugin-payload": "workspace:*",
"eslint-plugin-playwright": "1.5.3",
"execa": "5.1.1",
"http-status": "1.6.2",
"jwt-decode": "4.0.0",
"lexical": "0.15.0",
"payload": "workspace:*",
"server-only": "^0.0.1",
"slate": "0.91.4",
"tempy": "^1.0.1",
"ts-essentials": "7.0.3",
"typescript": "5.4.5",

View File

@@ -1,5 +1,8 @@
import { relationshipsAsObjectID } from '@payloadcms/plugin-relationship-object-ids'
import path from 'path'
const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)
import { fileURLToPath } from 'node:url'
import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js'
@@ -99,7 +102,7 @@ export default buildConfigWithDefaults({
const upload = await payload.create({
collection: 'uploads',
data: {},
filePath: path.resolve(__dirname, './payload-logo.png'),
filePath: path.resolve(dirname, './payload-logo.png'),
})
await payload.create({