[create-content-sdk-app] document auto-generated component maps in agent guides#523
[create-content-sdk-app] document auto-generated component maps in agent guides#523sc-naveenhedallaarachchi wants to merge 6 commits into
Conversation
🦋 Changeset detectedLatest commit: 7352c53 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📦 Package Size and Test Coverage Report
|
| - Prefer `sitecore-tools:generate-map` to regenerate `.sitecore/component-map.ts` instead of hand-editing it. Only manually register the component if the generator cannot handle the change. | ||
| - Define a props interface with the component's fields (e.g. `fields: { title: Field; ... }`) and any params. Use types from `@sitecore-content-sdk/react` or the app's types. | ||
| - Export a single default component; one component per file unless the app pattern differs. | ||
| - After creating the component file, register it in `.sitecore/component-map.ts` (see content-sdk-component-registration). Do not leave the component unregistered. Pages Router has a single map used by getComponentData and editing API routes. |
There was a problem hiding this comment.
This line directly contradicts the new guidance added a few lines above: "Prefer sitecore-tools:generate-map... Only manually register the component if the generator cannot handle the change."
An agent reading this file will get "don't hand-edit" and "you must register it, don't leave it unregistered" in the same Hard Rules block - I think this is the exact failure reported in the issue.
I would suggest rewording to something like: "Ensure the component map regenerates (or update it manually only if the generator can't handle the case) before considering the task complete."
There was a problem hiding this comment.
Done
| ## Hard Rules | ||
|
|
||
| - Place components under `src/components/`. Use existing folder conventions. | ||
| - Prefer `sitecore-tools:generate-map` to regenerate the component maps instead of hand-editing them. Only manually register the component if the generator cannot handle the change. |
There was a problem hiding this comment.
This new rule conflicts with line 30 just below
("After creating the component file, register it in the correct component map ... Do not leave the component unregistered."). The contradiction is the same as in the Pages Router template: "prefer the generator, only hand-edit if it can't handle it" vs. "you must manually register it, don't leave it unregistered." Please reconcile line 30.
There was a problem hiding this comment.
Done
| ## Hard Rules | ||
|
|
||
| - Place components under `src/components/`. Use existing folder conventions. | ||
| - Prefer `sitecore-tools:generate-map` to regenerate the component maps instead of hand-editing them. Only manually register the component if the generator cannot handle the change. |
There was a problem hiding this comment.
Same issue as the other two templates: this new rule conflicts with line 31 just below ("After creating the component file, register it in the correct component map ... Do not leave the component unregistered.")
There was a problem hiding this comment.
Done
| ### Component map and layout | ||
|
|
||
| - **Component map:** `.sitecore/component-map.ts` — register all Sitecore components. Keep in sync with components under `src/components/`. | ||
| - **Component map:** `.sitecore/component-map.ts` — register all Sitecore components. Is auto-generated from `src/components/`. Do not edit manually unless needed. |
There was a problem hiding this comment.
Let's improve a bit:
register all Sitecore components. Is auto-generated from -> Lists every Sitecore component the layout can render, the map is auto-generated from
There was a problem hiding this comment.
Done
| @@ -0,0 +1,5 @@ | |||
| --- | |||
| 'create-content-sdk-app': minor | |||
There was a problem hiding this comment.
Let's set a patch release, since it doesn't really bring any features to the create-content-sdk-app CLI, usually if we have some internal changes in templates we just mark it as patch
There was a problem hiding this comment.
Done
| ### More (component map, editing, env) | ||
|
|
||
| - **Component map:** `.sitecore/component-map.ts` — register every Sitecore component here; keep in sync with `src/components/`. Used by `getComponentData` and by the editing API routes. | ||
| - **Component map:** `.sitecore/component-map.ts` — register every Sitecore component here; Is auto-generated from `src/components/`. Do not edit manually unless needed. Used by `getComponentData` and by the editing API routes. |
There was a problem hiding this comment.
Let's improve a bit:
register all Sitecore components. Is auto-generated from -> Lists every Sitecore component the layout can render, the map is auto-generated from
There was a problem hiding this comment.
Done
| ### Component maps and layout | ||
|
|
||
| - **Server/client components:** `.sitecore/component-map.ts` (Server); `.sitecore/component-map.client.ts` (Client). Register all Sitecore components; keep in sync with `src/components/`. | ||
| - **Server/client components:** `.sitecore/component-map.ts` (Server) and `.sitecore/component-map.client.ts` (Client) — register all Sitecore components. Are auto-generated from `src/components/`. Do not edit manually unless needed. |
There was a problem hiding this comment.
Could you please update all the similar occurrences?
| - **Server/client components:** `.sitecore/component-map.ts` (Server) and `.sitecore/component-map.client.ts` (Client) — register all Sitecore components. Are auto-generated from `src/components/`. Do not edit manually unless needed. | |
| - **Server/client components:** `.sitecore/component-map.ts` (Server) and `.sitecore/component-map.client.ts` (Client) — Lists every Sitecore component the layout can render, the map is auto-generated from `src/components/`. Do not edit manually unless needed. |
There was a problem hiding this comment.
Done, updated all occurrences.
Description / Motivation
Template agent docs still described manually editing component maps. All three Next.js templates already generate maps during
npm run devandnpm run buildviasitecore-tools:generate-map.This PR updates
AGENTS.md,Skills.md, and related component skills innextjs,nextjs-app-router, andnextjs-app-router-cache-componentsto reflect that workflow.Testing Details
Documentation-only change. Reviewed for consistency across templates.
Types of changes