A Payload site, ready to clone

Placeholder: concentric circles in violet

Generated types that change only with the schema

What changed

src/payload-types.ts, the TypeScript types Payload generates from the configuration, used to be rewritten whenever the dev server or a migration command started, with the locales of whichever machine ran it. Two developers with different LOCALES got different files, and branches that each regenerated it conflicted. Now nothing rewrites it on start, here or in a derived project, and pnpm generate:types always writes it with the same locales (English, Spanish and Catalan), so the file changes only when the schema does, in the same commit as the field or collection that changed it.

The check

pnpm check:types generates the file to a temporary place and compares: when a schema change wasn’t followed by pnpm generate:types, it fails and says so. It needs no database and takes a few seconds, and pnpm check:migrations runs it first, so the check made before merging a schema change, and every release, catches it.

Where to see it

Nothing changes on the site or in the admin: this is for whoever works on the template. The README section “Generated types (payload-types.ts)” has the rule and what the file depends on. In a derived project the file is still template-site’s, brought by the sync.

After a schema change
pnpm generate:types
pnpm check:migrations   # runs check:types first