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. */ /* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
import config from '@payload-config' import config from '@payload-config'
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ /* 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 = { type Args = {
params: { params: {

View File

@@ -3,7 +3,7 @@ import type { Metadata } from 'next'
import config from '@payload-config' import config from '@payload-config'
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */ /* 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 = { type Args = {
params: { params: {

View File

@@ -1,7 +1,7 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ /* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
/* DO NOT MODIFY it because it could be re-written at any time. */ /* DO NOT MODIFY it because it could be re-written at any time. */
import config from '@payload-config' 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 GET = REST_GET(config)
export const POST = REST_POST(config) export const POST = REST_POST(config)

View File

@@ -1,6 +1,6 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ /* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
/* DO NOT MODIFY it because it could be re-written at any time. */ /* DO NOT MODIFY it because it could be re-written at any time. */
import config from '@payload-config' 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) export const GET = GRAPHQL_PLAYGROUND_GET(config)

View File

@@ -1,6 +1,6 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ /* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
/* DO NOT MODIFY it because it could be re-written at any time. */ /* DO NOT MODIFY it because it could be re-written at any time. */
import config from '@payload-config' 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) export const POST = GRAPHQL_POST(config)

View File

@@ -1,6 +1,6 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */ /* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
import configPromise from '@payload-config' 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. */ /* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
import React from 'react' import React from 'react'

View File

@@ -24,7 +24,7 @@ process.env.PAYLOAD_DROP_DATABASE = 'true'
const { afterTest, beforeTest } = await createTestHooks(testSuiteArg) const { afterTest, beforeTest } = await createTestHooks(testSuiteArg)
await beforeTest() await beforeTest()
const rootDir = resolve(_dirname, './') const rootDir = resolve(_dirname, '../')
// @ts-expect-error // @ts-expect-error
await nextDev({ port: process.env.PORT || 3000, dirname: rootDir }, 'default', rootDir) 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, dev: true,
hostname: 'localhost', hostname: 'localhost',
port, port,
dir: path.resolve(dirname, '../'), dir: path.resolve(dirname, '../../'),
}) })
const handle = app.getRequestHandler() const handle = app.getRequestHandler()

View File

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

View File

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

View File

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