Compare commits
1 Commits
docs/v3-mi
...
alpha-post
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19620f4fa4 |
@@ -11,4 +11,3 @@
|
|||||||
playwright.config.ts
|
playwright.config.ts
|
||||||
jest.config.js
|
jest.config.js
|
||||||
test/live-preview/next-app
|
test/live-preview/next-app
|
||||||
tsconfig.tsbuildinfo
|
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ module.exports = {
|
|||||||
plugins: ['payload'],
|
plugins: ['payload'],
|
||||||
rules: {
|
rules: {
|
||||||
'payload/no-jsx-import-statements': 'warn',
|
'payload/no-jsx-import-statements': 'warn',
|
||||||
'payload/no-relative-monorepo-imports': 'error',
|
|
||||||
'payload/no-imports-from-exports-dir': 'error',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -31,12 +29,6 @@ module.exports = {
|
|||||||
'perfectionist/sort-objects': 'off',
|
'perfectionist/sort-objects': 'off',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
files: ['templates/vercel-postgres/**'],
|
|
||||||
rules: {
|
|
||||||
'no-restricted-exports': 'off',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
files: ['package.json', 'tsconfig.json'],
|
files: ['package.json', 'tsconfig.json'],
|
||||||
rules: {
|
rules: {
|
||||||
|
|||||||
45
.github/CODEOWNERS
vendored
45
.github/CODEOWNERS
vendored
@@ -1,30 +1,41 @@
|
|||||||
# Order matters. The last matching pattern takes precedence.
|
# Order matters. The last matching pattern takes precedence.
|
||||||
|
|
||||||
### Package Exports ###
|
### Core ###
|
||||||
/**/exports/ @denolfe @jmikrut
|
/packages/payload/src/uploads/ @denolfe
|
||||||
|
/packages/payload/src/admin/ @jmikrut @jacobsfletch @JarrodMFlesch
|
||||||
|
|
||||||
### Packages ###
|
### Adapters ###
|
||||||
/packages/richtext-*/ @AlessioGr
|
/packages/db-*/ @denolfe @jmikrut @DanRibbens
|
||||||
|
/packages/richtext-*/ @denolfe @jmikrut @DanRibbens @AlessioGr
|
||||||
|
|
||||||
|
### Plugins ###
|
||||||
|
/packages/plugin-*/ @denolfe @jmikrut @DanRibbens
|
||||||
/packages/plugin-cloud*/ @denolfe
|
/packages/plugin-cloud*/ @denolfe
|
||||||
/packages/email-*/ @denolfe
|
/packages/plugin-form-builder/ @jacobsfletch
|
||||||
/packages/storage-*/ @denolfe
|
/packages/plugin-live-preview*/ @jacobsfletch
|
||||||
/packages/create-payload-app/ @denolfe
|
/packages/plugin-nested-docs/ @jacobsfletch
|
||||||
/packages/eslint-*/ @denolfe
|
/packages/plugin-redirects/ @jacobsfletch
|
||||||
|
/packages/plugin-search/ @jacobsfletch
|
||||||
|
/packages/plugin-sentry/ @JessChowdhury
|
||||||
|
/packages/plugin-seo/ @jacobsfletch
|
||||||
|
/packages/plugin-stripe/ @jacobsfletch
|
||||||
|
|
||||||
|
### Examples ###
|
||||||
|
/examples/ @jacobsfletch
|
||||||
|
/examples/testing/ @JarrodMFlesch
|
||||||
|
/examples/email/ @JessChowdhury
|
||||||
|
/examples/whitelabel/ @JessChowdhury
|
||||||
|
|
||||||
### Templates ###
|
### Templates ###
|
||||||
/templates/ @jacobsfletch @denolfe
|
/templates/ @jacobsfletch @denolfe
|
||||||
|
|
||||||
### Build Files ###
|
### Misc ###
|
||||||
/**/package.json @denolfe
|
/packages/create-payload-app/ @denolfe
|
||||||
/tsconfig.json @denolfe
|
/packages/eslint-config-payload/ @denolfe
|
||||||
/**/tsconfig*.json @denolfe
|
/packages/payload-admin-bar/ @jacobsfletch
|
||||||
|
|
||||||
/jest.config.js @denolfe
|
|
||||||
/**/jest.config.js @denolfe
|
|
||||||
|
|
||||||
### Root ###
|
### Root ###
|
||||||
/package.json @denolfe
|
/package.json @denolfe
|
||||||
/scripts/ @denolfe
|
/scripts/ @denolfe
|
||||||
/.husky/ @denolfe
|
|
||||||
/.vscode/ @denolfe
|
|
||||||
/.github/ @denolfe
|
/.github/ @denolfe
|
||||||
|
/.github/CODEOWNERS @denolfe
|
||||||
|
|||||||
48
.github/actions/setup/action.yml
vendored
48
.github/actions/setup/action.yml
vendored
@@ -1,48 +0,0 @@
|
|||||||
name: Setup node and pnpm
|
|
||||||
description: Configure the Node.js and pnpm versions
|
|
||||||
|
|
||||||
inputs:
|
|
||||||
node-version:
|
|
||||||
description: 'The Node.js version to use'
|
|
||||||
required: true
|
|
||||||
default: 18.20.2
|
|
||||||
pnpm-version:
|
|
||||||
description: 'The pnpm version to use'
|
|
||||||
required: true
|
|
||||||
default: 8.15.7
|
|
||||||
|
|
||||||
runs:
|
|
||||||
using: composite
|
|
||||||
steps:
|
|
||||||
# https://github.com/actions/virtual-environments/issues/1187
|
|
||||||
- name: tune linux network
|
|
||||||
shell: bash
|
|
||||||
run: sudo ethtool -K eth0 tx off rx off
|
|
||||||
|
|
||||||
- name: Setup Node@${{ inputs.node-version }}
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: ${{ inputs.node-version }}
|
|
||||||
|
|
||||||
- name: Install pnpm
|
|
||||||
uses: pnpm/action-setup@v3
|
|
||||||
with:
|
|
||||||
version: ${{ inputs.pnpm-version }}
|
|
||||||
run_install: false
|
|
||||||
|
|
||||||
- name: Get pnpm store directory
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Setup pnpm cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ${{ env.STORE_PATH }}
|
|
||||||
key: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
||||||
restore-keys: |
|
|
||||||
pnpm-store-
|
|
||||||
pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
||||||
|
|
||||||
- shell: bash
|
|
||||||
run: pnpm install
|
|
||||||
50
.github/workflows/label-author.yml
vendored
50
.github/workflows/label-author.yml
vendored
@@ -1,50 +0,0 @@
|
|||||||
name: label-author
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [opened]
|
|
||||||
issues:
|
|
||||||
types: [opened]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
pull-requests: write
|
|
||||||
issues: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
debug-context:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: View context attributes
|
|
||||||
uses: actions/github-script@v7
|
|
||||||
with:
|
|
||||||
script: console.log(context)
|
|
||||||
|
|
||||||
label-created-by:
|
|
||||||
name: Label pr/issue on opening
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Tag with 'created-by'
|
|
||||||
uses: actions/github-script@v7
|
|
||||||
if: github.event.action == 'opened'
|
|
||||||
with:
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
script: |
|
|
||||||
const type = context.payload.pull_request ? 'pull_request' : 'issue';
|
|
||||||
const association = context.payload[type].author_association;
|
|
||||||
let label = ''
|
|
||||||
if (association === 'MEMBER' || association === 'OWNER') {
|
|
||||||
label = 'created-by: Payload team';
|
|
||||||
} else if (association === 'CONTRIBUTOR') {
|
|
||||||
label = 'created-by: Contributor';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!label) return;
|
|
||||||
|
|
||||||
github.rest.issues.addLabels({
|
|
||||||
issue_number: context.issue.number,
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
labels: [label],
|
|
||||||
});
|
|
||||||
console.log('Added created-by: Payload team label');
|
|
||||||
403
.github/workflows/main.yml
vendored
403
.github/workflows/main.yml
vendored
@@ -2,25 +2,9 @@ name: build
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types: [opened, reopened, synchronize]
|
||||||
- opened
|
|
||||||
- reopened
|
|
||||||
- synchronize
|
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: ['main', 'alpha']
|
||||||
- main
|
|
||||||
- beta
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
# <workflow_name>-<branch_name>-<true || commit_sha if branch is protected>
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.ref_protected && github.sha || ''}}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
env:
|
|
||||||
NODE_VERSION: 18.20.2
|
|
||||||
PNPM_VERSION: 8.15.7
|
|
||||||
DO_NOT_TRACK: 1 # Disable Turbopack telemetry
|
|
||||||
NEXT_TELEMETRY_DISABLED: 1 # Disable Next telemetry
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
changes:
|
changes:
|
||||||
@@ -31,10 +15,6 @@ jobs:
|
|||||||
needs_build: ${{ steps.filter.outputs.needs_build }}
|
needs_build: ${{ steps.filter.outputs.needs_build }}
|
||||||
templates: ${{ steps.filter.outputs.templates }}
|
templates: ${{ steps.filter.outputs.templates }}
|
||||||
steps:
|
steps:
|
||||||
# https://github.com/actions/virtual-environments/issues/1187
|
|
||||||
- name: tune linux network
|
|
||||||
run: sudo ethtool -K eth0 tx off rx off
|
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 25
|
fetch-depth: 25
|
||||||
@@ -55,52 +35,7 @@ jobs:
|
|||||||
echo "needs_build: ${{ steps.filter.outputs.needs_build }}"
|
echo "needs_build: ${{ steps.filter.outputs.needs_build }}"
|
||||||
echo "templates: ${{ steps.filter.outputs.templates }}"
|
echo "templates: ${{ steps.filter.outputs.templates }}"
|
||||||
|
|
||||||
lint:
|
core-build:
|
||||||
if: >
|
|
||||||
github.event_name == 'pull_request' && !contains(github.event.pull_request.title, 'no-lint') && !contains(github.event.pull_request.title, 'skip-lint')
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
# https://github.com/actions/virtual-environments/issues/1187
|
|
||||||
- name: tune linux network
|
|
||||||
run: sudo ethtool -K eth0 tx off rx off
|
|
||||||
|
|
||||||
- name: Setup Node@${{ env.NODE_VERSION }}
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
|
||||||
|
|
||||||
- name: Install pnpm
|
|
||||||
uses: pnpm/action-setup@v3
|
|
||||||
with:
|
|
||||||
version: ${{ env.PNPM_VERSION }}
|
|
||||||
run_install: false
|
|
||||||
|
|
||||||
- name: Get pnpm store directory
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Setup pnpm cache
|
|
||||||
uses: actions/cache@v4
|
|
||||||
timeout-minutes: 720
|
|
||||||
with:
|
|
||||||
path: ${{ env.STORE_PATH }}
|
|
||||||
key: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
||||||
restore-keys: |
|
|
||||||
pnpm-store-
|
|
||||||
pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
||||||
|
|
||||||
- run: pnpm install
|
|
||||||
- name: Lint staged
|
|
||||||
run: |
|
|
||||||
git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF}...${GITHUB_SHA}
|
|
||||||
npx lint-staged --diff="origin/${GITHUB_BASE_REF}...${GITHUB_SHA}"
|
|
||||||
|
|
||||||
build:
|
|
||||||
needs: changes
|
needs: changes
|
||||||
if: ${{ needs.changes.outputs.needs_build == 'true' }}
|
if: ${{ needs.changes.outputs.needs_build == 'true' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -110,19 +45,15 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 25
|
fetch-depth: 25
|
||||||
|
|
||||||
# https://github.com/actions/virtual-environments/issues/1187
|
- name: Use Node.js 18
|
||||||
- name: tune linux network
|
|
||||||
run: sudo ethtool -K eth0 tx off rx off
|
|
||||||
|
|
||||||
- name: Setup Node@${{ env.NODE_VERSION }}
|
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version: 18
|
||||||
|
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v3
|
uses: pnpm/action-setup@v3
|
||||||
with:
|
with:
|
||||||
version: ${{ env.PNPM_VERSION }}
|
version: 8
|
||||||
run_install: false
|
run_install: false
|
||||||
|
|
||||||
- name: Get pnpm store directory
|
- name: Get pnpm store directory
|
||||||
@@ -130,63 +61,65 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Setup pnpm cache
|
- uses: actions/cache@v4
|
||||||
uses: actions/cache@v4
|
name: Setup pnpm cache
|
||||||
timeout-minutes: 720
|
|
||||||
with:
|
with:
|
||||||
path: ${{ env.STORE_PATH }}
|
path: ${{ env.STORE_PATH }}
|
||||||
key: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
pnpm-store-
|
${{ runner.os }}-pnpm-store-
|
||||||
pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
|
||||||
- run: pnpm install
|
- run: pnpm install
|
||||||
- run: pnpm run build:all
|
- run: pnpm run build:core
|
||||||
env:
|
|
||||||
DO_NOT_TRACK: 1 # Disable Turbopack telemetry
|
|
||||||
|
|
||||||
- name: Cache build
|
- name: Cache build
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
timeout-minutes: 10
|
|
||||||
with:
|
with:
|
||||||
path: ./*
|
path: ./*
|
||||||
key: ${{ github.sha }}-${{ github.run_number }}
|
key: ${{ github.sha }}-${{ github.run_number }}
|
||||||
|
|
||||||
tests-unit:
|
plugins-build:
|
||||||
|
needs: changes
|
||||||
|
if: ${{ needs.changes.outputs.needs_build == 'true' }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# https://github.com/actions/virtual-environments/issues/1187
|
- uses: actions/checkout@v4
|
||||||
- name: tune linux network
|
with:
|
||||||
run: sudo ethtool -K eth0 tx off rx off
|
fetch-depth: 25
|
||||||
|
|
||||||
- name: Setup Node@${{ env.NODE_VERSION }}
|
- name: Use Node.js 18
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version: 18
|
||||||
|
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v3
|
uses: pnpm/action-setup@v3
|
||||||
with:
|
with:
|
||||||
version: ${{ env.PNPM_VERSION }}
|
version: 8
|
||||||
run_install: false
|
run_install: false
|
||||||
|
|
||||||
- name: Restore build
|
- name: Get pnpm store directory
|
||||||
uses: actions/cache@v4
|
shell: bash
|
||||||
timeout-minutes: 10
|
run: |
|
||||||
|
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- uses: actions/cache@v4
|
||||||
|
name: Setup pnpm cache
|
||||||
with:
|
with:
|
||||||
path: ./*
|
path: ${{ env.STORE_PATH }}
|
||||||
key: ${{ github.sha }}-${{ github.run_number }}
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pnpm-store-
|
||||||
|
${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
|
||||||
- name: Unit Tests
|
- run: pnpm install
|
||||||
run: pnpm test:unit
|
- run: pnpm run build:plugins
|
||||||
env:
|
|
||||||
NODE_OPTIONS: --max-old-space-size=8096
|
|
||||||
|
|
||||||
tests-int:
|
tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: core-build
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -206,24 +139,19 @@ jobs:
|
|||||||
AWS_REGION: us-east-1
|
AWS_REGION: us-east-1
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# https://github.com/actions/virtual-environments/issues/1187
|
- name: Use Node.js 18
|
||||||
- name: tune linux network
|
|
||||||
run: sudo ethtool -K eth0 tx off rx off
|
|
||||||
|
|
||||||
- name: Setup Node@${{ env.NODE_VERSION }}
|
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version: 18
|
||||||
|
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v3
|
uses: pnpm/action-setup@v3
|
||||||
with:
|
with:
|
||||||
version: ${{ env.PNPM_VERSION }}
|
version: 8
|
||||||
run_install: false
|
run_install: false
|
||||||
|
|
||||||
- name: Restore build
|
- name: Restore build
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
timeout-minutes: 10
|
|
||||||
with:
|
with:
|
||||||
path: ./*
|
path: ./*
|
||||||
key: ${{ github.sha }}-${{ github.run_number }}
|
key: ${{ github.sha }}-${{ github.run_number }}
|
||||||
@@ -274,7 +202,7 @@ jobs:
|
|||||||
if: matrix.database == 'supabase'
|
if: matrix.database == 'supabase'
|
||||||
|
|
||||||
- name: Integration Tests
|
- name: Integration Tests
|
||||||
run: pnpm test:int
|
run: pnpm test:int --testPathIgnorePatterns=test/fields # Ignore fields tests until reworked
|
||||||
env:
|
env:
|
||||||
NODE_OPTIONS: --max-old-space-size=8096
|
NODE_OPTIONS: --max-old-space-size=8096
|
||||||
PAYLOAD_DATABASE: ${{ matrix.database }}
|
PAYLOAD_DATABASE: ${{ matrix.database }}
|
||||||
@@ -282,7 +210,7 @@ jobs:
|
|||||||
|
|
||||||
tests-e2e:
|
tests-e2e:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: core-build
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
@@ -290,172 +218,75 @@ jobs:
|
|||||||
suite:
|
suite:
|
||||||
- _community
|
- _community
|
||||||
- access-control
|
- access-control
|
||||||
- admin__e2e__1
|
# - admin
|
||||||
- admin__e2e__2
|
|
||||||
- auth
|
- auth
|
||||||
- field-error-states
|
# - field-error-states
|
||||||
- fields-relationship
|
# - fields-relationship
|
||||||
- fields
|
# - fields
|
||||||
- fields__collections__Blocks
|
- fields/lexical
|
||||||
- fields__collections__Array
|
|
||||||
- fields__collections__Relationship
|
|
||||||
- fields__collections__RichText
|
|
||||||
- fields__collections__Lexical__e2e__main
|
|
||||||
- fields__collections__Lexical__e2e__blocks
|
|
||||||
- fields__collections__Date
|
|
||||||
- fields__collections__Number
|
|
||||||
- fields__collections__Point
|
|
||||||
- fields__collections__Tabs
|
|
||||||
- fields__collections__Text
|
|
||||||
- fields__collections__Upload
|
|
||||||
- live-preview
|
- live-preview
|
||||||
- localization
|
# - localization
|
||||||
- i18n
|
# - plugin-nested-docs
|
||||||
- plugin-cloud-storage
|
# - plugin-seo
|
||||||
- plugin-form-builder
|
# - refresh-permissions
|
||||||
- plugin-nested-docs
|
# - uploads
|
||||||
- plugin-seo
|
# - versions
|
||||||
- versions
|
|
||||||
- uploads
|
|
||||||
env:
|
|
||||||
SUITE_NAME: ${{ matrix.suite }}
|
|
||||||
steps:
|
|
||||||
# https://github.com/actions/virtual-environments/issues/1187
|
|
||||||
- name: tune linux network
|
|
||||||
run: sudo ethtool -K eth0 tx off rx off
|
|
||||||
|
|
||||||
- name: Setup Node@${{ env.NODE_VERSION }}
|
steps:
|
||||||
|
- name: Use Node.js 18
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version: 18
|
||||||
|
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v3
|
uses: pnpm/action-setup@v3
|
||||||
with:
|
with:
|
||||||
version: ${{ env.PNPM_VERSION }}
|
version: 8
|
||||||
run_install: false
|
run_install: false
|
||||||
|
|
||||||
- name: Restore build
|
- name: Restore build
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
timeout-minutes: 10
|
|
||||||
with:
|
with:
|
||||||
path: ./*
|
path: ./*
|
||||||
key: ${{ github.sha }}-${{ github.run_number }}
|
key: ${{ github.sha }}-${{ github.run_number }}
|
||||||
|
|
||||||
- name: Start LocalStack
|
- name: Install Playwright
|
||||||
run: pnpm docker:start
|
run: pnpm exec playwright install
|
||||||
if: ${{ matrix.suite == 'plugin-cloud-storage' }}
|
|
||||||
|
|
||||||
- name: Store Playwright's Version
|
|
||||||
run: |
|
|
||||||
# Extract the version number using a more targeted regex pattern with awk
|
|
||||||
PLAYWRIGHT_VERSION=$(pnpm ls @playwright/test --depth=0 | awk '/@playwright\/test/ {print $2}')
|
|
||||||
echo "Playwright's Version: $PLAYWRIGHT_VERSION"
|
|
||||||
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Cache Playwright Browsers for Playwright's Version
|
|
||||||
id: cache-playwright-browsers
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ~/.cache/ms-playwright
|
|
||||||
key: playwright-browsers-${{ env.PLAYWRIGHT_VERSION }}
|
|
||||||
|
|
||||||
- name: Setup Playwright - Browsers and Dependencies
|
|
||||||
if: steps.cache-playwright-browsers.outputs.cache-hit != 'true'
|
|
||||||
run: pnpm exec playwright install --with-deps chromium
|
|
||||||
|
|
||||||
- name: Setup Playwright - Dependencies-only
|
|
||||||
if: steps.cache-playwright-browsers.outputs.cache-hit == 'true'
|
|
||||||
run: pnpm exec playwright install-deps chromium
|
|
||||||
|
|
||||||
- name: E2E Tests
|
- name: E2E Tests
|
||||||
run: PLAYWRIGHT_JSON_OUTPUT_NAME=results_${{ matrix.suite }}.json pnpm test:e2e ${{ matrix.suite }}
|
uses: nick-fields/retry@v3
|
||||||
env:
|
with:
|
||||||
PLAYWRIGHT_JSON_OUTPUT_NAME: results_${{ matrix.suite }}.json
|
retry_on: error
|
||||||
NEXT_TELEMETRY_DISABLED: 1
|
max_attempts: 2
|
||||||
|
timeout_minutes: 15
|
||||||
|
command: pnpm test:e2e ${{ matrix.suite }}
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: always()
|
if: always()
|
||||||
with:
|
with:
|
||||||
name: test-results-${{ matrix.suite }}
|
name: test-results
|
||||||
path: test/test-results/
|
path: test/test-results/
|
||||||
if-no-files-found: ignore
|
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
||||||
# Disabled until this is fixed: https://github.com/daun/playwright-report-summary/issues/156
|
|
||||||
# - uses: daun/playwright-report-summary@v3
|
|
||||||
# with:
|
|
||||||
# report-file: results_${{ matrix.suite }}.json
|
|
||||||
# report-tag: ${{ matrix.suite }}
|
|
||||||
# job-summary: true
|
|
||||||
|
|
||||||
app-build-with-packed:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: build
|
|
||||||
|
|
||||||
steps:
|
|
||||||
# https://github.com/actions/virtual-environments/issues/1187
|
|
||||||
- name: tune linux network
|
|
||||||
run: sudo ethtool -K eth0 tx off rx off
|
|
||||||
|
|
||||||
- name: Setup Node@${{ env.NODE_VERSION }}
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
|
||||||
|
|
||||||
- name: Install pnpm
|
|
||||||
uses: pnpm/action-setup@v3
|
|
||||||
with:
|
|
||||||
version: ${{ env.PNPM_VERSION }}
|
|
||||||
run_install: false
|
|
||||||
|
|
||||||
- name: Restore build
|
|
||||||
uses: actions/cache@v4
|
|
||||||
timeout-minutes: 10
|
|
||||||
with:
|
|
||||||
path: ./*
|
|
||||||
key: ${{ github.sha }}-${{ github.run_number }}
|
|
||||||
|
|
||||||
- name: Start MongoDB
|
|
||||||
uses: supercharge/mongodb-github-action@1.10.0
|
|
||||||
with:
|
|
||||||
mongodb-version: 6.0
|
|
||||||
|
|
||||||
- name: Pack and build app
|
|
||||||
run: |
|
|
||||||
set -ex
|
|
||||||
pnpm run script:pack --dest templates/blank-3.0
|
|
||||||
cd templates/blank-3.0
|
|
||||||
cp .env.example .env
|
|
||||||
ls -la
|
|
||||||
pnpm add ./*.tgz --ignore-workspace
|
|
||||||
pnpm install --ignore-workspace --no-frozen-lockfile
|
|
||||||
cat package.json
|
|
||||||
pnpm run build
|
|
||||||
|
|
||||||
tests-type-generation:
|
tests-type-generation:
|
||||||
|
if: false # This should be replaced with gen on a real Payload project
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: core-build
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# https://github.com/actions/virtual-environments/issues/1187
|
- name: Use Node.js 18
|
||||||
- name: tune linux network
|
|
||||||
run: sudo ethtool -K eth0 tx off rx off
|
|
||||||
|
|
||||||
- name: Setup Node@${{ env.NODE_VERSION }}
|
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version: 18
|
||||||
|
|
||||||
- name: Install pnpm
|
- name: Install pnpm
|
||||||
uses: pnpm/action-setup@v3
|
uses: pnpm/action-setup@v3
|
||||||
with:
|
with:
|
||||||
version: ${{ env.PNPM_VERSION }}
|
version: 8
|
||||||
run_install: false
|
run_install: false
|
||||||
|
|
||||||
- name: Restore build
|
- name: Restore build
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
timeout-minutes: 10
|
|
||||||
with:
|
with:
|
||||||
path: ./*
|
path: ./*
|
||||||
key: ${{ github.sha }}-${{ github.run_number }}
|
key: ${{ github.sha }}-${{ github.run_number }}
|
||||||
@@ -466,6 +297,46 @@ jobs:
|
|||||||
- name: Generate GraphQL schema file
|
- name: Generate GraphQL schema file
|
||||||
run: pnpm dev:generate-graphql-schema graphql-schema-gen
|
run: pnpm dev:generate-graphql-schema graphql-schema-gen
|
||||||
|
|
||||||
|
plugins:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: core-build
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
pkg:
|
||||||
|
- create-payload-app
|
||||||
|
- plugin-cloud
|
||||||
|
- plugin-cloud-storage
|
||||||
|
- plugin-form-builder
|
||||||
|
- plugin-nested-docs
|
||||||
|
- plugin-search
|
||||||
|
- plugin-sentry
|
||||||
|
- plugin-seo
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Use Node.js 18
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
|
||||||
|
- name: Install pnpm
|
||||||
|
uses: pnpm/action-setup@v3
|
||||||
|
with:
|
||||||
|
version: 8
|
||||||
|
run_install: false
|
||||||
|
|
||||||
|
- name: Restore build
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ./*
|
||||||
|
key: ${{ github.sha }}-${{ github.run_number }}
|
||||||
|
|
||||||
|
- name: Build ${{ matrix.pkg }}
|
||||||
|
run: pnpm turbo run build --filter=${{ matrix.pkg }}
|
||||||
|
|
||||||
|
- name: Test ${{ matrix.pkg }}
|
||||||
|
run: pnpm --filter ${{ matrix.pkg }} run test
|
||||||
|
|
||||||
templates:
|
templates:
|
||||||
needs: changes
|
needs: changes
|
||||||
if: false # Disable until templates are updated for 3.0
|
if: false # Disable until templates are updated for 3.0
|
||||||
@@ -479,14 +350,11 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 25
|
fetch-depth: 25
|
||||||
# https://github.com/actions/virtual-environments/issues/1187
|
|
||||||
- name: tune linux network
|
|
||||||
run: sudo ethtool -K eth0 tx off rx off
|
|
||||||
|
|
||||||
- name: Setup Node@${{ env.NODE_VERSION }}
|
- name: Use Node.js 18
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version: 18
|
||||||
|
|
||||||
- name: Start MongoDB
|
- name: Start MongoDB
|
||||||
uses: supercharge/mongodb-github-action@1.10.0
|
uses: supercharge/mongodb-github-action@1.10.0
|
||||||
@@ -500,48 +368,3 @@ jobs:
|
|||||||
yarn install
|
yarn install
|
||||||
yarn build
|
yarn build
|
||||||
yarn generate:types
|
yarn generate:types
|
||||||
|
|
||||||
generated-templates:
|
|
||||||
needs: build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
# https://github.com/actions/virtual-environments/issues/1187
|
|
||||||
- name: tune linux network
|
|
||||||
run: sudo ethtool -K eth0 tx off rx off
|
|
||||||
|
|
||||||
- name: Setup Node@${{ env.NODE_VERSION }}
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
|
||||||
|
|
||||||
- name: Install pnpm
|
|
||||||
uses: pnpm/action-setup@v3
|
|
||||||
with:
|
|
||||||
version: ${{ env.PNPM_VERSION }}
|
|
||||||
run_install: false
|
|
||||||
|
|
||||||
- name: Restore build
|
|
||||||
uses: actions/cache@v4
|
|
||||||
timeout-minutes: 10
|
|
||||||
with:
|
|
||||||
path: ./*
|
|
||||||
key: ${{ github.sha }}-${{ github.run_number }}
|
|
||||||
|
|
||||||
- name: Build all generated templates
|
|
||||||
run: pnpm tsx ./scripts/build-generated-templates.ts
|
|
||||||
|
|
||||||
all-green:
|
|
||||||
name: All Green
|
|
||||||
if: always()
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs:
|
|
||||||
- lint
|
|
||||||
- build
|
|
||||||
- tests-unit
|
|
||||||
- tests-int
|
|
||||||
- tests-e2e
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- if: ${{ always() && (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) }}
|
|
||||||
run: exit 1
|
|
||||||
|
|||||||
103
.github/workflows/pr-title.yml
vendored
103
.github/workflows/pr-title.yml
vendored
@@ -1,103 +0,0 @@
|
|||||||
name: pr-title
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- edited
|
|
||||||
- synchronize
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
pull-requests: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
main:
|
|
||||||
name: lint-pr-title
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: amannn/action-semantic-pull-request@v5
|
|
||||||
id: lint_pr_title
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
types: |
|
|
||||||
build
|
|
||||||
chore
|
|
||||||
ci
|
|
||||||
docs
|
|
||||||
feat
|
|
||||||
fix
|
|
||||||
perf
|
|
||||||
refactor
|
|
||||||
revert
|
|
||||||
style
|
|
||||||
test
|
|
||||||
types
|
|
||||||
scopes: |
|
|
||||||
cpa
|
|
||||||
db-\*
|
|
||||||
db-mongodb
|
|
||||||
db-postgres
|
|
||||||
email-nodemailer
|
|
||||||
eslint
|
|
||||||
graphql
|
|
||||||
live-preview
|
|
||||||
live-preview-react
|
|
||||||
next
|
|
||||||
payload
|
|
||||||
plugin-cloud
|
|
||||||
plugin-cloud-storage
|
|
||||||
plugin-form-builder
|
|
||||||
plugin-nested-docs
|
|
||||||
plugin-redirects
|
|
||||||
plugin-relationship-object-ids
|
|
||||||
plugin-search
|
|
||||||
plugin-sentry
|
|
||||||
plugin-seo
|
|
||||||
plugin-stripe
|
|
||||||
richtext-\*
|
|
||||||
richtext-lexical
|
|
||||||
richtext-slate
|
|
||||||
storage-\*
|
|
||||||
storage-azure
|
|
||||||
storage-gcs
|
|
||||||
storage-vercel-blob
|
|
||||||
storage-s3
|
|
||||||
translations
|
|
||||||
ui
|
|
||||||
templates
|
|
||||||
examples(\/(\w|-)+)?
|
|
||||||
deps
|
|
||||||
|
|
||||||
# Disallow uppercase letters at the beginning of the subject
|
|
||||||
subjectPattern: ^(?![A-Z]).+$
|
|
||||||
subjectPatternError: |
|
|
||||||
The subject "{subject}" found in the pull request title "{title}"
|
|
||||||
didn't match the configured pattern. Please ensure that the subject
|
|
||||||
doesn't start with an uppercase character.
|
|
||||||
|
|
||||||
- uses: marocchino/sticky-pull-request-comment@v2
|
|
||||||
# When the previous steps fails, the workflow would stop. By adding this
|
|
||||||
# condition you can continue the execution with the populated error message.
|
|
||||||
if: always() && (steps.lint_pr_title.outputs.error_message != null)
|
|
||||||
with:
|
|
||||||
header: pr-title-lint-error
|
|
||||||
message: |
|
|
||||||
Pull Request titles must follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and have valid scopes.
|
|
||||||
|
|
||||||
${{ steps.lint_pr_title.outputs.error_message }}
|
|
||||||
|
|
||||||
```
|
|
||||||
feat(ui): add Button component
|
|
||||||
^ ^ ^
|
|
||||||
| | |__ Subject
|
|
||||||
| |_______ Scope
|
|
||||||
|____________ Type
|
|
||||||
```
|
|
||||||
|
|
||||||
# Delete a previous comment when the issue has been resolved
|
|
||||||
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
|
|
||||||
uses: marocchino/sticky-pull-request-comment@v2
|
|
||||||
with:
|
|
||||||
header: pr-title-lint-error
|
|
||||||
delete: true
|
|
||||||
36
.github/workflows/release-canary.yml
vendored
36
.github/workflows/release-canary.yml
vendored
@@ -1,36 +0,0 @@
|
|||||||
name: release-canary
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
branches:
|
|
||||||
- beta
|
|
||||||
|
|
||||||
env:
|
|
||||||
NODE_VERSION: 18.20.2
|
|
||||||
PNPM_VERSION: 8.15.7
|
|
||||||
DO_NOT_TRACK: 1 # Disable Turbopack telemetry
|
|
||||||
NEXT_TELEMETRY_DISABLED: 1 # Disable Next telemetry
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release:
|
|
||||||
permissions:
|
|
||||||
id-token: write
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Setup
|
|
||||||
uses: ./.github/actions/setup
|
|
||||||
with:
|
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
|
||||||
pnpm-version: ${{ env.PNPM_VERSION }}
|
|
||||||
- name: Load npm token
|
|
||||||
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
|
|
||||||
env:
|
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
||||||
- name: Canary release script
|
|
||||||
# dry run hard-coded to true for testing and no npm token provided
|
|
||||||
run: pnpm tsx ./scripts/publish-canary.ts
|
|
||||||
env:
|
|
||||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
||||||
NPM_CONFIG_PROVENANCE: true
|
|
||||||
9
.gitignore
vendored
9
.gitignore
vendored
@@ -3,7 +3,6 @@ package-lock.json
|
|||||||
dist
|
dist
|
||||||
/.idea/*
|
/.idea/*
|
||||||
!/.idea/runConfigurations
|
!/.idea/runConfigurations
|
||||||
!/.idea/payload.iml
|
|
||||||
|
|
||||||
test-results
|
test-results
|
||||||
.devcontainer
|
.devcontainer
|
||||||
@@ -12,16 +11,10 @@ test-results
|
|||||||
.localstack
|
.localstack
|
||||||
.turbo
|
.turbo
|
||||||
|
|
||||||
meta_client.json
|
|
||||||
meta_server.json
|
|
||||||
meta_index.json
|
|
||||||
meta_shared.json
|
|
||||||
|
|
||||||
.turbo
|
.turbo
|
||||||
|
|
||||||
# Ignore test directory media folder/files
|
# Ignore test directory media folder/files
|
||||||
/media
|
/media
|
||||||
test/media
|
|
||||||
/versions
|
/versions
|
||||||
|
|
||||||
# Created by https://www.toptal.com/developers/gitignore/api/node,macos,windows,webstorm,sublimetext,visualstudiocode
|
# Created by https://www.toptal.com/developers/gitignore/api/node,macos,windows,webstorm,sublimetext,visualstudiocode
|
||||||
@@ -295,4 +288,4 @@ $RECYCLE.BIN/
|
|||||||
# End of https://www.toptal.com/developers/gitignore/api/node,macos,windows,webstorm,sublimetext,visualstudiocode
|
# End of https://www.toptal.com/developers/gitignore/api/node,macos,windows,webstorm,sublimetext,visualstudiocode
|
||||||
|
|
||||||
/build
|
/build
|
||||||
.swc
|
.swc
|
||||||
82
.idea/payload.iml
generated
82
.idea/payload.iml
generated
@@ -1,82 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="WEB_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/payload/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/payload/components" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/payload/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.swc" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/examples" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/media" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/create-payload-app/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/create-payload-app/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/db-mongodb/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/db-mongodb/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/db-postgres/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/db-postgres/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/graphql/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/graphql/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/live-preview-react/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/live-preview-react/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/live-preview/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/live-preview/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/next/.swc" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/next/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/payload/fields" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/plugin-cloud-storage/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/plugin-cloud-storage/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/plugin-cloud/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/plugin-cloud/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/plugin-form-builder/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/plugin-nested-docs/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/plugin-nested-docs/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/plugin-redirects/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/plugin-redirects/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/plugin-search/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/plugin-search/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/plugin-sentry/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/plugin-seo/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/plugin-seo/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/plugin-stripe/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/richtext-lexical/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/richtext-lexical/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/templates" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/test/.swc" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/versions" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/richtext-slate/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/richtext-slate/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/email-nodemailer/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/email-nodemailer/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/email-resend/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/email-resend/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/live-preview-vue/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/live-preview-vue/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/payload/.swc" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/plugin-form-builder/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/plugin-relationship-object-ids/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/plugin-relationship-object-ids/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/plugin-stripe/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/storage-azure/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/storage-azure/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/storage-gcs/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/storage-gcs/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/storage-s3/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/storage-s3/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/storage-uploadthing/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/storage-uploadthing/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/storage-vercel-blob/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/storage-vercel-blob/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/translations/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/translations/dist" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/ui/.swc" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/ui/.turbo" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/packages/ui/dist" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<component name="ProjectRunConfigurationManager">
|
|
||||||
<configuration default="true" type="JavaScriptTestRunnerJest">
|
|
||||||
<node-interpreter value="project" />
|
|
||||||
<node-options value="--experimental-vm-modules --no-deprecation" />
|
|
||||||
<envs />
|
|
||||||
<scope-kind value="ALL" />
|
|
||||||
<method v="2" />
|
|
||||||
</configuration>
|
|
||||||
</component>
|
|
||||||
@@ -1 +1 @@
|
|||||||
v18.20.2
|
v18.19.1
|
||||||
|
|||||||
@@ -10,7 +10,3 @@
|
|||||||
**/temp
|
**/temp
|
||||||
**/docs/**
|
**/docs/**
|
||||||
tsconfig.json
|
tsconfig.json
|
||||||
packages/payload/*.js
|
|
||||||
packages/payload/*.d.ts
|
|
||||||
payload-types.ts
|
|
||||||
tsconfig.tsbuildinfo
|
|
||||||
|
|||||||
9
.swcrc
9
.swcrc
@@ -7,15 +7,6 @@
|
|||||||
"syntax": "typescript",
|
"syntax": "typescript",
|
||||||
"tsx": true,
|
"tsx": true,
|
||||||
"dts": true
|
"dts": true
|
||||||
},
|
|
||||||
"transform": {
|
|
||||||
"react": {
|
|
||||||
"runtime": "automatic",
|
|
||||||
"pragmaFrag": "React.Fragment",
|
|
||||||
"throwIfNamespace": true,
|
|
||||||
"development": false,
|
|
||||||
"useBuiltins": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"module": {
|
"module": {
|
||||||
|
|||||||
68
.vscode/launch.json
vendored
68
.vscode/launch.json
vendored
@@ -10,52 +10,19 @@
|
|||||||
"cwd": "${workspaceFolder}"
|
"cwd": "${workspaceFolder}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "node --no-deprecation test/dev.js _community",
|
"command": "node --no-deprecation test/dev.js fields",
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"name": "Run Dev Community",
|
"name": "Run Dev Community",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "node-terminal"
|
"type": "node-terminal"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "node --no-deprecation test/dev.js storage-uploadthing",
|
"command": "pnpm run dev live-preview -- --no-turbo",
|
||||||
"cwd": "${workspaceFolder}",
|
|
||||||
"name": "Uploadthing",
|
|
||||||
"request": "launch",
|
|
||||||
"type": "node-terminal",
|
|
||||||
"envFile": "${workspaceFolder}/test/storage-uploadthing/.env"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "node --no-deprecation test/dev.js live-preview",
|
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"name": "Run Dev Live Preview",
|
"name": "Run Dev Live Preview",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "node-terminal"
|
"type": "node-terminal"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"command": "node --no-deprecation test/loader/init.js",
|
|
||||||
"cwd": "${workspaceFolder}",
|
|
||||||
"name": "Run Loader",
|
|
||||||
"request": "launch",
|
|
||||||
"type": "node-terminal",
|
|
||||||
"env": {
|
|
||||||
"LOADER_TEST_FILE_PATH": "./dependency-test.js"
|
|
||||||
// "LOADER_TEST_FILE_PATH": "../fields/config.ts"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "node --no-deprecation test/dev.js admin",
|
|
||||||
"cwd": "${workspaceFolder}",
|
|
||||||
"name": "Run Dev Admin",
|
|
||||||
"request": "launch",
|
|
||||||
"type": "node-terminal"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "node --no-deprecation test/dev.js auth",
|
|
||||||
"cwd": "${workspaceFolder}",
|
|
||||||
"name": "Run Dev Auth",
|
|
||||||
"request": "launch",
|
|
||||||
"type": "node-terminal"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"command": "pnpm run dev plugin-cloud-storage",
|
"command": "pnpm run dev plugin-cloud-storage",
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
@@ -67,56 +34,49 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "node --no-deprecation test/dev.js collections-graphql",
|
"command": "pnpm run dev fields",
|
||||||
"cwd": "${workspaceFolder}",
|
|
||||||
"name": "Run Dev GraphQL",
|
|
||||||
"request": "launch",
|
|
||||||
"type": "node-terminal"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "node --no-deprecation test/dev.js fields",
|
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"name": "Run Dev Fields",
|
"name": "Run Dev Fields",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "node-terminal"
|
"type": "node-terminal"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "node --no-deprecation test/dev.js versions",
|
"command": "pnpm run dev:postgres versions",
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"name": "Run Dev Postgres",
|
"name": "Run Dev Postgres",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "node-terminal",
|
"type": "node-terminal"
|
||||||
"env": {
|
|
||||||
"PAYLOAD_DATABASE": "postgres"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "node --no-deprecation test/dev.js versions",
|
"command": "pnpm run dev versions",
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"name": "Run Dev Versions",
|
"name": "Run Dev Versions",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "node-terminal"
|
"type": "node-terminal"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "node --no-deprecation test/dev.js localization",
|
"command": "pnpm run dev localization",
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"name": "Run Dev Localization",
|
"name": "Run Dev Localization",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "node-terminal"
|
"type": "node-terminal"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "node --no-deprecation test/dev.js uploads",
|
"command": "pnpm run dev uploads",
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"name": "Run Dev Uploads",
|
"name": "Run Dev Uploads",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "node-terminal"
|
"type": "node-terminal"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "node --no-deprecation test/dev.js field-error-states",
|
"command": "PAYLOAD_BUNDLER=vite pnpm run dev fields",
|
||||||
"cwd": "${workspaceFolder}",
|
"cwd": "${workspaceFolder}",
|
||||||
"name": "Run Dev Field Error States",
|
"name": "Run Dev Fields (Vite)",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "node-terminal"
|
"type": "node-terminal",
|
||||||
|
"env": {
|
||||||
|
"NODE_ENV": "production"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "pnpm run test:int live-preview",
|
"command": "pnpm run test:int live-preview",
|
||||||
|
|||||||
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
@@ -40,10 +40,5 @@
|
|||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.fixAll.eslint": "explicit"
|
"source.fixAll.eslint": "explicit"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"files.insertFinalNewline": true,
|
|
||||||
"jestrunner.jestCommand": "pnpm exec cross-env NODE_OPTIONS=\"--experimental-vm-modules --no-deprecation\" node 'node_modules/jest/bin/jest.js'",
|
|
||||||
"jestrunner.debugOptions": {
|
|
||||||
"runtimeArgs": ["--experimental-vm-modules", "--no-deprecation"]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
|
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
|
||||||
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 { NotFoundPage, generatePageMetadata } from '@payloadcms/next/views'
|
import { NotFoundView } from '@payloadcms/next/views/NotFound/index.js'
|
||||||
|
|
||||||
type Args = {
|
type Args = {
|
||||||
params: {
|
params: {
|
||||||
@@ -14,9 +12,6 @@ type Args = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const generateMetadata = ({ params, searchParams }: Args): Promise<Metadata> =>
|
const NotFound = ({ params, searchParams }: Args) => NotFoundView({ config, params, searchParams })
|
||||||
generatePageMetadata({ config, params, searchParams })
|
|
||||||
|
|
||||||
const NotFound = ({ params, searchParams }: Args) => NotFoundPage({ config, params, searchParams })
|
|
||||||
|
|
||||||
export default NotFound
|
export default NotFound
|
||||||
|
|||||||
@@ -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: {
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
/* 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_OPTIONS, 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)
|
||||||
export const DELETE = REST_DELETE(config)
|
export const DELETE = REST_DELETE(config)
|
||||||
export const PATCH = REST_PATCH(config)
|
export const PATCH = REST_PATCH(config)
|
||||||
export const OPTIONS = REST_OPTIONS(config)
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
#custom-css {
|
|
||||||
font-family: monospace;
|
|
||||||
background-image: url('/placeholder.png');
|
|
||||||
}
|
|
||||||
|
|
||||||
#custom-css::after {
|
|
||||||
content: 'custom-css';
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,7 +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'
|
||||||
// import '@payloadcms/ui/styles.css' // Uncomment this line if `@payloadcms/ui/client` in `tsconfig.json` points to `/ui/dist` instead of `/ui/src`
|
|
||||||
/* 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'
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,8 @@
|
|||||||
import { useLivePreview } from '@payloadcms/live-preview-react'
|
import { useLivePreview } from '@payloadcms/live-preview-react'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
import type { Page as PageType } from '../../../../payload-types.js'
|
import type { Page as PageType } from '../../../../test/live-preview/payload-types.js'
|
||||||
|
|
||||||
import { renderedPageTitleID } from '../../../../shared.js'
|
|
||||||
import { PAYLOAD_SERVER_URL } from '../../_api/serverURL.js'
|
import { PAYLOAD_SERVER_URL } from '../../_api/serverURL.js'
|
||||||
import { Blocks } from '../../_components/Blocks/index.js'
|
import { Blocks } from '../../_components/Blocks/index.js'
|
||||||
import { Gutter } from '../../_components/Gutter/index.js'
|
import { Gutter } from '../../_components/Gutter/index.js'
|
||||||
@@ -22,6 +21,9 @@ export const PageClient: React.FC<{
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
|
<Gutter>
|
||||||
|
<h1 id="page-title">{data.title}</h1>
|
||||||
|
</Gutter>
|
||||||
<Hero {...data?.hero} />
|
<Hero {...data?.hero} />
|
||||||
<Blocks
|
<Blocks
|
||||||
blocks={[
|
blocks={[
|
||||||
@@ -36,9 +38,6 @@ export const PageClient: React.FC<{
|
|||||||
!data?.hero || data?.hero?.type === 'none' || data?.hero?.type === 'lowImpact'
|
!data?.hero || data?.hero?.type === 'none' || data?.hero?.type === 'lowImpact'
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Gutter>
|
|
||||||
<div id={renderedPageTitleID}>{`For Testing: ${data.title}`}</div>
|
|
||||||
</Gutter>
|
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1,22 +1,23 @@
|
|||||||
import { notFound } from 'next/navigation.js'
|
import { notFound } from 'next/navigation.js'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
import type { Page } from '../../../../payload-types.js'
|
import type { Page } from '../../../../test/live-preview/payload-types.js'
|
||||||
|
|
||||||
import { getDoc } from '../../_api/getDoc.js'
|
import { fetchDoc } from '../../_api/fetchDoc.js'
|
||||||
import { getDocs } from '../../_api/getDocs.js'
|
import { fetchDocs } from '../../_api/fetchDocs.js'
|
||||||
import { PageClient } from './page.client.js'
|
import { PageClient } from './page.client.js'
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-restricted-exports
|
||||||
export default async function Page({ params: { slug = 'home' } }) {
|
export default async function Page({ params: { slug = 'home' } }) {
|
||||||
let page: Page | null = null
|
let page: Page | null = null
|
||||||
|
|
||||||
try {
|
try {
|
||||||
page = await getDoc<Page>({
|
page = await fetchDoc<Page>({
|
||||||
slug,
|
slug,
|
||||||
collection: 'pages',
|
collection: 'pages',
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error) // eslint-disable-line no-console
|
console.error(error)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!page) {
|
if (!page) {
|
||||||
@@ -27,9 +28,8 @@ export default async function Page({ params: { slug = 'home' } }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function generateStaticParams() {
|
export async function generateStaticParams() {
|
||||||
process.env.PAYLOAD_DROP_DATABASE = 'false'
|
|
||||||
try {
|
try {
|
||||||
const pages = await getDocs<Page>('pages')
|
const pages = await fetchDocs<Page>('pages')
|
||||||
return pages?.map(({ slug }) => slug)
|
return pages?.map(({ slug }) => slug)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return []
|
return []
|
||||||
@@ -1,12 +1,10 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useLivePreview } from '@payloadcms/live-preview-react'
|
import { useLivePreview } from '@payloadcms/live-preview-react'
|
||||||
import { Gutter } from '@payloadcms/ui/elements/Gutter'
|
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
import type { Post as PostType } from '../../../../../payload-types.js'
|
import type { Post as PostType } from '../../../../../test/live-preview/payload-types.js'
|
||||||
|
|
||||||
import { postsSlug, renderedPageTitleID } from '../../../../../shared.js'
|
|
||||||
import { PAYLOAD_SERVER_URL } from '../../../_api/serverURL.js'
|
import { PAYLOAD_SERVER_URL } from '../../../_api/serverURL.js'
|
||||||
import { Blocks } from '../../../_components/Blocks/index.js'
|
import { Blocks } from '../../../_components/Blocks/index.js'
|
||||||
import { PostHero } from '../../../_heros/PostHero/index.js'
|
import { PostHero } from '../../../_heros/PostHero/index.js'
|
||||||
@@ -60,14 +58,11 @@ export const PostClient: React.FC<{
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
relationTo: postsSlug,
|
relationTo: 'posts',
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
disableTopPadding
|
disableTopPadding
|
||||||
/>
|
/>
|
||||||
<Gutter>
|
|
||||||
<div id={renderedPageTitleID}>{`For Testing: ${data.title}`}</div>
|
|
||||||
</Gutter>
|
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -1,20 +1,19 @@
|
|||||||
import { notFound } from 'next/navigation.js'
|
import { notFound } from 'next/navigation.js'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
import type { Post } from '../../../../../payload-types.js'
|
import type { Post } from '../../../../../test/live-preview/payload-types.js'
|
||||||
|
|
||||||
import { postsSlug } from '../../../../../shared.js'
|
import { fetchDoc } from '../../../_api/fetchDoc.js'
|
||||||
import { getDoc } from '../../../_api/getDoc.js'
|
import { fetchDocs } from '../../../_api/fetchDocs.js'
|
||||||
import { getDocs } from '../../../_api/getDocs.js'
|
|
||||||
import { PostClient } from './page.client.js'
|
import { PostClient } from './page.client.js'
|
||||||
|
|
||||||
export default async function Post({ params: { slug = '' } }) {
|
export default async function Post({ params: { slug = '' } }) {
|
||||||
let post: Post | null = null
|
let post: Post | null = null
|
||||||
|
|
||||||
try {
|
try {
|
||||||
post = await getDoc<Post>({
|
post = await fetchDoc<Post>({
|
||||||
slug,
|
slug,
|
||||||
collection: postsSlug,
|
collection: 'posts',
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error) // eslint-disable-line no-console
|
console.error(error) // eslint-disable-line no-console
|
||||||
@@ -28,10 +27,9 @@ export default async function Post({ params: { slug = '' } }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function generateStaticParams() {
|
export async function generateStaticParams() {
|
||||||
process.env.PAYLOAD_DROP_DATABASE = 'false'
|
|
||||||
try {
|
try {
|
||||||
const ssrPosts = await getDocs<Post>(postsSlug)
|
const posts = await fetchDocs<Post>('posts')
|
||||||
return ssrPosts?.map(({ slug }) => slug)
|
return posts?.map(({ slug }) => slug)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
35
app/live-preview/_api/fetchDoc.ts
Normal file
35
app/live-preview/_api/fetchDoc.ts
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import QueryString from 'qs'
|
||||||
|
|
||||||
|
import { PAYLOAD_SERVER_URL } from './serverURL.js'
|
||||||
|
|
||||||
|
export const fetchDoc = async <T>(args: {
|
||||||
|
collection: string
|
||||||
|
depth?: number
|
||||||
|
id?: string
|
||||||
|
slug?: string
|
||||||
|
}): Promise<T> => {
|
||||||
|
const { id, slug, collection, depth = 2 } = args || {}
|
||||||
|
|
||||||
|
const queryString = QueryString.stringify(
|
||||||
|
{
|
||||||
|
...(slug ? { 'where[slug][equals]': slug } : {}),
|
||||||
|
...(depth ? { depth } : {}),
|
||||||
|
},
|
||||||
|
{ addQueryPrefix: true },
|
||||||
|
)
|
||||||
|
|
||||||
|
const doc: T = await fetch(`${PAYLOAD_SERVER_URL}/api/${collection}${queryString}`, {
|
||||||
|
cache: 'no-store',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
method: 'GET',
|
||||||
|
})
|
||||||
|
?.then((res) => res.json())
|
||||||
|
?.then((res) => {
|
||||||
|
if (res.errors) throw new Error(res?.errors?.[0]?.message ?? 'Error fetching doc')
|
||||||
|
return res?.docs?.[0]
|
||||||
|
})
|
||||||
|
|
||||||
|
return doc
|
||||||
|
}
|
||||||
19
app/live-preview/_api/fetchDocs.ts
Normal file
19
app/live-preview/_api/fetchDocs.ts
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import { PAYLOAD_SERVER_URL } from './serverURL.js'
|
||||||
|
|
||||||
|
export const fetchDocs = async <T>(collection: string): Promise<T[]> => {
|
||||||
|
const docs: T[] = await fetch(`${PAYLOAD_SERVER_URL}/api/${collection}?depth=0&limit=100`, {
|
||||||
|
cache: 'no-store',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
method: 'GET',
|
||||||
|
})
|
||||||
|
?.then((res) => res.json())
|
||||||
|
?.then((res) => {
|
||||||
|
if (res.errors) throw new Error(res?.errors?.[0]?.message ?? 'Error fetching docs')
|
||||||
|
|
||||||
|
return res?.docs
|
||||||
|
})
|
||||||
|
|
||||||
|
return docs
|
||||||
|
}
|
||||||
25
app/live-preview/_api/fetchFooter.ts
Normal file
25
app/live-preview/_api/fetchFooter.ts
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import type { Footer } from '../../../test/live-preview/payload-types.js'
|
||||||
|
|
||||||
|
import { PAYLOAD_SERVER_URL } from './serverURL.js'
|
||||||
|
|
||||||
|
export async function fetchFooter(): Promise<Footer> {
|
||||||
|
if (!PAYLOAD_SERVER_URL) throw new Error('PAYLOAD_SERVER_URL not found')
|
||||||
|
|
||||||
|
const footer = await fetch(`${PAYLOAD_SERVER_URL}/api/globals/footer`, {
|
||||||
|
cache: 'no-store',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
method: 'GET',
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
if (!res.ok) throw new Error('Error fetching doc')
|
||||||
|
return res.json()
|
||||||
|
})
|
||||||
|
?.then((res) => {
|
||||||
|
if (res?.errors) throw new Error(res?.errors[0]?.message || 'Error fetching footer')
|
||||||
|
return res
|
||||||
|
})
|
||||||
|
|
||||||
|
return footer
|
||||||
|
}
|
||||||
25
app/live-preview/_api/fetchHeader.ts
Normal file
25
app/live-preview/_api/fetchHeader.ts
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import type { Header } from '../../../test/live-preview/payload-types.js'
|
||||||
|
|
||||||
|
import { PAYLOAD_SERVER_URL } from './serverURL.js'
|
||||||
|
|
||||||
|
export async function fetchHeader(): Promise<Header> {
|
||||||
|
if (!PAYLOAD_SERVER_URL) throw new Error('PAYLOAD_SERVER_URL not found')
|
||||||
|
|
||||||
|
const header = await fetch(`${PAYLOAD_SERVER_URL}/api/globals/header`, {
|
||||||
|
cache: 'no-store',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
method: 'GET',
|
||||||
|
})
|
||||||
|
?.then((res) => {
|
||||||
|
if (!res.ok) throw new Error('Error fetching doc')
|
||||||
|
return res.json()
|
||||||
|
})
|
||||||
|
?.then((res) => {
|
||||||
|
if (res?.errors) throw new Error(res?.errors[0]?.message || 'Error fetching header')
|
||||||
|
return res
|
||||||
|
})
|
||||||
|
|
||||||
|
return header
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { Page } from '../../../../payload-types.js'
|
import type { Page } from '../../../../test/live-preview/payload-types.js'
|
||||||
|
|
||||||
export type ArchiveBlockProps = Extract<
|
export type ArchiveBlockProps = Extract<
|
||||||
Exclude<Page['layout'], undefined>[0],
|
Exclude<Page['layout'], undefined>[0],
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
import type { Page } from '../../../../payload-types.js'
|
import type { Page } from '../../../../test/live-preview/payload-types.js'
|
||||||
|
|
||||||
import { Gutter } from '../../_components/Gutter/index.js'
|
import { Gutter } from '../../_components/Gutter/index.js'
|
||||||
import { CMSLink } from '../../_components/Link/index.js'
|
import { CMSLink } from '../../_components/Link/index.js'
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { Fragment } from 'react'
|
import React, { Fragment } from 'react'
|
||||||
|
|
||||||
import type { Page } from '../../../../payload-types.js'
|
import type { Page } from '../../../../test/live-preview/payload-types.js'
|
||||||
|
|
||||||
import { Gutter } from '../../_components/Gutter/index.js'
|
import { Gutter } from '../../_components/Gutter/index.js'
|
||||||
import { CMSLink } from '../../_components/Link/index.js'
|
import { CMSLink } from '../../_components/Link/index.js'
|
||||||
@@ -2,7 +2,7 @@ import type { StaticImageData } from 'next/image.js'
|
|||||||
|
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
import type { Page } from '../../../../payload-types.js'
|
import type { Page } from '../../../../test/live-preview/payload-types.js'
|
||||||
|
|
||||||
import { Gutter } from '../../_components/Gutter/index.js'
|
import { Gutter } from '../../_components/Gutter/index.js'
|
||||||
import { Media } from '../../_components/Media/index.js'
|
import { Media } from '../../_components/Media/index.js'
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
import type { Post } from '../../../../payload-types.js'
|
import type { Post } from '../../../../test/live-preview/payload-types.js'
|
||||||
|
|
||||||
import { Card } from '../../_components/Card/index.js'
|
import { Card } from '../../_components/Card/index.js'
|
||||||
import { Gutter } from '../../_components/Gutter/index.js'
|
import { Gutter } from '../../_components/Gutter/index.js'
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { Fragment } from 'react'
|
import React, { Fragment } from 'react'
|
||||||
|
|
||||||
import type { Page } from '../../../../payload-types.js'
|
import type { Page } from '../../../../test/live-preview/payload-types.js'
|
||||||
|
|
||||||
import { Gutter } from '../../_components/Gutter/index.js'
|
import { Gutter } from '../../_components/Gutter/index.js'
|
||||||
import RichText from '../../_components/RichText/index.js'
|
import RichText from '../../_components/RichText/index.js'
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import React, { Fragment } from 'react'
|
import React, { Fragment } from 'react'
|
||||||
|
|
||||||
import type { Page } from '../../../../payload-types.js'
|
import type { Page } from '../../../../test/live-preview/payload-types.js'
|
||||||
import type { RelationshipsBlockProps } from '../../_blocks/Relationships/index.js'
|
import type { RelationshipsBlockProps } from '../../_blocks/Relationships/index.js'
|
||||||
import type { VerticalPaddingOptions } from '../VerticalPadding/index.js'
|
import type { VerticalPaddingOptions } from '../VerticalPadding/index.js'
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import LinkWithDefault from 'next/link.js'
|
import LinkWithDefault from 'next/link.js'
|
||||||
import React, { Fragment } from 'react'
|
import React, { Fragment } from 'react'
|
||||||
|
|
||||||
import type { Post } from '../../../../payload-types.js'
|
import type { Post } from '../../../../test/live-preview/payload-types.js'
|
||||||
|
|
||||||
import { Media } from '../Media/index.js'
|
import { Media } from '../Media/index.js'
|
||||||
import classes from './index.module.scss'
|
import classes from './index.module.scss'
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
import qs from 'qs'
|
import qs from 'qs'
|
||||||
import React, { Fragment, useCallback, useEffect, useRef, useState } from 'react'
|
import React, { Fragment, useCallback, useEffect, useRef, useState } from 'react'
|
||||||
|
|
||||||
import type { Post } from '../../../../../payload-types.js'
|
import type { Post } from '../../../../../test/live-preview/payload-types.js'
|
||||||
import type { ArchiveBlockProps } from '../../../_blocks/ArchiveBlock/types.js'
|
import type { ArchiveBlockProps } from '../../../_blocks/ArchiveBlock/types.js'
|
||||||
|
|
||||||
import { PAYLOAD_SERVER_URL } from '../../../_api/serverURL.js'
|
import { PAYLOAD_SERVER_URL } from '../../../_api/serverURL.js'
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import LinkWithDefault from 'next/link.js'
|
import LinkWithDefault from 'next/link.js'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
import { getFooter } from '../../_api/getFooter.js'
|
import { fetchFooter } from '../../_api/fetchFooter.js'
|
||||||
import { Gutter } from '../Gutter/index.js'
|
import { Gutter } from '../Gutter/index.js'
|
||||||
import { CMSLink } from '../Link/index.js'
|
import { CMSLink } from '../Link/index.js'
|
||||||
import classes from './index.module.scss'
|
import classes from './index.module.scss'
|
||||||
@@ -9,7 +9,7 @@ import classes from './index.module.scss'
|
|||||||
const Link = (LinkWithDefault.default || LinkWithDefault) as typeof LinkWithDefault.default
|
const Link = (LinkWithDefault.default || LinkWithDefault) as typeof LinkWithDefault.default
|
||||||
|
|
||||||
export async function Footer() {
|
export async function Footer() {
|
||||||
const footer = await getFooter()
|
const footer = await fetchFooter()
|
||||||
|
|
||||||
const navItems = footer?.navItems || []
|
const navItems = footer?.navItems || []
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import LinkWithDefault from 'next/link.js'
|
import LinkWithDefault from 'next/link.js'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
import { getHeader } from '../../_api/getHeader.js'
|
import { fetchHeader } from '../../_api/fetchHeader.js'
|
||||||
import { Gutter } from '../Gutter/index.js'
|
import { Gutter } from '../Gutter/index.js'
|
||||||
import { HeaderNav } from './Nav/index.js'
|
import { HeaderNav } from './Nav/index.js'
|
||||||
import classes from './index.module.scss'
|
import classes from './index.module.scss'
|
||||||
@@ -9,7 +9,7 @@ import classes from './index.module.scss'
|
|||||||
const Link = (LinkWithDefault.default || LinkWithDefault) as typeof LinkWithDefault.default
|
const Link = (LinkWithDefault.default || LinkWithDefault) as typeof LinkWithDefault.default
|
||||||
|
|
||||||
export async function Header() {
|
export async function Header() {
|
||||||
const header = await getHeader()
|
const header = await fetchHeader()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header className={classes.header}>
|
<header className={classes.header}>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import LinkWithDefault from 'next/link.js'
|
import LinkWithDefault from 'next/link.js'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
|
||||||
import type { Page, Post } from '../../../../payload-types.js'
|
import type { Page, Post } from '../../../../test/live-preview/payload-types.js'
|
||||||
import type { Props as ButtonProps } from '../Button/index.js'
|
import type { Props as ButtonProps } from '../Button/index.js'
|
||||||
|
|
||||||
import { Button } from '../Button/index.js'
|
import { Button } from '../Button/index.js'
|
||||||
@@ -11,7 +11,7 @@ export const Media: React.FC<Props> = (props) => {
|
|||||||
const { className, htmlElement = 'div', resource } = props
|
const { className, htmlElement = 'div', resource } = props
|
||||||
|
|
||||||
const isVideo = typeof resource !== 'string' && resource?.mimeType?.includes('video')
|
const isVideo = typeof resource !== 'string' && resource?.mimeType?.includes('video')
|
||||||
const Tag = htmlElement || Fragment
|
const Tag = (htmlElement as ElementType) || Fragment
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tag
|
<Tag
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import LinkWithDefault from 'next/link.js'
|
import LinkWithDefault from 'next/link.js'
|
||||||
import React, { Fragment } from 'react'
|
import React, { Fragment } from 'react'
|
||||||
|
|
||||||
import type { Post } from '../../../../payload-types.js'
|
import type { Post } from '../../../../test/live-preview/payload-types.js'
|
||||||
|
|
||||||
import { PAYLOAD_SERVER_URL } from '../../_api/serverURL.js'
|
import { PAYLOAD_SERVER_URL } from '../../_api/serverURL.js'
|
||||||
import { Gutter } from '../../_components/Gutter/index.js'
|
import { Gutter } from '../../_components/Gutter/index.js'
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user