@se-studio/project-build 1.0.62 → 1.0.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@se-studio/project-build",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.64",
|
|
4
4
|
"description": "Build tools and management scripts for SE Studio projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -59,13 +59,13 @@
|
|
|
59
59
|
"@biomejs/wasm-nodejs": "^2.3.14",
|
|
60
60
|
"change-case": "^5.4.4",
|
|
61
61
|
"chroma-js": "^3.2.0",
|
|
62
|
-
"contentful-management": "^11.
|
|
63
|
-
"dotenv": "^17.2.
|
|
62
|
+
"contentful-management": "^11.69.1",
|
|
63
|
+
"dotenv": "^17.2.4",
|
|
64
64
|
"ts-morph": "27.0.2"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/chroma-js": "^3.1.2",
|
|
68
|
-
"@types/node": "^22.19.
|
|
68
|
+
"@types/node": "^22.19.10",
|
|
69
69
|
"contentful": "^11.10.3",
|
|
70
70
|
"typescript": "^5.9.3"
|
|
71
71
|
},
|
|
@@ -81,13 +81,13 @@ import {
|
|
|
81
81
|
type CollectionRenderer,
|
|
82
82
|
cn,
|
|
83
83
|
defineCollection,
|
|
84
|
+
getPreviewFieldProps,
|
|
84
85
|
RtfOrString,
|
|
85
86
|
UnusedChecker,
|
|
86
87
|
} from '@se-studio/core-ui';
|
|
87
88
|
import { SectionLinks } from '@/elements/SectionLinks';
|
|
88
89
|
import { Section } from '@/framework/Section';
|
|
89
90
|
import type { ICollection, IComponent, IContent } from '@/lib/cms';
|
|
90
|
-
import { getPreviewFieldIdProps } from '@/lib/cms-server';
|
|
91
91
|
import { getSizingInformation } from '@/lib/SizingInformation';
|
|
92
92
|
// import MyCollectionClient from './MyCollectionClient'; // If needed
|
|
93
93
|
|
|
@@ -162,7 +162,7 @@ const CoreMyCollection: React.FC<
|
|
|
162
162
|
<div className="text-center space-y-4">
|
|
163
163
|
{heading && (
|
|
164
164
|
<Element
|
|
165
|
-
{...
|
|
165
|
+
{...getPreviewFieldProps(rendererConfig, id, 'heading')}
|
|
166
166
|
className={cn(sizingInformation.h2)}
|
|
167
167
|
>
|
|
168
168
|
{heading}
|
|
@@ -170,7 +170,7 @@ const CoreMyCollection: React.FC<
|
|
|
170
170
|
)}
|
|
171
171
|
{body && (
|
|
172
172
|
<RtfOrString
|
|
173
|
-
{...
|
|
173
|
+
{...getPreviewFieldProps(rendererConfig, id, 'body')}
|
|
174
174
|
content={body}
|
|
175
175
|
className="rtf-standard"
|
|
176
176
|
rendererConfig={rendererConfig}
|
|
@@ -197,6 +197,7 @@ const CoreMyCollection: React.FC<
|
|
|
197
197
|
{links && (
|
|
198
198
|
<SectionLinks
|
|
199
199
|
links={links}
|
|
200
|
+
rendererConfig={rendererConfig}
|
|
200
201
|
trackingLocation={cmsLabel}
|
|
201
202
|
analyticsContext={contentContext.analyticsContext}
|
|
202
203
|
className="justify-center"
|
|
@@ -215,7 +216,11 @@ const MyCollection: React.FC<
|
|
|
215
216
|
}
|
|
216
217
|
> = ({ information, ...rest }) => {
|
|
217
218
|
return (
|
|
218
|
-
<Section
|
|
219
|
+
<Section
|
|
220
|
+
componentName={information.collectionType}
|
|
221
|
+
information={information}
|
|
222
|
+
previewHelpers={rest.rendererConfig?.previewHelpers}
|
|
223
|
+
>
|
|
219
224
|
<CoreMyCollection
|
|
220
225
|
{...rest}
|
|
221
226
|
positionClassName="col-span-full"
|
|
@@ -271,13 +276,16 @@ export const MyCollectionRegistration = defineCollection({
|
|
|
271
276
|
2. **Use `defineCollection`**:
|
|
272
277
|
* Instead of `defineComponent`.
|
|
273
278
|
* Pass both `usedFields` and `cardUsedFields`.
|
|
274
|
-
3. **
|
|
279
|
+
3. **Preview helpers**:
|
|
280
|
+
* Use `getPreviewFieldProps(rendererConfig, id, fieldId)` from `@se-studio/core-ui` for CMS preview (do not import from cms-server – avoids circular dependency). For responsive visuals use `getPreviewResponsiveVisualFieldProps(rendererConfig, id, 'visual', 'mobileVisual')`.
|
|
281
|
+
* For collections that fetch data: use `rendererConfig?.fetchHelpers?.getRelatedArticles?.(information, contentContext, count)` instead of importing from cms-server.
|
|
282
|
+
4. **Handle `contents`**:
|
|
275
283
|
* Check `if (contents && contents.length > 0)`.
|
|
276
284
|
* Filter with `contents.filter(isComponent)`.
|
|
277
285
|
* Map over the result to render items.
|
|
278
|
-
|
|
286
|
+
5. **Isolate Client Logic**:
|
|
279
287
|
* **ENSURE SERVER COMPONENT** for the main file.
|
|
280
288
|
* If a carousel/slider/filter is needed, move that logic to `[Name]Client.tsx`.
|
|
281
289
|
* Pass server-rendered cards as `children` to the client wrapper.
|
|
282
|
-
|
|
290
|
+
6. **Register**:
|
|
283
291
|
* Add to `collectionRegistrations` in `src/lib/registrations.ts`.
|
|
@@ -72,13 +72,13 @@ import {
|
|
|
72
72
|
convertText,
|
|
73
73
|
cn,
|
|
74
74
|
defineComponent,
|
|
75
|
+
getPreviewFieldProps,
|
|
75
76
|
RtfOrString,
|
|
76
77
|
UnusedChecker,
|
|
77
78
|
} from '@se-studio/core-ui';
|
|
78
79
|
import { SectionLinks } from '@/elements/SectionLinks';
|
|
79
80
|
import { Section } from '@/framework/Section';
|
|
80
81
|
import type { IComponent, IContent } from '@/lib/cms';
|
|
81
|
-
import { getPreviewFieldIdProps } from '@/lib/cms-server';
|
|
82
82
|
import { getSizingInformation } from '@/lib/SizingInformation';
|
|
83
83
|
// If interactivity is needed:
|
|
84
84
|
// import MyNewComponentClient from './MyNewComponentClient';
|
|
@@ -123,7 +123,7 @@ export const CoreMyNewComponent: React.FC<
|
|
|
123
123
|
<div className={cn('space-y-6', positionClassName)}>
|
|
124
124
|
{heading && (
|
|
125
125
|
<Element
|
|
126
|
-
{...
|
|
126
|
+
{...getPreviewFieldProps(rendererConfig, id, 'heading')}
|
|
127
127
|
className={cn(sizingInformation.h1)}
|
|
128
128
|
>
|
|
129
129
|
{convertText(heading)}
|
|
@@ -131,7 +131,7 @@ export const CoreMyNewComponent: React.FC<
|
|
|
131
131
|
)}
|
|
132
132
|
{body && (
|
|
133
133
|
<RtfOrString
|
|
134
|
-
{...
|
|
134
|
+
{...getPreviewFieldProps(rendererConfig, id, 'body')}
|
|
135
135
|
content={body}
|
|
136
136
|
className={cn('rtf-standard')}
|
|
137
137
|
rendererConfig={rendererConfig}
|
|
@@ -146,6 +146,7 @@ export const CoreMyNewComponent: React.FC<
|
|
|
146
146
|
{links && (
|
|
147
147
|
<SectionLinks
|
|
148
148
|
links={links}
|
|
149
|
+
rendererConfig={rendererConfig}
|
|
149
150
|
trackingLocation={cmsLabel}
|
|
150
151
|
analyticsContext={contentContext?.analyticsContext}
|
|
151
152
|
/>
|
|
@@ -164,7 +165,11 @@ const MyNewComponent: React.FC<
|
|
|
164
165
|
}
|
|
165
166
|
> = ({ information, componentType, ...rest }) => {
|
|
166
167
|
return (
|
|
167
|
-
<Section
|
|
168
|
+
<Section
|
|
169
|
+
componentName={componentType}
|
|
170
|
+
information={information}
|
|
171
|
+
previewHelpers={rest.rendererConfig?.previewHelpers}
|
|
172
|
+
>
|
|
168
173
|
<CoreMyNewComponent
|
|
169
174
|
{...rest}
|
|
170
175
|
positionClassName="col-span-full laptop:col-start-2 laptop:col-span-10"
|
|
@@ -224,7 +229,7 @@ export const MyNewRegistration = defineComponent({
|
|
|
224
229
|
* Check field existence (`field &&`).
|
|
225
230
|
* Use `convertText()` for strings.
|
|
226
231
|
* Use `<RtfOrString>` for rich text.
|
|
227
|
-
*
|
|
232
|
+
* Use `getPreviewFieldProps(rendererConfig, id, fieldId)` from `@se-studio/core-ui` for CMS preview (do not import from cms-server – avoids circular dependency). For responsive visuals use `getPreviewResponsiveVisualFieldProps(rendererConfig, id, 'visual', 'mobileVisual')`.
|
|
228
233
|
4. **Handle Interactivity (If Needed)**:
|
|
229
234
|
* Create separate `[Name]Client.tsx` or `[Name]Animator.tsx`.
|
|
230
235
|
* Add `'use client'` to that file only.
|
|
@@ -61,6 +61,20 @@ registrations.ts → cms.ts → builds maps → cms-server.ts
|
|
|
61
61
|
|
|
62
62
|
Add new components/collections in `registrations.ts`. The `cms.ts` imports from it and builds the maps used by `cms-server.ts`.
|
|
63
63
|
|
|
64
|
+
## Circular Dependency: Do Not Import cms-server in Components/Collections
|
|
65
|
+
|
|
66
|
+
Components and collections in the registration chain (imported by `registrations.ts`) must **not** import from `cms-server` directly. Doing so creates a circular dependency (cms-server → cms → registrations → components → cms-server) that causes TDZ errors during RSC serialization.
|
|
67
|
+
|
|
68
|
+
**Instead**, use the helpers from `@se-studio/core-ui`:
|
|
69
|
+
|
|
70
|
+
- `getPreviewFieldProps(rendererConfig, id, fieldId)` – for field preview props
|
|
71
|
+
- `getPreviewResponsiveVisualFieldProps(rendererConfig, id, visualFieldId, mobileVisualFieldId)` – for responsive visuals
|
|
72
|
+
- `rendererConfig.previewHelpers?.getPreviewParentProps?.(information)`
|
|
73
|
+
- `rendererConfig.fetchHelpers?.getAllArticleLinks?.()`
|
|
74
|
+
- `rendererConfig.fetchHelpers?.getRelatedArticles?.(information, contentContext, count)`
|
|
75
|
+
|
|
76
|
+
These are passed via `projectRendererConfig` in `cms-server.ts`. `Section` and `SectionLinks` accept `previewHelpers` / `rendererConfig` props. See `docs/SERVER_CLIENT_BOUNDARIES.md`.
|
|
77
|
+
|
|
64
78
|
## See Also
|
|
65
79
|
|
|
66
80
|
- **register-cms-features** – Adding components and collections
|