create-kide-app 0.0.21 → 0.0.23

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/index.js CHANGED
@@ -35,7 +35,7 @@ const pm = { name: "pnpm", exec: "pnpm exec", dlx: "pnpm dlx", run: "pnpm", inst
35
35
  // --- Main ---
36
36
 
37
37
  async function main() {
38
- p.intro("Create Kide CMS Project");
38
+ p.intro("🪐 Create Kide CMS Project");
39
39
 
40
40
  // 1. Project name
41
41
  const projectName =
@@ -338,7 +338,7 @@ async function main() {
338
338
  if (!p.isCancel(doDeploy) && doDeploy) {
339
339
  s.start("Building and deploying to Cloudflare");
340
340
  try {
341
- const deployOutput = await runAsync(`${pm.run} deploy`, projectDir);
341
+ const deployOutput = await runAsync(`${pm.run} run deploy`, projectDir);
342
342
  const urlMatch = deployOutput.match(/https:\/\/[^\s]+\.workers\.dev/);
343
343
  if (urlMatch) cf.url = urlMatch[0];
344
344
  cf.deployed = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-kide-app",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "description": "Scaffold a new Kide CMS project",
5
5
  "author": "Matti Hernesniemi",
6
6
  "license": "MIT",
@@ -0,0 +1,28 @@
1
+ ---
2
+ const { blocks = [] } = Astro.props as { blocks?: Array<Record<string, unknown>> };
3
+
4
+ // Discover custom block components from src/components/blocks/
5
+ const customComponents = import.meta.glob<{ default: any }>("./blocks/*.astro", { eager: true });
6
+
7
+ const componentMap: Record<string, any> = {};
8
+ for (const [path, mod] of Object.entries(customComponents)) {
9
+ const filename = path.split("/").pop()?.replace(".astro", "") ?? "";
10
+ const typeName = filename.charAt(0).toLowerCase() + filename.slice(1);
11
+ componentMap[typeName] = mod.default;
12
+ }
13
+ ---
14
+
15
+ <div>
16
+ {
17
+ blocks.map((block) => {
18
+ const type = String(block.type ?? "");
19
+ const Component = componentMap[type];
20
+ if (!Component) {
21
+ throw new Error(
22
+ `No block component found for type "${type}". Add src/components/blocks/${type.charAt(0).toUpperCase() + type.slice(1)}.astro`,
23
+ );
24
+ }
25
+ return <Component {...block} />;
26
+ })
27
+ }
28
+ </div>