Skip to content

Commit 7e91d7c

Browse files
fix cms types and build (supabase#36145)
* fix cms types and build --------- Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
1 parent 8729251 commit 7e91d7c

File tree

88 files changed

+17041
-4372
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+17041
-4372
lines changed

apps/cms/.env

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# [LOCAL ENV] - NEVER USE PROD VALUES LOCALLY
2+
# as editing PayloadCMS typescript config INSTANTLY CHANGES DB SCHEMA in dev mode
3+
# The values set here are the default values provided when running `supabase start`.
4+
# Do not add secrets here, this file is git-tracked. Use .env.local instead.
5+
DATABASE_URI=postgresql://postgres:postgres@127.0.0.1:34322/postgres
6+
PAYLOAD_SECRET=secret
7+
8+
S3_BUCKET=cms
9+
S3_ACCESS_KEY_ID=625729a08b95bf1b7ff351a663f3a23c
10+
S3_SECRET_ACCESS_KEY=850181e4652dd023b7a98c58ae0d2d34bd487ee0cc3254aed6eda37307425907
11+
S3_REGION=local
12+
S3_ENDPOINT=http://127.0.0.1:34321/storage/v1/s3
13+
14+
BLOG_APP_URL=http://localhost:3000
15+
NEXT_PUBLIC_SERVER_URL=http://localhost:3000/blog
16+
CRON_SECRET=secret
17+
PREVIEW_SECRET=secret

apps/cms/.env.example

Lines changed: 0 additions & 13 deletions
This file was deleted.
File renamed without changes.

apps/cms/.gitignore

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ yarn-debug.log*
2929
yarn-error.log*
3030

3131
# local env files
32-
.env*.local
32+
!.env
33+
.env.local
3334

3435
# vercel
3536
.vercel
@@ -38,6 +39,4 @@ yarn-error.log*
3839
*.tsbuildinfo
3940
next-env.d.ts
4041

41-
.env
42-
4342
/media

apps/cms/.vercelignore

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Dependencies
2+
node_modules
3+
**/node_modules
4+
5+
# Build artifacts
6+
.next/cache
7+
.turbo
8+
.eslintcache
9+
10+
# Development files
11+
*.log
12+
.env.local
13+
.env.*.local
14+
15+
# Test files
16+
**/*.test.*
17+
**/*.spec.*
18+
__tests__
19+
**/__tests__
20+
coverage
21+
22+
# Documentation
23+
README.md
24+
*.md
25+
docs
26+
27+
# IDE files
28+
.vscode
29+
.idea
30+
*.swp
31+
*.swo
32+
33+
# OS files
34+
.DS_Store
35+
Thumbs.db
36+
37+
# Other apps (since we're only deploying CMS)
38+
../studio
39+
../www
40+
../docs
41+
../design-system
42+
../ui-library
43+
../../examples
44+
../../tests
45+
../../supabase
46+
../../packages/ui-patterns
47+
../../packages/ui
48+
../../packages/shared-data

apps/cms/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ services:
1515
env_file:
1616
- .env
1717

18-
# Uncomment the following to use postgres
18+
# Uncomment the following to use postgres
1919
postgres:
2020
restart: always
2121
image: postgres:latest

apps/cms/next.config.mjs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
import { withPayload } from '@payloadcms/next/withPayload'
22

3-
import redirects from './redirects.js'
3+
const redirects = async () => {
4+
const internetExplorerRedirect = {
5+
destination: '/ie-incompatible.html',
6+
has: [
7+
{
8+
type: 'header',
9+
key: 'user-agent',
10+
value: '(.*Trident.*)', // all ie browsers
11+
},
12+
],
13+
permanent: false,
14+
source: '/:path((?!ie-incompatible.html$).*)', // all pages except the incompatibility page
15+
}
16+
17+
const redirects = [internetExplorerRedirect]
18+
19+
return redirects
20+
}
421

522
const NEXT_PUBLIC_SERVER_URL = process.env.VERCEL_PROJECT_PRODUCTION_URL
623
? `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL}`

apps/cms/package.json

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,59 @@
55
"license": "MIT",
66
"scripts": {
77
"build": "cross-env NODE_OPTIONS=--no-deprecation next build --turbopack",
8+
"ci": "pnpm migrate && pnpm build",
9+
"clean": "rimraf node_modules .next",
810
"dev": "cross-env NODE_OPTIONS=--no-deprecation next dev --turbopack --port 3030",
11+
"dev:prod": "cross-env NODE_OPTIONS=--no-deprecation rm -rf .next && pnpm build && pnpm start",
912
"devsafe": "rm -rf .next && cross-env NODE_OPTIONS=--no-deprecation next dev",
1013
"generate:importmap": "cross-env NODE_OPTIONS=--no-deprecation payload generate:importmap",
1114
"generate:types": "cross-env NODE_OPTIONS=--no-deprecation payload generate:types",
1215
"lint": "cross-env NODE_OPTIONS=--no-deprecation next lint",
16+
"migrate": "cross-env NODE_OPTIONS=--no-deprecation tsx scripts/migrate.ts",
1317
"payload": "cross-env NODE_OPTIONS=--no-deprecation payload",
14-
"start": "cross-env NODE_OPTIONS=--no-deprecation next start",
15-
"ci": "cross-env NODE_OPTIONS=--no-deprecation payload migrate && pnpm build",
16-
"clean": "rimraf node_modules .next",
18+
"start": "cross-env NODE_OPTIONS=--no-deprecation next start --port 3030",
19+
"vercel-build": "pnpm migrate && pnpm build",
1720
"typecheck_IGNORED": "tsc --noEmit"
1821
},
1922
"dependencies": {
20-
"@payloadcms/db-postgres": "3.33.0",
21-
"@payloadcms/live-preview-react": "^3.33.0",
22-
"@payloadcms/next": "3.33.0",
23-
"@payloadcms/payload-cloud": "3.33.0",
24-
"@payloadcms/plugin-form-builder": "3.33.0",
25-
"@payloadcms/plugin-nested-docs": "3.33.0",
26-
"@payloadcms/plugin-seo": "3.33.0",
27-
"@payloadcms/richtext-lexical": "3.33.0",
28-
"@payloadcms/storage-s3": "3.33.0",
29-
"@payloadcms/ui": "3.33.0",
23+
"@payloadcms/admin-bar": "^3.50.0",
24+
"@payloadcms/db-postgres": "^3.50.0",
25+
"@payloadcms/live-preview-react": "^3.50.0",
26+
"@payloadcms/next": "3.50.0",
27+
"@payloadcms/payload-cloud": "3.50.0",
28+
"@payloadcms/plugin-form-builder": "3.50.0",
29+
"@payloadcms/plugin-nested-docs": "3.50.0",
30+
"@payloadcms/plugin-seo": "3.50.0",
31+
"@payloadcms/richtext-lexical": "3.50.0",
32+
"@payloadcms/storage-s3": "3.50.0",
33+
"@payloadcms/ui": "3.50.0",
34+
"@radix-ui/react-checkbox": "^1.3.2",
35+
"@radix-ui/react-label": "^2.1.7",
36+
"@radix-ui/react-select": "^2.0.0",
37+
"@radix-ui/react-slot": "^1.2.3",
38+
"class-variance-authority": "^0.7.1",
39+
"clsx": "^1.2.1",
3040
"common": "workspace:*",
3141
"config": "workspace:*",
3242
"cross-env": "^7.0.3",
3343
"eslint-config-supabase": "workspace:*",
34-
"graphql": "^16.8.1",
44+
"graphql": "^16.11.0",
45+
"image-size": "2.0.2",
46+
"lucide-react": "^0.511.0",
3547
"next": "catalog:",
36-
"payload": "3.33.0",
48+
"payload": "3.50.0",
49+
"pg": "^8.16.3",
50+
"prism-react-renderer": "^2.3.1",
3751
"react": "catalog:",
3852
"react-dom": "catalog:",
39-
"sharp": "0.32.6"
53+
"sharp": "0.32.6",
54+
"tailwind-merge": "^1.13.2"
4055
},
4156
"devDependencies": {
4257
"@types/node": "catalog:",
4358
"@types/react": "catalog:",
4459
"@types/react-dom": "catalog:",
60+
"tsx": "^4.19.3",
4561
"typescript": "5.7.3"
4662
}
4763
}

apps/cms/redirects.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

apps/cms/scripts/migrate.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import payload from 'payload'
2+
// Use a minimal config for migrations to avoid importing the full app graph during build
3+
import payloadConfig from '../src/payload.migrate.config.ts'
4+
5+
async function run() {
6+
try {
7+
await payload.init({ config: payloadConfig })
8+
9+
// Ensure non-interactive: remove any dev-mode migration sentinel rows
10+
try {
11+
await payload.delete({
12+
collection: 'payload-migrations',
13+
where: { batch: { equals: -1 } },
14+
})
15+
} catch {}
16+
17+
await payload.db.migrate()
18+
// eslint-disable-next-line no-console
19+
console.log('✅ Payload migrations complete')
20+
process.exit(0)
21+
} catch (err) {
22+
// eslint-disable-next-line no-console
23+
console.error('❌ Payload migrations failed:', err)
24+
process.exit(1)
25+
}
26+
}
27+
28+
run()

0 commit comments

Comments
 (0)