|
| 1 | +# Payload Monorepo Agent Instructions |
| 2 | + |
| 3 | +## Project Structure |
| 4 | + |
| 5 | +- Packages are located in the `packages/` directory. |
| 6 | + - The main Payload package is `packages/payload`. This contains the core functionality. |
| 7 | + - Database adapters are in `packages/db-*`. |
| 8 | + - The UI package is `packages/ui`. |
| 9 | + - The Next.js integration is in `packages/next`. |
| 10 | + - Rich text editor packages are in `packages/richtext-*`. |
| 11 | + - Storage adapters are in `packages/storage-*`. |
| 12 | + - Email adapters are in `packages/email-*`. |
| 13 | + - Plugins which add additional functionality are in `packages/plugin-*`. |
| 14 | +- Documentation is in the `docs/` directory. |
| 15 | +- Monorepo tooling is in the `tools/` directory. |
| 16 | +- Test suites and configs are in the `test/` directory. |
| 17 | +- LLMS.txt is at URL: https://payloadcms.com/llms.txt |
| 18 | +- LLMS-FULL.txt is at URL: https://payloadcms.com/llms-full.txt |
| 19 | + |
| 20 | +## Dev environment tips |
| 21 | + |
| 22 | +- Any package can be built using a `pnpm build:*` script defined in the root `package.json`. These typically follow the format `pnpm build:<directory_name>`. The options are all of the top-level directories inside the `packages/` directory. Ex `pnpm build:db-mongodb` which builds the `packages/db-mongodb` package. |
| 23 | +- ALL packages can be built with `pnpm build:all`. |
| 24 | +- Use `pnpm dev` to start the monorepo dev server. This loads the default config located at `test/_community/config.ts`. |
| 25 | +- Specific dev configs for each package can be run with `pnpm dev <directory_name>`. The options are all of the top-level directories inside the `test/` directory. Ex `pnpm dev fields` which loads the `test/fields/config.ts` config. The directory name can either encompass a single area of functionality or be the name of a specific package. |
| 26 | + |
| 27 | +## Testing instructions |
| 28 | + |
| 29 | +- There are unit, integration, and e2e tests in the monorepo. |
| 30 | +- Unit tests can be run with `pnpm test:unit`. |
| 31 | +- Integration tests can be run with `pnpm test:int`. Individual test suites can be run with `pnpm test:int <directory_name>`, which will point at `test/<directory_name>/int.spec.ts`. |
| 32 | +- E2E tests can be run with `pnpm test:e2e`. |
| 33 | +- All tests can be run with `pnpm test`. |
| 34 | +- Prefer running `pnpm test:int` for verifying local code changes. |
| 35 | + |
| 36 | +## PR Guidelines |
| 37 | + |
| 38 | +- This repository follows conventional commits for PR titles |
| 39 | +- PR Title format: <type>(<scope>): <title>. Title must start with a lowercase letter. |
| 40 | +- Valid types are build, chore, ci, docs, examples, feat, fix, perf, refactor, revert, style, templates, test |
| 41 | +- Prefer `feat` for new features and `fix` for bug fixes. |
| 42 | +- Valid scopes are the following regex patterns: cpa, db-\*, db-mongodb, db-postgres, db-vercel-postgres, db-sqlite, drizzle, email-\*, email-nodemailer, email-resend, eslint, graphql, live-preview, live-preview-react, next, payload-cloud, plugin-cloud, plugin-cloud-storage, plugin-form-builder, plugin-import-export, plugin-multi-tenant, plugin-nested-docs, plugin-redirects, plugin-search, plugin-sentry, plugin-seo, plugin-stripe, richtext-\*, richtext-lexical, richtext-slate, storage-\*, storage-azure, storage-gcs, storage-uploadthing, storage-vercel-blob, storage-s3, translations, ui, templates, examples(\/(\w|-)+)?, deps |
| 43 | +- Scopes should be chosen based upon the package(s) being modified. If multiple packages are being modified, choose the most relevant one or no scope at all. |
| 44 | +- Example PR titles: |
| 45 | + - `feat(db-mongodb): add support for transactions` |
| 46 | + - `feat(richtext-lexical): add options to hide block handles` |
| 47 | + - `fix(ui): json field type ignoring editorOptions` |
| 48 | + |
| 49 | +## Commit Guidelines |
| 50 | + |
| 51 | +- This repository follows conventional commits for commit messages |
| 52 | +- The first commit of a branch should follow the PR title format: <type>(<scope>): <title>. Follow the same rules as PR titles. |
| 53 | +- Subsequent commits should prefer `chore` commits without a scope unless a specific package is being modified. |
| 54 | +- These will eventually be squashed into the first commit when merging the PR. |
0 commit comments