This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { withPayload } from '@payloadcms/next/withPayload'; | |
import { resolve } from 'path'; | |
/** @type {import('next').NextConfig} */ | |
const nextConfig = { | |
experimental: { | |
serverOnlyDependencies: [resolve(import.meta.dirname, 'payload.config.proxy.ts')], | |
}, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { randomBytes } from 'crypto' | |
import { sql } from 'drizzle-orm' | |
import { buildConfigWithDefaults } from '../buildConfigWithDefaults.js' | |
import { devUser } from '../credentials.js' | |
import { PostsCollection } from './collections/Posts/index.js' | |
import { MenuGlobal } from './globals/Menu/index.js' | |
export const chunkArray = <T>(array: T[], length: number): T[][] => { | |
return Array.from({ length: Math.ceil(array.length / length) }, (_, i) => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.9" | |
services: | |
postgres: | |
image: postgres:14-alpine | |
restart: unless-stopped | |
ports: | |
- 5432:5432 | |
volumes: | |
- data:/var/lib/postgresql/data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Place this to ./src/scripts/bump-payload.ts | |
* Then in your package.json add script: | |
* "bump-payload": "tsx ./src/scripts/bump-payload.ts ./package.json && pnpm i" | |
* Run `pnpm bump-payload` | |
*/ | |
import { execSync } from 'child_process'; | |
import fs from 'fs'; | |
import path from 'path'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable require-await */ | |
import type { BulkOperationResult } from 'node_modules/payload/dist/collections/config/types'; | |
import type { PaginatedDocs } from 'payload/database'; | |
import type { Where } from 'payload/types'; | |
import type { Config } from 'payload-types'; | |
import type { DeepPartial } from 'ts-essentials'; | |
import type { APIBuilderArgs } from './types'; | |
import { buildQueryString } from './buildQueryString'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dotenv from 'dotenv'; | |
import path from 'path'; | |
import payload from 'payload'; | |
dotenv.config({ | |
path: path.resolve(__dirname, '../.env'), | |
}); | |
const collections = [ | |
'products', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Usage example | |
// http://localhost:3000/api/example?sort[title]=1&sort[createdAt]=1 | |
// or with qs.stringify({sort: {title: 1, createadAt: 1} }) | |
const Pages: CollectionConfig = { | |
/// ..., | |
endpoints: [ | |
{ | |
path: '/', | |
handler: findHandler, |