端口修正

This commit is contained in:
龟男日记\www 2026-02-09 04:57:02 +08:00
parent 84f94b53d9
commit bdee359c4c
9 changed files with 20 additions and 18 deletions

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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"

View File

@ -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',
},
})

View File

@ -116,7 +116,7 @@ export const RelatedProductsField: RelationshipFieldClientComponent = ({ path, f
return (
<div style={{ marginBottom: 'var(--base)' }}>
<FieldLabel field={field} />
<FieldLabel label={field.label} />
{/* 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)}
</div>
)}
</div>

View File

@ -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()

View File

@ -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/)

View File

@ -15,7 +15,7 @@ export interface LoginOptions {
*/
export async function login({
page,
serverURL = 'http://localhost:3000',
serverURL = 'http://localhost:1145',
user,
}: LoginOptions): Promise<void> {
await page.goto(`${serverURL}/admin/login`)