chore: builds
This commit is contained in:
@@ -1,4 +0,0 @@
|
|||||||
DATABASE_URI=mongodb://127.0.0.1/payloadtests
|
|
||||||
PAYLOAD_SECRET=laijflieawfjlweifjewalifjwe
|
|
||||||
# PAYLOAD_CONFIG_PATH=MUST BE SET PROGRAMMATICALLY
|
|
||||||
PAYLOAD_DROP_DATABASE=true
|
|
||||||
@@ -6,6 +6,7 @@ const withBundleAnalyzer = bundleAnalyzer({
|
|||||||
enabled: process.env.ANALYZE === 'true',
|
enabled: process.env.ANALYZE === 'true',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-restricted-exports
|
||||||
export default withBundleAnalyzer(
|
export default withBundleAnalyzer(
|
||||||
withPayload({
|
withPayload({
|
||||||
reactStrictMode: false,
|
reactStrictMode: false,
|
||||||
|
|||||||
@@ -120,7 +120,7 @@
|
|||||||
"lint-staged": "^14.0.1",
|
"lint-staged": "^14.0.1",
|
||||||
"minimist": "1.2.8",
|
"minimist": "1.2.8",
|
||||||
"mongodb-memory-server": "8.13.0",
|
"mongodb-memory-server": "8.13.0",
|
||||||
"next": "14.1.2",
|
"next": "14.2.0-canary.21",
|
||||||
"node-mocks-http": "^1.14.1",
|
"node-mocks-http": "^1.14.1",
|
||||||
"nodemon": "3.0.3",
|
"nodemon": "3.0.3",
|
||||||
"pino": "8.15.0",
|
"pino": "8.15.0",
|
||||||
|
|||||||
@@ -1,20 +1,17 @@
|
|||||||
import type { CollectionPermission, GlobalPermission, User } from 'payload/auth'
|
import type { CollectionPermission, GlobalPermission, User } from 'payload/auth'
|
||||||
import type { EditViewComponent } from 'payload/config'
|
import type { EditViewComponent } from 'payload/config'
|
||||||
import type {
|
import type {
|
||||||
|
AdminViewComponent,
|
||||||
SanitizedCollectionConfig,
|
SanitizedCollectionConfig,
|
||||||
SanitizedConfig,
|
SanitizedConfig,
|
||||||
SanitizedGlobalConfig,
|
SanitizedGlobalConfig,
|
||||||
} from 'payload/types'
|
} from 'payload/types'
|
||||||
import type React from 'react'
|
|
||||||
|
|
||||||
import { isEntityHidden } from 'payload/utilities'
|
import { isEntityHidden } from 'payload/utilities'
|
||||||
|
|
||||||
import type { AdminViewProps } from '../Root/index.js'
|
|
||||||
|
|
||||||
import { APIView as DefaultAPIView } from '../API/index.js'
|
import { APIView as DefaultAPIView } from '../API/index.js'
|
||||||
import { EditView as DefaultEditView } from '../Edit/index.js'
|
import { EditView as DefaultEditView } from '../Edit/index.js'
|
||||||
import { LivePreviewView as DefaultLivePreviewView } from '../LivePreview/index.js'
|
import { LivePreviewView as DefaultLivePreviewView } from '../LivePreview/index.js'
|
||||||
import { NotFoundClient } from '../NotFound/index.client.js'
|
|
||||||
import { Unauthorized } from '../Unauthorized/index.js'
|
import { Unauthorized } from '../Unauthorized/index.js'
|
||||||
import { VersionView as DefaultVersionView } from '../Version/index.js'
|
import { VersionView as DefaultVersionView } from '../Version/index.js'
|
||||||
import { VersionsView as DefaultVersionsView } from '../Versions/index.js'
|
import { VersionsView as DefaultVersionsView } from '../Versions/index.js'
|
||||||
@@ -41,12 +38,12 @@ export const getViewsFromConfig = ({
|
|||||||
/**
|
/**
|
||||||
* The error view to display if CustomView or DefaultView do not exist (could be either due to not found, or unauthorized). Can be null
|
* The error view to display if CustomView or DefaultView do not exist (could be either due to not found, or unauthorized). Can be null
|
||||||
*/
|
*/
|
||||||
ErrorView: React.FC<AdminViewProps>
|
ErrorView: AdminViewComponent
|
||||||
} | null => {
|
} | null => {
|
||||||
// Conditionally import and lazy load the default view
|
// Conditionally import and lazy load the default view
|
||||||
let DefaultView: EditViewComponent = null
|
let DefaultView: EditViewComponent = null
|
||||||
let CustomView: EditViewComponent = null
|
let CustomView: EditViewComponent = null
|
||||||
let ErrorView: React.FC = null
|
let ErrorView: AdminViewComponent = null
|
||||||
|
|
||||||
const views =
|
const views =
|
||||||
(collectionConfig && collectionConfig?.admin?.components?.views) ||
|
(collectionConfig && collectionConfig?.admin?.components?.views) ||
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import {
|
|||||||
formatDocTitle,
|
formatDocTitle,
|
||||||
formatFields,
|
formatFields,
|
||||||
} from '@payloadcms/ui'
|
} from '@payloadcms/ui'
|
||||||
|
import { docAccessOperation } from 'payload/operations'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
import type { GenerateEditViewMetadata } from './getMetaBySegment.js'
|
import type { GenerateEditViewMetadata } from './getMetaBySegment.js'
|
||||||
@@ -72,7 +73,14 @@ export const Document: React.FC<AdminViewProps> = async ({
|
|||||||
let action: string
|
let action: string
|
||||||
|
|
||||||
if (collectionConfig) {
|
if (collectionConfig) {
|
||||||
docPermissions = permissions?.collections?.[collectionSlug]
|
docPermissions = await docAccessOperation({
|
||||||
|
id,
|
||||||
|
collection: {
|
||||||
|
config: collectionConfig,
|
||||||
|
},
|
||||||
|
req,
|
||||||
|
})
|
||||||
|
|
||||||
fields = collectionConfig.fields
|
fields = collectionConfig.fields
|
||||||
action = `${serverURL}${apiRoute}/${collectionSlug}${isEditing ? `/${id}` : ''}`
|
action = `${serverURL}${apiRoute}/${collectionSlug}${isEditing ? `/${id}` : ''}`
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,14 @@ const dirname = path.dirname(filename)
|
|||||||
|
|
||||||
const componentWebpackConfig = {
|
const componentWebpackConfig = {
|
||||||
entry: path.resolve(dirname, './src/index.ts'),
|
entry: path.resolve(dirname, './src/index.ts'),
|
||||||
externals: ['react', 'react-dom', 'payload', 'payload/config', 'react-image-crop'],
|
externals: [
|
||||||
|
'react',
|
||||||
|
'react-dom',
|
||||||
|
'payload',
|
||||||
|
'payload/config',
|
||||||
|
'react-image-crop',
|
||||||
|
'payload/operations',
|
||||||
|
],
|
||||||
mode: 'production',
|
mode: 'production',
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { Payload } from '../../../index.js'
|
|
||||||
import type { User } from '../../../auth/types.js'
|
import type { User } from '../../../auth/types.js'
|
||||||
|
import type { Payload } from '../../../index.js'
|
||||||
|
|
||||||
import { sendEvent } from '../index.js'
|
import { sendEvent } from '../index.js'
|
||||||
import { oneWayHash } from '../oneWayHash.js'
|
import { oneWayHash } from '../oneWayHash.js'
|
||||||
@@ -32,8 +32,8 @@ export const adminInit = ({ headers, payload, user }: Args): void => {
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
sendEvent({
|
sendEvent({
|
||||||
event: {
|
event: {
|
||||||
domainID,
|
|
||||||
type: 'admin-init',
|
type: 'admin-init',
|
||||||
|
domainID,
|
||||||
userID,
|
userID,
|
||||||
},
|
},
|
||||||
payload,
|
payload,
|
||||||
|
|||||||
@@ -10,7 +10,14 @@ const dirname = path.dirname(filename)
|
|||||||
|
|
||||||
const componentWebpackConfig = {
|
const componentWebpackConfig = {
|
||||||
entry: path.resolve(dirname, './src/index.ts'),
|
entry: path.resolve(dirname, './src/index.ts'),
|
||||||
externals: ['react', 'react-dom', 'payload', 'payload/config', 'react-image-crop'],
|
externals: [
|
||||||
|
'react',
|
||||||
|
'react-dom',
|
||||||
|
'payload',
|
||||||
|
'payload/config',
|
||||||
|
'react-image-crop',
|
||||||
|
'payload/operations',
|
||||||
|
],
|
||||||
mode: 'production',
|
mode: 'production',
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
|
|||||||
118
pnpm-lock.yaml
generated
118
pnpm-lock.yaml
generated
@@ -191,8 +191,8 @@ importers:
|
|||||||
specifier: 8.13.0
|
specifier: 8.13.0
|
||||||
version: 8.13.0
|
version: 8.13.0
|
||||||
next:
|
next:
|
||||||
specifier: 14.1.2
|
specifier: 14.2.0-canary.21
|
||||||
version: 14.1.2(@babel/core@7.24.0)(react-dom@18.2.0)(react@18.2.0)
|
version: 14.2.0-canary.21(@babel/core@7.24.0)(react-dom@18.2.0)(react@18.2.0)
|
||||||
node-mocks-http:
|
node-mocks-http:
|
||||||
specifier: ^1.14.1
|
specifier: ^1.14.1
|
||||||
version: 1.14.1
|
version: 1.14.1
|
||||||
@@ -1344,7 +1344,7 @@ importers:
|
|||||||
version: 2.3.0
|
version: 2.3.0
|
||||||
next:
|
next:
|
||||||
specifier: 14.2.0-canary.7
|
specifier: 14.2.0-canary.7
|
||||||
version: 14.2.0-canary.7(@babel/core@7.24.0)(react-dom@18.2.0)(react@18.2.0)
|
version: 14.2.0-canary.7(@babel/core@7.24.0)(react-dom@18.2.0)(react@18.2.0)(sass@1.71.1)
|
||||||
object-to-formdata:
|
object-to-formdata:
|
||||||
specifier: 4.5.1
|
specifier: 4.5.1
|
||||||
version: 4.5.1
|
version: 4.5.1
|
||||||
@@ -4421,8 +4421,8 @@ packages:
|
|||||||
- utf-8-validate
|
- utf-8-validate
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@next/env@14.1.2:
|
/@next/env@14.2.0-canary.21:
|
||||||
resolution: {integrity: sha512-U0iEG+JF86j6qyu330sfPgsMmDVH8vWVmzZadl+an5EU3o5HqdNytOpM+HsFpl58PmhGBTKx3UmM9c+eoLK0mA==}
|
resolution: {integrity: sha512-J1iLIGns8PUIwTD9EKm3sMWj3tvut872q/LlG80nUM97Pm3nxXGEtBaF102F1bPtaKnEQXSj5OW2WEGjm7Ol6Q==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@next/env@14.2.0-canary.7:
|
/@next/env@14.2.0-canary.7:
|
||||||
@@ -4435,8 +4435,8 @@ packages:
|
|||||||
glob: 10.3.10
|
glob: 10.3.10
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@next/swc-darwin-arm64@14.1.2:
|
/@next/swc-darwin-arm64@14.2.0-canary.21:
|
||||||
resolution: {integrity: sha512-E4/clgk0ZrYMo9eMRwP/4IO/cvXF1yEYSnGcdGfH+NYTR8bNFy76TSlc1Vb2rK3oaQY4BVHRpx8f/sMN/D5gNw==}
|
resolution: {integrity: sha512-XU0gVw9TReqFep1C6qPW7+ezcHvyAHd8YfEvGnMo6jzRQgYL3Opf02g48AUV1+mlKN43UiHn9VbFRCwBQqIpig==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [darwin]
|
os: [darwin]
|
||||||
@@ -4453,8 +4453,8 @@ packages:
|
|||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/@next/swc-darwin-x64@14.1.2:
|
/@next/swc-darwin-x64@14.2.0-canary.21:
|
||||||
resolution: {integrity: sha512-j8mEOI+ZM0tU9B/L/OGa6F7d9FXYMkog5OWWuhTWzz3iZ91UKIGGpD/ojTNKuejainDMgbqOBTNnLg0jZywM/g==}
|
resolution: {integrity: sha512-FXSyOIP+xmlb42rnOUoDO8cktKE+mFSpWGG2nxjZwPlnRFC9kVhw2b1Djt1gXhu524ts/bYnfPWvNbNfuNU8bg==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [darwin]
|
os: [darwin]
|
||||||
@@ -4471,8 +4471,8 @@ packages:
|
|||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/@next/swc-linux-arm64-gnu@14.1.2:
|
/@next/swc-linux-arm64-gnu@14.2.0-canary.21:
|
||||||
resolution: {integrity: sha512-qpRrd5hl6BFTWiFLgHtJmqqQGRMs+ol0MN9pEp0SYoLs3j8OTErPiDMhbKWjMWHGdc2E3kg4RRBV3cSTZiePiQ==}
|
resolution: {integrity: sha512-fGJxv3g7PlkkAlHP5ahDsQQKGRxggtZfPXuqtPDF3BNPm9Z6e4clyUyeOCD8HUlaB+3yg5mWt9lvR1t82BeqSA==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
@@ -4489,8 +4489,8 @@ packages:
|
|||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/@next/swc-linux-arm64-musl@14.1.2:
|
/@next/swc-linux-arm64-musl@14.2.0-canary.21:
|
||||||
resolution: {integrity: sha512-HAhvVXAv+wnbj0wztT0YnpgJVoHtw1Mv4Y1R/JJcg5yXSU8FsP2uEGUwjQaqPoD76YSZjuKl32YbJlmPgQbLFw==}
|
resolution: {integrity: sha512-5N+wkZi7DTNrnw9dm9CME3DYGvARp8qOvUwUd4Jg4yZmYNUK2GjtKx5oGCzPe82HqXyZPWDeTaCi8rCEDrO45w==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
@@ -4507,8 +4507,8 @@ packages:
|
|||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/@next/swc-linux-x64-gnu@14.1.2:
|
/@next/swc-linux-x64-gnu@14.2.0-canary.21:
|
||||||
resolution: {integrity: sha512-PCWC312woXLWOXiedi1E+fEw6B/ECP1fMiK1nSoGS2E43o56Z8kq4WeJLbJoufFQGVj5ZOKU3jIVyV//3CI4wQ==}
|
resolution: {integrity: sha512-gmE/b9WCV5CTtBYygo5TPnBRyGO7jpF+FTHHiTT4IcQD4KenHS7EuEpRKsh+ILZV8LpCCHSiUXKJLjz78OP5Sw==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
@@ -4525,8 +4525,8 @@ packages:
|
|||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/@next/swc-linux-x64-musl@14.1.2:
|
/@next/swc-linux-x64-musl@14.2.0-canary.21:
|
||||||
resolution: {integrity: sha512-KQSKzdWPNrYZjeTPCsepEpagOzU8Nf3Zzu53X1cLsSY6QlOIkYcSgEihRjsMKyeQW4aSvc+nN5pIpC2pLWNSMA==}
|
resolution: {integrity: sha512-bZtw5eCh00sRyVyKNjofrx6Gyi0xklGUbdvGykQgbh26IiUwNZCXS5wrR5kSF1kMfRZhTdPTIXrEU4aolxdKUw==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [linux]
|
os: [linux]
|
||||||
@@ -4543,8 +4543,8 @@ packages:
|
|||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/@next/swc-win32-arm64-msvc@14.1.2:
|
/@next/swc-win32-arm64-msvc@14.2.0-canary.21:
|
||||||
resolution: {integrity: sha512-3b0PouKd09Ulm2T1tjaRnwQj9+UwSsMO680d/sD4XAlm29KkNmVLAEIwWTfb3L+E11Qyw+jdcN3HtbDCg5+vYA==}
|
resolution: {integrity: sha512-bfPh6G3WYsSWeG0IhA7Kh9XWjMxfmvvd9wkK0YHyl7c2iAZsvY6m9kWNlpMUFpXZRNiagDJNc2Zz5a+lpTMBHg==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [arm64]
|
cpu: [arm64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
@@ -4561,8 +4561,8 @@ packages:
|
|||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/@next/swc-win32-ia32-msvc@14.1.2:
|
/@next/swc-win32-ia32-msvc@14.2.0-canary.21:
|
||||||
resolution: {integrity: sha512-CC1gaJY4h+wg6d5r2biggGM6nCFXh/6WEim2VOQI0WrA6easCQi2P2hzWyrU6moQ0g1GOiWzesGc6nn0a92Kgg==}
|
resolution: {integrity: sha512-nApW0yh16ye/ggHsX6TqYN5PWexsjjJm/EiCHU+7gq+TeVFH274a+uQOUDHJ31H3sthaC6bvnLrTkdZt6/12cA==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [ia32]
|
cpu: [ia32]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
@@ -4579,8 +4579,8 @@ packages:
|
|||||||
dev: false
|
dev: false
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
/@next/swc-win32-x64-msvc@14.1.2:
|
/@next/swc-win32-x64-msvc@14.2.0-canary.21:
|
||||||
resolution: {integrity: sha512-pfASwanOd+yP3D80O63DuQffrBySZPuB7wRN0IGSRq/0rDm9p/MvvnLzzgP2kSiLOUklOrFYVax7P6AEzjGykQ==}
|
resolution: {integrity: sha512-anyhM5mDXz4xMN5qo/naoaGsSPBFiT+3M8jZmY0bPcp251dehNoum6uiGLAShEiF1yFa6m1IzkkOI+3GY5q1DA==}
|
||||||
engines: {node: '>= 10'}
|
engines: {node: '>= 10'}
|
||||||
cpu: [x64]
|
cpu: [x64]
|
||||||
os: [win32]
|
os: [win32]
|
||||||
@@ -5544,18 +5544,11 @@ packages:
|
|||||||
/@swc/counter@0.1.3:
|
/@swc/counter@0.1.3:
|
||||||
resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==}
|
resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==}
|
||||||
|
|
||||||
/@swc/helpers@0.5.2:
|
|
||||||
resolution: {integrity: sha512-E4KcWTpoLHqwPHLxidpOqQbcrZVgi0rsmmZXUle1jXmJfuIf/UWpczUJ7MZZ5tlxytgJXyp0w4PGkkeLiuIdZw==}
|
|
||||||
dependencies:
|
|
||||||
tslib: 2.6.2
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/@swc/helpers@0.5.5:
|
/@swc/helpers@0.5.5:
|
||||||
resolution: {integrity: sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A==}
|
resolution: {integrity: sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@swc/counter': 0.1.3
|
'@swc/counter': 0.1.3
|
||||||
tslib: 2.6.2
|
tslib: 2.6.2
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@swc/jest@0.2.36(@swc/core@1.4.2):
|
/@swc/jest@0.2.36(@swc/core@1.4.2):
|
||||||
resolution: {integrity: sha512-8X80dp81ugxs4a11z1ka43FPhP+/e+mJNXJSxiNYk8gIX/jPBtY4gQTrKu/KIoco8bzKuPI5lUxjfLiGsfvnlw==}
|
resolution: {integrity: sha512-8X80dp81ugxs4a11z1ka43FPhP+/e+mJNXJSxiNYk8gIX/jPBtY4gQTrKu/KIoco8bzKuPI5lUxjfLiGsfvnlw==}
|
||||||
@@ -13099,8 +13092,8 @@ packages:
|
|||||||
/next-tick@1.1.0:
|
/next-tick@1.1.0:
|
||||||
resolution: {integrity: sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==}
|
resolution: {integrity: sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==}
|
||||||
|
|
||||||
/next@14.1.2(@babel/core@7.24.0)(react-dom@18.2.0)(react@18.2.0):
|
/next@14.2.0-canary.21(@babel/core@7.24.0)(react-dom@18.2.0)(react@18.2.0):
|
||||||
resolution: {integrity: sha512-p4RfNmopqkzRP1uUyBJnHii+qMg71f2udWhTTZopBB8b3T5QXNzn7yO+LCYHPWZG2kAvEn4l4neyJHqkXvo2wg==}
|
resolution: {integrity: sha512-8EjhlMmgnXCD+AzgwuomJBREzj5Kj3ZGuDSGgQuVNAoat+OIUDn/0lmX5yEacUJjiDstV4DopvwjTP8Jgm7l6A==}
|
||||||
engines: {node: '>=18.17.0'}
|
engines: {node: '>=18.17.0'}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@@ -13114,46 +13107,7 @@ packages:
|
|||||||
sass:
|
sass:
|
||||||
optional: true
|
optional: true
|
||||||
dependencies:
|
dependencies:
|
||||||
'@next/env': 14.1.2
|
'@next/env': 14.2.0-canary.21
|
||||||
'@swc/helpers': 0.5.2
|
|
||||||
busboy: 1.6.0
|
|
||||||
caniuse-lite: 1.0.30001591
|
|
||||||
graceful-fs: 4.2.11
|
|
||||||
postcss: 8.4.31
|
|
||||||
react: 18.2.0
|
|
||||||
react-dom: 18.2.0(react@18.2.0)
|
|
||||||
styled-jsx: 5.1.1(@babel/core@7.24.0)(react@18.2.0)
|
|
||||||
optionalDependencies:
|
|
||||||
'@next/swc-darwin-arm64': 14.1.2
|
|
||||||
'@next/swc-darwin-x64': 14.1.2
|
|
||||||
'@next/swc-linux-arm64-gnu': 14.1.2
|
|
||||||
'@next/swc-linux-arm64-musl': 14.1.2
|
|
||||||
'@next/swc-linux-x64-gnu': 14.1.2
|
|
||||||
'@next/swc-linux-x64-musl': 14.1.2
|
|
||||||
'@next/swc-win32-arm64-msvc': 14.1.2
|
|
||||||
'@next/swc-win32-ia32-msvc': 14.1.2
|
|
||||||
'@next/swc-win32-x64-msvc': 14.1.2
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- '@babel/core'
|
|
||||||
- babel-plugin-macros
|
|
||||||
dev: true
|
|
||||||
|
|
||||||
/next@14.2.0-canary.7(@babel/core@7.24.0)(react-dom@18.2.0)(react@18.2.0):
|
|
||||||
resolution: {integrity: sha512-X9wrHOzj25uzuECqpaO7SJ34gxZziaJZXdfRQJmEJC5tQ1FmxUm0eZ/SXIw3fPkjX2/04JmavkLJPtD3BA6UyA==}
|
|
||||||
engines: {node: '>=18.17.0'}
|
|
||||||
hasBin: true
|
|
||||||
peerDependencies:
|
|
||||||
'@opentelemetry/api': ^1.1.0
|
|
||||||
react: ^18.2.0
|
|
||||||
react-dom: ^18.2.0
|
|
||||||
sass: ^1.3.0
|
|
||||||
peerDependenciesMeta:
|
|
||||||
'@opentelemetry/api':
|
|
||||||
optional: true
|
|
||||||
sass:
|
|
||||||
optional: true
|
|
||||||
dependencies:
|
|
||||||
'@next/env': 14.2.0-canary.7
|
|
||||||
'@swc/helpers': 0.5.5
|
'@swc/helpers': 0.5.5
|
||||||
busboy: 1.6.0
|
busboy: 1.6.0
|
||||||
caniuse-lite: 1.0.30001591
|
caniuse-lite: 1.0.30001591
|
||||||
@@ -13163,19 +13117,19 @@ packages:
|
|||||||
react-dom: 18.2.0(react@18.2.0)
|
react-dom: 18.2.0(react@18.2.0)
|
||||||
styled-jsx: 5.1.1(@babel/core@7.24.0)(react@18.2.0)
|
styled-jsx: 5.1.1(@babel/core@7.24.0)(react@18.2.0)
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@next/swc-darwin-arm64': 14.2.0-canary.7
|
'@next/swc-darwin-arm64': 14.2.0-canary.21
|
||||||
'@next/swc-darwin-x64': 14.2.0-canary.7
|
'@next/swc-darwin-x64': 14.2.0-canary.21
|
||||||
'@next/swc-linux-arm64-gnu': 14.2.0-canary.7
|
'@next/swc-linux-arm64-gnu': 14.2.0-canary.21
|
||||||
'@next/swc-linux-arm64-musl': 14.2.0-canary.7
|
'@next/swc-linux-arm64-musl': 14.2.0-canary.21
|
||||||
'@next/swc-linux-x64-gnu': 14.2.0-canary.7
|
'@next/swc-linux-x64-gnu': 14.2.0-canary.21
|
||||||
'@next/swc-linux-x64-musl': 14.2.0-canary.7
|
'@next/swc-linux-x64-musl': 14.2.0-canary.21
|
||||||
'@next/swc-win32-arm64-msvc': 14.2.0-canary.7
|
'@next/swc-win32-arm64-msvc': 14.2.0-canary.21
|
||||||
'@next/swc-win32-ia32-msvc': 14.2.0-canary.7
|
'@next/swc-win32-ia32-msvc': 14.2.0-canary.21
|
||||||
'@next/swc-win32-x64-msvc': 14.2.0-canary.7
|
'@next/swc-win32-x64-msvc': 14.2.0-canary.21
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- '@babel/core'
|
- '@babel/core'
|
||||||
- babel-plugin-macros
|
- babel-plugin-macros
|
||||||
dev: false
|
dev: true
|
||||||
|
|
||||||
/next@14.2.0-canary.7(@babel/core@7.24.0)(react-dom@18.2.0)(react@18.2.0)(sass@1.71.1):
|
/next@14.2.0-canary.7(@babel/core@7.24.0)(react-dom@18.2.0)(react@18.2.0)(sass@1.71.1):
|
||||||
resolution: {integrity: sha512-X9wrHOzj25uzuECqpaO7SJ34gxZziaJZXdfRQJmEJC5tQ1FmxUm0eZ/SXIw3fPkjX2/04JmavkLJPtD3BA6UyA==}
|
resolution: {integrity: sha512-X9wrHOzj25uzuECqpaO7SJ34gxZziaJZXdfRQJmEJC5tQ1FmxUm0eZ/SXIw3fPkjX2/04JmavkLJPtD3BA6UyA==}
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ async function main() {
|
|||||||
process.env.TURBOPACK = '1'
|
process.env.TURBOPACK = '1'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
process.env.PAYLOAD_DROP_DATABASE = 'true'
|
||||||
|
|
||||||
beforeTest(testSuiteArg)
|
beforeTest(testSuiteArg)
|
||||||
|
|
||||||
nextDev({ _: [resolve(_dirname, '..')], port: process.env.PORT || 3000 })
|
nextDev({ _: [resolve(_dirname, '..')], port: process.env.PORT || 3000 })
|
||||||
|
|||||||
@@ -133,6 +133,10 @@ export function initPageConsoleErrorCatch(page: Page) {
|
|||||||
page.on('console', (msg) => {
|
page.on('console', (msg) => {
|
||||||
if (
|
if (
|
||||||
msg.type() === 'error' &&
|
msg.type() === 'error' &&
|
||||||
|
// Playwright is seemingly loading CJS files from React Select, but Next loads ESM.
|
||||||
|
// This leads to classnames not matching. Ignore these God-awful errors
|
||||||
|
// https://github.com/JedWatson/react-select/issues/3590
|
||||||
|
!msg.text().includes('did not match. Server:') &&
|
||||||
!msg.text().includes('the server responded with a status of') &&
|
!msg.text().includes('the server responded with a status of') &&
|
||||||
!msg.text().includes('Failed to fetch RSC payload for')
|
!msg.text().includes('Failed to fetch RSC payload for')
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { promises as _promises } from 'fs'
|
import { promises as _promises } from 'fs'
|
||||||
import getPort from 'get-port'
|
import { createServer } from 'http'
|
||||||
import { nextDev } from 'next/dist/cli/next-dev.js'
|
import nextImport from 'next'
|
||||||
import path from 'path'
|
import { parse } from 'url'
|
||||||
|
|
||||||
import type { SanitizedConfig } from '../../packages/payload/src/config/types.js'
|
import type { SanitizedConfig } from '../../packages/payload/src/config/types.js'
|
||||||
import type { Payload } from '../../packages/payload/src/index.js'
|
import type { Payload } from '../../packages/payload/src/index.js'
|
||||||
@@ -24,24 +24,42 @@ export async function initPayloadE2E({ config, dirname }: Args): Promise<Result>
|
|||||||
const testSuiteName = dirname.split('/').pop()
|
const testSuiteName = dirname.split('/').pop()
|
||||||
await beforeTest(testSuiteName)
|
await beforeTest(testSuiteName)
|
||||||
|
|
||||||
const port = await getPort()
|
|
||||||
const serverURL = `http://localhost:${port}`
|
|
||||||
process.env.NODE_OPTIONS = '--no-deprecation'
|
process.env.NODE_OPTIONS = '--no-deprecation'
|
||||||
process.env.PAYLOAD_DROP_DATABASE = 'true'
|
process.env.PAYLOAD_DROP_DATABASE = 'true'
|
||||||
process.env.PORT = String(port)
|
|
||||||
|
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
process.env.NODE_ENV = 'test'
|
process.env.NODE_ENV = 'test'
|
||||||
const payload = await getPayloadHMR({ config })
|
const payload = await getPayloadHMR({ config })
|
||||||
|
|
||||||
nextDev({
|
// const port = await getPort()
|
||||||
_: [path.resolve(dirname, '../../')],
|
const port = 3000
|
||||||
'--port': port,
|
process.env.PORT = String(port)
|
||||||
// Turbo doesn't seem to be reading
|
const serverURL = `http://localhost:${port}`
|
||||||
// our tsconfig paths, commented out for now
|
|
||||||
// '--turbo': '1',
|
// @ts-expect-error
|
||||||
|
const app = nextImport({ dev: true, hostname: 'localhost', port })
|
||||||
|
const handle = app.getRequestHandler()
|
||||||
|
|
||||||
|
let resolveServer
|
||||||
|
|
||||||
|
const serverPromise = new Promise((res) => (resolveServer = res))
|
||||||
|
|
||||||
|
// Need a custom server because calling nextDev straight
|
||||||
|
// starts up a child process, and payload.onInit() is called twice
|
||||||
|
// which seeds test data twice + other bad things.
|
||||||
|
// We initialize Payload above so we can have access to it in the tests
|
||||||
|
void app.prepare().then(() => {
|
||||||
|
createServer(async (req, res) => {
|
||||||
|
const parsedUrl = parse(req.url, true)
|
||||||
|
await handle(req, res, parsedUrl)
|
||||||
|
}).listen(port, () => {
|
||||||
|
resolveServer()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
await serverPromise
|
||||||
|
|
||||||
await wait(3000)
|
await wait(3000)
|
||||||
|
|
||||||
return { payload, serverURL }
|
return { payload, serverURL }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user