ci: re-enable template builds#16880
Merged
Merged
Conversation
Contributor
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖 |
paulpopus
approved these changes
Jun 4, 2026
AlessioGr
approved these changes
Jun 4, 2026
denolfe
added a commit
that referenced
this pull request
Jun 5, 2026
# Overview The `build-and-test-templates` CI job was disabled while 4.x breaking changes landed, so the templates drifted and no longer build against current core packages. This updates each template to the new 4.x APIs so they build again. CI for the re-enabled job: [#16880](#16880). ## Key Changes - **Storage adapters moved from `plugins` to `storage`** - 4.x initializes storage adapters from a top-level `storage` array instead of `plugins` (#16596). `vercelBlobStorage` / `r2Storage` calls were relocated in `with-vercel-mongodb`, `with-vercel-postgres`, `with-vercel-website`, and `with-cloudflare-d1`. This was the source of the `TypeError: plugin is not a function` failures. Applied with `@payloadcms/codemod`'s `migrate-storage-adapters-to-config`. - **Import maps point at `@payloadcms/ui` instead of removed `@payloadcms/next` subpaths** - The `@payloadcms/next/rsc` and `@payloadcms/next/client` subpaths were removed; generated import maps now reference `@payloadcms/ui/rsc` and `@payloadcms/ui`. Applied with `@payloadcms/codemod`'s `migrate-next-subpath-exports` across all templates. - **Bare `src/` imports replaced with the `@/` path alias** - Website-based templates imported from `src/...`, which no longer resolves under Turbopack. Switched to the configured `@/` alias (maps to `./src/*`). - **Slug generic dropped on `Pages` / `Posts` (TypeScript 6 regression workaround)** - The documented `CollectionConfig<'pages'>` + `defaultPopulate` pattern compiled under TypeScript 5.7 (3.x) but not under TypeScript 6.0.3 (the #16692 bump): the generated select interface is no longer assignable to the `SelectType` that the `collections` array element expects. Dropping the generic lets `defaultPopulate` fall back to `SelectType` so the templates build, at the cost of field-name checking on `defaultPopulate`. This is a core type regression that affects any 4.x project using the pattern under TS 6, so the real fix belongs in core; the templates carry a commented workaround to be reverted once that lands. ## Design Decisions Most changes were applied with `@payloadcms/codemod` rather than by hand, so the same transforms users will run produce the same result. Import maps are left as the minimal subpath rewrite rather than a full local regeneration, since `payload build` regenerates them during the build. Scope is template builds. All six matrix templates build with packed local packages, verified locally via `script:pack --all` + `build-template-with-local-pkgs`. The remaining E2E failures on `blank` and `website` (`chunk.reason.enqueueModel is not a function` when loading the admin under `next dev`) are a pre-existing runtime issue, present before this change and unrelated to the build fixes. Only the workspace templates (`blank`, `website`, `ecommerce`) run E2E in this job; `pnpm --filter` does not match the non-workspace templates, so their E2E and int steps currently no-op. --- - To see the specific tasks where the Asana app for GitHub is being used, see below: - https://app.asana.com/0/0/1215426886664378
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Re-enables the
build-and-test-templatesCI job, disabled in #16371 while it required a published 4.x release of the workspace packages on npm.The job now builds templates against fully local packages and runs non-blocking, so it surfaces template breakage on 4.x without gating PRs.
Key Changes
Re-enabled the job, non-blocking
if: needs.changes.outputs.needs_build == 'true'(wasif: false) and addedcontinue-on-error: true, matching the existingtests-content-apipattern. Failures show up in CI but do not fail theall-greengate until templates are updated for 4.x breaking changes.Made the local package install hermetic
script:pack --all) and rewritesbuild-template-with-local-pkgsto point every@payloadcms/*(andpayload) dependency at its localfile:tarball, in both the dependency entries andpnpm.overrides, before a single install.Design Decisions
The previous flow ran
pnpm add ./*.tgzbefore setting overrides. That first install resolved the tarballs' internal cross-dependencies (@payloadcms/translations,@payloadcms/plugin-cloud-storage, and others) from npm at the in-repo version, which during 4.x beta is unpublished, so it failed withERR_PNPM_NO_MATCHING_VERSION. That is what kept the job disabled.Setting
file:overrides for the full set of packed packages up front forces every workspace dependency, direct and transitive, to resolve to a local tarball. The install no longer touches npm for any@payloadcmspackage, so the job works regardless of what is published. This mirrors the approach already used bytest/setupProd.tsfor the prod E2E job.Templates still pin the 3.x config API (for example, storage adapters passed to
pluginsrather than the 4.xstoragearray), so the builds currently fail once packages resolve. Running the job non-blocking surfaces that work without holding up merges; thecontinue-on-errorflag comes off once the templates are migrated.