fix: debugging by moving app dir out of test

This commit is contained in:
Alessio Gravili
2024-03-20 09:48:05 -04:00
parent 25a3feb2ca
commit 64f2d2a502
91 changed files with 19 additions and 17 deletions

View File

@@ -1,7 +1,7 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
import config from '@payload-config'
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
import { NotFoundView } from '@payloadcms/next/views'
import { NotFoundView } from '@payloadcms/next/views/NotFound/index.js'
type Args = {
params: {

View File

@@ -3,7 +3,7 @@ import type { Metadata } from 'next'
import config from '@payload-config'
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
import { RootPage, generatePageMetadata } from '@payloadcms/next/views'
import { RootPage, generatePageMetadata } from '@payloadcms/next/views/Root/index.js'
type Args = {
params: {

View File

@@ -1,7 +1,7 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
/* DO NOT MODIFY it because it could be re-written at any time. */
import config from '@payload-config'
import { REST_DELETE, REST_GET, REST_PATCH, REST_POST } from '@payloadcms/next/routes'
import { REST_DELETE, REST_GET, REST_PATCH, REST_POST } from '@payloadcms/next/routes/index.js'
export const GET = REST_GET(config)
export const POST = REST_POST(config)

View File

@@ -1,6 +1,6 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
/* DO NOT MODIFY it because it could be re-written at any time. */
import config from '@payload-config'
import { GRAPHQL_PLAYGROUND_GET } from '@payloadcms/next/routes'
import { GRAPHQL_PLAYGROUND_GET } from '@payloadcms/next/routes/index.js'
export const GET = GRAPHQL_PLAYGROUND_GET(config)

View File

@@ -1,6 +1,6 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
/* DO NOT MODIFY it because it could be re-written at any time. */
import config from '@payload-config'
import { GRAPHQL_POST } from '@payloadcms/next/routes'
import { GRAPHQL_POST } from '@payloadcms/next/routes/index.js'
export const POST = GRAPHQL_POST(config)

View File

@@ -1,6 +1,6 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
import configPromise from '@payload-config'
import { RootLayout } from '@payloadcms/next/layouts'
import { RootLayout } from '@payloadcms/next/layouts/Root/index.js'
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
import React from 'react'

View File

@@ -24,7 +24,7 @@ process.env.PAYLOAD_DROP_DATABASE = 'true'
const { afterTest, beforeTest } = await createTestHooks(testSuiteArg)
await beforeTest()
const rootDir = resolve(_dirname, './')
const rootDir = resolve(_dirname, '../')
// @ts-expect-error
await nextDev({ port: process.env.PORT || 3000, dirname: rootDir }, 'default', rootDir)

View File

@@ -44,7 +44,7 @@ export async function initPayloadE2E({ config, dirname }: Args): Promise<Result>
dev: true,
hostname: 'localhost',
port,
dir: path.resolve(dirname, '../'),
dir: path.resolve(dirname, '../../'),
})
const handle = app.getRequestHandler()

View File

@@ -8,7 +8,7 @@ const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)
export const createTestHooks = async (testSuiteName = '_community') => {
const tsConfigPath = path.resolve(dirname, 'tsconfig.json')
const tsConfigPath = path.resolve(dirname, '../tsconfig.json')
const tsConfig = await json5.parse(await readFile(tsConfigPath, 'utf8'))
const originalPayloadConfigTsValue =
tsConfig.compilerOptions.paths['@payload-config'] ?? './_community/config.ts'
@@ -19,13 +19,13 @@ export const createTestHooks = async (testSuiteName = '_community') => {
*/
beforeTest: async () => {
// Delete next webpack cache
const nextWebpackCache = path.resolve(dirname, '.next/cache/webpack')
const nextWebpackCache = path.resolve(dirname, '../.next/cache/webpack')
if (existsSync(nextWebpackCache)) {
await rm(nextWebpackCache, { recursive: true })
}
// Set '@payload-config' in tsconfig.json
tsConfig.compilerOptions.paths['@payload-config'] = [`./${testSuiteName}/config.ts`]
tsConfig.compilerOptions.paths['@payload-config'] = [`./test/${testSuiteName}/config.ts`]
await writeFile(tsConfigPath, JSON.stringify(tsConfig, null, 2))
const PAYLOAD_CONFIG_PATH = path.resolve(testSuiteName, 'config')

View File

@@ -1,7 +1,7 @@
{
"compilerOptions": {
"noEmit": true,
"rootDir": ".", /* Specify the root folder within your source files. */
"rootDir": ".",
"declaration": true,
"declarationMap": true,
"target": "esnext",
@@ -33,11 +33,7 @@
"name": "next"
}
],
"paths": {
"@payload-config": [
"./_community/config.ts"
]
}
"paths": {}
},
"exclude": [
"dist",

View File

@@ -74,6 +74,12 @@
],
"@payloadcms/ui/scss/app.scss": [
"./packages/ui/src/scss/app.scss"
],
"@payloadcms/next/*": [
"./packages/next/src/*"
],
"@payloadcms/next": [
"./packages/next/src/exports/*"
]
}
},