From bdee359c4c4a7c3c2cf73c9934bd640ac50583f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BE=9F=E7=94=B7=E6=97=A5=E8=AE=B0=5Cwww?= Date: Mon, 9 Feb 2026 04:57:02 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=AF=E5=8F=A3=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 4 ++-- README.md | 2 +- docker-compose.yml | 2 +- package.json | 6 +++--- playwright.config.ts | 4 ++-- src/components/fields/RelatedProductsField.tsx | 6 ++++-- tests/e2e/admin.e2e.spec.ts | 10 +++++----- tests/e2e/frontend.e2e.spec.ts | 2 +- tests/helpers/login.ts | 2 +- 9 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index 20be634..a77087b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -62,9 +62,9 @@ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static USER nextjs -EXPOSE 3000 +EXPOSE 1145 -ENV PORT 3000 +ENV PORT 1145 # server.js is created by next build from the standalone output # https://nextjs.org/docs/pages/api-reference/next-config-js/output diff --git a/README.md b/README.md index 7876a70..42f3678 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ After you click the `Deploy` button above, you'll want to have standalone copy o 2. `cd my-project && cp .env.example .env` to copy the example environment variables. You'll need to add the `MONGODB_URL` from your Cloud project to your `.env` if you want to use S3 storage and the MongoDB database that was created for you. 3. `pnpm install && pnpm dev` to install dependencies and start the dev server -4. open `http://localhost:3000` to open the app in your browser +4. open `http://localhost:1145` to open the app in your browser That's it! Changes made in `./src` will be reflected in your app. Follow the on-screen instructions to login and create your first admin user. Then check out [Production](#production) once you're ready to build and serve your app, and [Deployment](#deployment) when you're ready to go live. diff --git a/docker-compose.yml b/docker-compose.yml index e9c62ce..9beb187 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,7 @@ services: payload: image: node:18-alpine ports: - - '3000:3000' + - '1145:1145' volumes: - .:/home/node/app - node_modules:/home/node/app/node_modules diff --git a/package.json b/package.json index 1ca3184..d6c9662 100644 --- a/package.json +++ b/package.json @@ -6,13 +6,13 @@ "type": "module", "scripts": { "build": "cross-env NODE_OPTIONS=\"--no-deprecation --max-old-space-size=8000\" next build", - "dev": "cross-env NODE_OPTIONS=--no-deprecation next dev", - "devsafe": "rm -rf .next && cross-env NODE_OPTIONS=--no-deprecation next dev", + "dev": "cross-env NODE_OPTIONS=--no-deprecation PORT=1145 next dev", + "devsafe": "rm -rf .next && cross-env NODE_OPTIONS=--no-deprecation PORT=1145 next dev", "generate:importmap": "cross-env NODE_OPTIONS=--no-deprecation payload generate:importmap", "generate:types": "cross-env NODE_OPTIONS=--no-deprecation payload generate:types", "lint": "cross-env NODE_OPTIONS=--no-deprecation next lint", "payload": "cross-env NODE_OPTIONS=--no-deprecation payload", - "start": "cross-env NODE_OPTIONS=--no-deprecation next start", + "start": "cross-env NODE_OPTIONS=--no-deprecation PORT=1145 next start", "test": "pnpm run test:int && pnpm run test:e2e", "test:e2e": "cross-env NODE_OPTIONS=\"--no-deprecation --import=tsx/esm\" playwright test --config=playwright.config.ts", "test:int": "cross-env NODE_OPTIONS=--no-deprecation vitest run --config ./vitest.config.mts" diff --git a/playwright.config.ts b/playwright.config.ts index c60fa9d..31d70fa 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -22,7 +22,7 @@ export default defineConfig({ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Base URL to use in actions like `await page.goto('/')`. */ - // baseURL: 'http://localhost:3000', + // baseURL: 'http://localhost:1145', /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ trace: 'on-first-retry', @@ -36,6 +36,6 @@ export default defineConfig({ webServer: { command: 'pnpm dev', reuseExistingServer: true, - url: 'http://localhost:3000', + url: 'http://localhost:1145', }, }) diff --git a/src/components/fields/RelatedProductsField.tsx b/src/components/fields/RelatedProductsField.tsx index e59da51..1954600 100644 --- a/src/components/fields/RelatedProductsField.tsx +++ b/src/components/fields/RelatedProductsField.tsx @@ -116,7 +116,7 @@ export const RelatedProductsField: RelationshipFieldClientComponent = ({ path, f return (
- + {/* Selected Items Grid - 网格显示已选商品 */} {selectedDetails.length > 0 && ( @@ -369,7 +369,9 @@ export const RelatedProductsField: RelationshipFieldClientComponent = ({ path, f color: 'var(--theme-elevation-500)', }} > - {field.admin.description} + {typeof field.admin.description === 'string' + ? field.admin.description + : JSON.stringify(field.admin.description)}
)} diff --git a/tests/e2e/admin.e2e.spec.ts b/tests/e2e/admin.e2e.spec.ts index 67fc921..5173049 100644 --- a/tests/e2e/admin.e2e.spec.ts +++ b/tests/e2e/admin.e2e.spec.ts @@ -19,21 +19,21 @@ test.describe('Admin Panel', () => { }) test('can navigate to dashboard', async () => { - await page.goto('http://localhost:3000/admin') - await expect(page).toHaveURL('http://localhost:3000/admin') + await page.goto('http://localhost:1145/admin') + await expect(page).toHaveURL('http://localhost:1145/admin') const dashboardArtifact = page.locator('span[title="Dashboard"]').first() await expect(dashboardArtifact).toBeVisible() }) test('can navigate to list view', async () => { - await page.goto('http://localhost:3000/admin/collections/users') - await expect(page).toHaveURL('http://localhost:3000/admin/collections/users') + await page.goto('http://localhost:1145/admin/collections/users') + await expect(page).toHaveURL('http://localhost:1145/admin/collections/users') const listViewArtifact = page.locator('h1', { hasText: 'Users' }).first() await expect(listViewArtifact).toBeVisible() }) test('can navigate to edit view', async () => { - await page.goto('http://localhost:3000/admin/collections/users/create') + await page.goto('http://localhost:1145/admin/collections/users/create') await expect(page).toHaveURL(/\/admin\/collections\/users\/[a-zA-Z0-9-_]+/) const editViewArtifact = page.locator('input[name="email"]') await expect(editViewArtifact).toBeVisible() diff --git a/tests/e2e/frontend.e2e.spec.ts b/tests/e2e/frontend.e2e.spec.ts index 65c31fd..97bc50b 100644 --- a/tests/e2e/frontend.e2e.spec.ts +++ b/tests/e2e/frontend.e2e.spec.ts @@ -9,7 +9,7 @@ test.describe('Frontend', () => { }) test('can go on homepage', async ({ page }) => { - await page.goto('http://localhost:3000') + await page.goto('http://localhost:1145') await expect(page).toHaveTitle(/Payload Blank Template/) diff --git a/tests/helpers/login.ts b/tests/helpers/login.ts index deef8c2..b3f61d2 100644 --- a/tests/helpers/login.ts +++ b/tests/helpers/login.ts @@ -15,7 +15,7 @@ export interface LoginOptions { */ export async function login({ page, - serverURL = 'http://localhost:3000', + serverURL = 'http://localhost:1145', user, }: LoginOptions): Promise { await page.goto(`${serverURL}/admin/login`)