From 291e128489d0d776c48c806c508b1f927adf7a3c Mon Sep 17 00:00:00 2001 From: Danijel Martinek Date: Thu, 21 May 2026 11:25:55 +0200 Subject: [PATCH] fix(generators): emit cms barrel in feature template MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The feature generator emitted no `src/integrations/cms/index.ts`, but `gen job` and `gen event consume` both `assertAnchors` on that file's `` anchor — so they failed on any freshly-scaffolded feature. Add a `cms/index.ts.hbs` template carrying the anchor, wire the add action into the generator, and export `./cms` from the package.json template to match all five existing features. --- turbo/generators/config.ts | 12 +++++++++++- turbo/generators/templates/feature/package.json.hbs | 1 + .../feature/src/integrations/cms/index.ts.hbs | 7 +++++++ 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 turbo/generators/templates/feature/src/integrations/cms/index.ts.hbs diff --git a/turbo/generators/config.ts b/turbo/generators/config.ts index 63255b2..933d168 100644 --- a/turbo/generators/config.ts +++ b/turbo/generators/config.ts @@ -20,7 +20,8 @@ import { registerFeatureInReleasePlease } from "./lib/release-please-utils.js"; * * Scope (intentionally limited): * - Single entity, single use case (`getX`) - * - Skips Payload CMS collection/global templates (integrations/cms/**) + * - Skips Payload CMS collection/global templates — emits only the + * integrations/cms/index.ts barrel (with the `` anchor) * - Skips UI query helpers (ui/query.ts) — emits an empty barrel * - Skips faker-driven factories — emits empty stubs * - Skips multi-entity / multi-use-case @@ -276,6 +277,15 @@ export default function generator(plop: PlopTypes.NodePlopAPI): void { "templates/feature/src/integrations/api/router.test.ts.hbs", }, + // Integrations: cms barrel — carries no collections (the generator skips + // Payload templates) but provides the `` anchor that + // `gen job` and `gen event consume` splice into. + { + type: "add", + path: "packages/{{kebabCase name}}/src/integrations/cms/index.ts", + templateFile: "templates/feature/src/integrations/cms/index.ts.hbs", + }, + // Seeds + factories + contracts (minimal stubs that still typecheck/test) { type: "add", diff --git a/turbo/generators/templates/feature/package.json.hbs b/turbo/generators/templates/feature/package.json.hbs index b0f98f3..8891626 100644 --- a/turbo/generators/templates/feature/package.json.hbs +++ b/turbo/generators/templates/feature/package.json.hbs @@ -6,6 +6,7 @@ "exports": { ".": "./src/index.ts", "./ui": "./src/ui/index.ts", + "./cms": "./src/integrations/cms/index.ts", "./api": "./src/integrations/api/router.ts", "./di/bind-production": "./src/di/bind-production.ts", "./di/bind-dev-seed": "./src/di/bind-dev-seed.ts" diff --git a/turbo/generators/templates/feature/src/integrations/cms/index.ts.hbs b/turbo/generators/templates/feature/src/integrations/cms/index.ts.hbs new file mode 100644 index 0000000..8197813 --- /dev/null +++ b/turbo/generators/templates/feature/src/integrations/cms/index.ts.hbs @@ -0,0 +1,7 @@ +// Payload CMS integration barrel for @repo/{{kebabCase name}}. +// Re-export this feature's collections and globals here as you add them +// under ./collections and ./globals. See packages/navigation/src/integrations/cms +// for the canonical shape. The `` anchor below is required by +// `pnpm turbo gen job` and `pnpm turbo gen event` — do not remove it. +export {}; +//