-
Notifications
You must be signed in to change notification settings - Fork 36
[create-content-sdk-app] document auto-generated component maps in agent guides #523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from 3 commits
c5f792e
1a847e6
78b0d33
a978095
99c4f66
7352c53
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'create-content-sdk-app': minor | ||
| --- | ||
|
|
||
| [create-content-sdk-app] Update template agent docs to describe auto-generated component maps | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,12 +16,14 @@ Scaffold new Sitecore components so they integrate with the layout and editing p | |
| ## How to perform | ||
|
|
||
| - Create a new file under `src/components/` (or existing feature folder). Define props (fields, params), export a single default component. | ||
| - Decide Server vs Client: default Server; add `'use client'` only if the component needs hooks or event handlers. | ||
| - Register the component in the correct map (content-sdk-component-registration). Run `npm run build` to verify. | ||
| - Decide Server vs Client: default Server; add `'use client'` only for hooks or event handlers. | ||
| - **Map:** Regenerates automatically during `npm run dev` and `npm run build`; otherwise run `npm run sitecore-tools:generate-map` (see content-sdk-component-registration). | ||
| - Run `npm run build` to verify. | ||
|
|
||
| ## 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. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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.")
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| - 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. | ||
| - **Server vs Client:** Use Server Components by default. Add `'use client'` only for interactivity (hooks, event handlers). Register Server components in `.sitecore/component-map.ts`; Client components in `.sitecore/component-map.client.ts`. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,12 +16,14 @@ Scaffold new Sitecore components so they integrate with the layout and editing p | |
| ## How to perform | ||
|
|
||
| - Create a new file under `src/components/` (or existing feature folder). Define props (fields, params), export a single default component. | ||
| - Decide Server vs Client: default Server; add `'use client'` only if the component needs hooks or event handlers. | ||
| - Register the component in the correct map (content-sdk-component-registration). Run `npm run build` to verify. | ||
| - Decide Server vs Client: default Server; add `'use client'` only for hooks or event handlers. | ||
| - **Map:** Regenerates automatically during `npm run dev` and `npm run build`; otherwise run `npm run sitecore-tools:generate-map` (see content-sdk-component-registration). | ||
| - Run `npm run build` to verify. | ||
|
|
||
| ## 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. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This new rule conflicts with line 30 just below
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
| - 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. | ||
| - **Server vs Client:** Use Server Components by default. Add `'use client'` only for interactivity (hooks, event handlers). Register Server components in `.sitecore/component-map.ts`; Client components in `.sitecore/component-map.client.ts`. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's set a
patchrelease, 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 aspatchThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done