@sudajs/cli 0.12.4 → 0.13.0
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/dist/index.js +21 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/templates/theme/AGENTS.md +7 -1
- package/templates/theme/src/sections.tsx +8 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudajs/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"suda": "./bin/suda.js"
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"react": "^19.2.7",
|
|
35
35
|
"react-dom": "^19.2.7",
|
|
36
36
|
"zod": "^3.24.1",
|
|
37
|
-
"@sudajs/theme-engine": "5.
|
|
37
|
+
"@sudajs/theme-engine": "5.1.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@tailwindcss/postcss": "^4.3.0",
|
|
@@ -367,6 +367,12 @@ platform. In the section render function, call
|
|
|
367
367
|
with the exact posts field key. Never import Prisma, call platform APIs, or
|
|
368
368
|
query the database from theme code.
|
|
369
369
|
|
|
370
|
+
When rendering posts returned by `getPostResource`, build links from the
|
|
371
|
+
platform-provided `post.url` first. If it is missing, derive the URL only from
|
|
372
|
+
`post.slug` as `/posts/${encodeURIComponent(post.slug)}`; if neither exists,
|
|
373
|
+
use `#`. Do not guess alternate fields such as `href`, `path`, `permalink`,
|
|
374
|
+
`postUrl`, or `canonicalUrl`.
|
|
375
|
+
|
|
370
376
|
Do not add `resourceQuery: { type: "posts" }` or
|
|
371
377
|
`resource_query: { type: "posts" }`. Do not assume the field must be named
|
|
372
378
|
`query`. A section may have only one top-level posts field; do not nest posts
|
|
@@ -588,7 +594,7 @@ Good component instructions explain:
|
|
|
588
594
|
- Frequency: whether it should appear once, multiple times, or only near another section.
|
|
589
595
|
- Composition: required neighboring content or local blocks, when relevant.
|
|
590
596
|
|
|
591
|
-
- For icons, expose props with `{ type: "icon" }`, type values as `SudaLucideIconName`, render them with `SudaLucideIcon` from `@sudajs/theme-engine/
|
|
597
|
+
- For icons, expose props with `{ type: "icon" }`, type values as `SudaLucideIconName`, render them with `SudaLucideIcon` from `@sudajs/theme-engine/icons`, and store canonical Lucide names such as `"rocket"` or `"mouse-pointer-click"` (not `"lucide-rocket"`). Do not keep theme-local icon maps, emoji/icon switch statements, or custom SVG icon registries unless the theme truly needs a bespoke non-Lucide graphic.
|
|
592
598
|
- Add optional field-level `ai.instructions`, `ai.required`, or `ai.exclude` when a prop needs generation guidance beyond its label and type.
|
|
593
599
|
- Use `ai.exclude: true` only for structural or editor-only components, and still provide instructions explaining why AI must not generate them. `PageOutlet` is the standard example.
|
|
594
600
|
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import type { SudaComponentConfig
|
|
1
|
+
import type { SudaComponentConfig } from "@sudajs/theme-engine";
|
|
2
|
+
import {
|
|
3
|
+
SudaLucideIcon,
|
|
4
|
+
type SudaLucideIconName,
|
|
5
|
+
} from "@sudajs/theme-engine/icons";
|
|
2
6
|
import {
|
|
3
7
|
getPostResource,
|
|
4
8
|
resolveAsset,
|
|
5
|
-
SudaLucideIcon,
|
|
6
9
|
type ThemePostResourceQuery,
|
|
7
10
|
type ThemeRenderMetadata,
|
|
8
11
|
} from "@sudajs/theme-engine/runtime";
|
|
@@ -245,6 +248,8 @@ export const FeaturedPosts: SudaComponentConfig<FeaturedPostsProps> = {
|
|
|
245
248
|
fieldKey: "postList",
|
|
246
249
|
});
|
|
247
250
|
const posts = resource.posts;
|
|
251
|
+
const postHref = (post: (typeof posts)[number]) =>
|
|
252
|
+
post.url || (post.slug ? `/posts/${encodeURIComponent(post.slug)}` : "#");
|
|
248
253
|
return (
|
|
249
254
|
<section className="__SUDA_THEME_KEY__-section">
|
|
250
255
|
<h2>{title}</h2>
|
|
@@ -258,7 +263,7 @@ export const FeaturedPosts: SudaComponentConfig<FeaturedPostsProps> = {
|
|
|
258
263
|
</p>
|
|
259
264
|
<h3>{post.title}</h3>
|
|
260
265
|
<p>{post.excerpt}</p>
|
|
261
|
-
<a href={post
|
|
266
|
+
<a href={postHref(post)}>{post.title}</a>
|
|
262
267
|
</article>
|
|
263
268
|
))
|
|
264
269
|
) : (
|