@majordigital/create-acorn 1.3.5 → 1.3.6

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.
@@ -234,10 +234,8 @@ async function setupStoryblok(projectName) {
234
234
  // Install Storyblok dependencies
235
235
  console.log('Installing Storyblok dependencies...');
236
236
  await runCommand('npm', ['install', '--legacy-peer-deps',
237
- '@storyblok/react', '@storyblok/js', 'storyblok-js-client'
238
- ]);
239
- await runCommand('npm', ['install', '--save-dev', '--legacy-peer-deps',
240
- 'storyblok', 'storyblok-generate-ts'
237
+ '@storyblok/react', '@storyblok/js', 'storyblok-js-client',
238
+ 'storyblok', 'storyblok-generate-ts', 'storyblok-rich-text-react-renderer'
241
239
  ]);
242
240
  console.log('');
243
241
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@majordigital/create-acorn",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "description": "Interactive scaffold for Acorn with Storyblok/Prismic/DatoCMS, TypeScript, and Tailwind.",
5
5
  "bin": {
6
6
  "create-acorn": "bin/create-acorn.mjs",
@@ -11,5 +11,6 @@
11
11
  "storyblok": "^4.6.13",
12
12
  "storyblok-generate-ts": "^2.2.0",
13
13
  "storyblok-js-client": "^7.1.4",
14
+ "storyblok-rich-text-react-renderer": "^3.0.1"
14
15
  }
15
16
  }
@@ -1,23 +1,19 @@
1
- import type { StoryblokStory } from 'storyblok-generate-ts';
2
-
3
- import { getStoryblokApi } from '@/lib/storyblok';
4
- import snapshot from '@/snapshot/icons.json';
5
- import type { PageIcon } from '@/types/components';
6
-
7
- import type { ICustomSbStoriesParams } from '../types';
1
+ import type { PageStoryblok } from ".storyblok/types/338885/storyblok-components";
2
+ import { getStoryblokApi } from "@/lib/storyblok";
3
+ import snapshot from "@/snapshot/icons.json";
4
+ import type { PageIcon } from "@/types/components";
5
+ import type { ICustomSbStoriesParams, StoryblokServiceStory } from "../types";
8
6
  import {
9
7
  DEFAULT_EXCLUDING_FIELDS,
10
8
  DEFAULT_REVALIDATE,
11
9
  MAX_STORIES_PER_PAGE,
12
- } from './config';
13
-
14
- import type { PageStoryblok } from '.storyblok/types/338885/storyblok-components';
10
+ } from "./config";
15
11
 
16
12
  /**
17
13
  * Maps Storyblok icon stories to PageIcon objects for UI use.
18
14
  */
19
15
  export const mapIcons = (
20
- icons: ReadonlyArray<StoryblokStory<PageStoryblok>>
16
+ icons: ReadonlyArray<StoryblokServiceStory<PageStoryblok>>,
21
17
  ): PageIcon[] => {
22
18
  if (!icons || icons.length === 0) return [];
23
19
 
@@ -35,7 +31,7 @@ export const mapIcons = (
35
31
  id: String(id),
36
32
  url: filename,
37
33
  url_small: filenameSmall,
38
- alt: alt || title || '',
34
+ alt: alt || title || "",
39
35
  slug,
40
36
  };
41
37
  })
@@ -47,14 +43,14 @@ export const mapIcons = (
47
43
  */
48
44
  export const fetchIcons = async (): Promise<PageIcon[]> => {
49
45
  // 1) Production build → static snapshot (fast, zero API hits)
50
- if (process.env.NODE_ENV === 'production') {
46
+ if (process.env.NODE_ENV === "production") {
51
47
  return snapshot as PageIcon[];
52
48
  }
53
49
 
54
50
  // 2) Filter for icons that actually have an image set
55
- const filter_query: NonNullable<ICustomSbStoriesParams['filter_query']> = {
56
- hide_from_search: { in: 'false' },
57
- 'icon.filename': { is: 'not_empty' },
51
+ const filter_query: NonNullable<ICustomSbStoriesParams["filter_query"]> = {
52
+ hide_from_search: { in: "false" },
53
+ "icon.filename": { is: "not_empty" },
58
54
  };
59
55
 
60
56
  // 3) Build base params (published, with cv)
@@ -62,8 +58,8 @@ export const fetchIcons = async (): Promise<PageIcon[]> => {
62
58
  const storyblokApi = getStoryblokApi();
63
59
 
64
60
  const baseParams = {
65
- version: 'published' as const,
66
- content_type: 'page',
61
+ version: "published" as const,
62
+ content_type: "page",
67
63
  filter_query,
68
64
  excluding_fields: DEFAULT_EXCLUDING_FIELDS,
69
65
  per_page,
@@ -71,7 +67,7 @@ export const fetchIcons = async (): Promise<PageIcon[]> => {
71
67
 
72
68
  // 4) First page (direct API call)
73
69
  const firstParams = { ...baseParams, page: 1 };
74
- const first = await storyblokApi.get('cdn/stories', firstParams, {
70
+ const first = await storyblokApi.get("cdn/stories", firstParams, {
75
71
  next: {
76
72
  revalidate: DEFAULT_REVALIDATE,
77
73
  },
@@ -88,21 +84,20 @@ export const fetchIcons = async (): Promise<PageIcon[]> => {
88
84
  : await Promise.all(
89
85
  Array.from({ length: maxPage - 1 }, (_, idx) => {
90
86
  const pageParams = { ...baseParams, page: 2 + idx };
91
- return storyblokApi.get('cdn/stories', pageParams, {
87
+ return storyblokApi.get("cdn/stories", pageParams, {
92
88
  next: {
93
89
  revalidate: DEFAULT_REVALIDATE,
94
90
  },
95
91
  });
96
- })
92
+ }),
97
93
  );
98
94
 
99
95
  // 6) Combine and map to PageIcon[]
100
96
  const allStoriesRaw = [
101
97
  firstStories,
102
- ...rest.flatMap(r => r.data?.stories ?? []),
98
+ ...rest.flatMap((r) => r.data?.stories ?? []),
103
99
  ];
104
- const iconStories =
105
- allStoriesRaw as unknown as StoryblokStory<PageStoryblok>[];
100
+ const iconStories = allStoriesRaw as unknown as StoryblokServiceStory<PageStoryblok>[];
106
101
 
107
102
  return mapIcons(iconStories);
108
103
  };