@digitalygo/create-diggocms-app 0.1.0 → 0.1.1
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/README.md +4 -4
- package/package.json +5 -2
- package/templates/full/README.md +11 -7
- package/templates/full/app/globals.css +58 -7
- package/templates/full/components/ExtendedCard.tsx +17 -5
- package/templates/full/components/ExtendedGallery.tsx +43 -0
- package/templates/full/components/ExtendedText.tsx +16 -0
- package/templates/full/components/ExtendedVideo.tsx +27 -0
- package/templates/full/components/server-components.ts +3 -3
- package/templates/full/lib/diggo-config.ts +8 -7
- package/templates/full/tsconfig.tsbuildinfo +1 -0
- package/templates/with-mock/README.md +9 -6
- package/templates/with-mock/app/globals.css +58 -7
- package/templates/with-mock/components/ExtendedCard.tsx +17 -5
- package/templates/with-mock/components/ExtendedGallery.tsx +43 -0
- package/templates/with-mock/components/ExtendedText.tsx +16 -0
- package/templates/with-mock/components/ExtendedVideo.tsx +27 -0
- package/templates/with-mock/components/server-components.ts +3 -3
- package/templates/with-mock/fixtures/collection.json +59 -18
- package/templates/with-mock/fixtures/pages/chi-siamo.json +9 -8
- package/templates/with-mock/fixtures/pages/contatti.json +10 -7
- package/templates/with-mock/fixtures/pages/home.json +71 -22
- package/templates/with-mock/lib/diggo-config.ts +8 -7
- package/templates/with-mock/tsconfig.tsbuildinfo +1 -0
- package/templates/full/components/ExtendedRichtext.tsx +0 -15
- package/templates/full/components/ExtendedSubtitle.tsx +0 -10
- package/templates/with-mock/components/ExtendedRichtext.tsx +0 -15
- package/templates/with-mock/components/ExtendedSubtitle.tsx +0 -10
package/README.md
CHANGED
|
@@ -29,8 +29,8 @@ The CLI will guide you through the setup process:
|
|
|
29
29
|
|
|
30
30
|
1. **Project name** - Name of your new project directory
|
|
31
31
|
2. **Template** - Choose from:
|
|
32
|
-
- `full` - Complete setup with
|
|
33
|
-
- `with-mock` - Full setup + mock API server + sample fixtures
|
|
32
|
+
- `full` - Complete setup with the current supported component templates (recommended)
|
|
33
|
+
- `with-mock` - Full setup + mock API server + sample fixtures aligned with the SDK/demo payload model
|
|
34
34
|
- `minimal` - Basic setup, add components yourself
|
|
35
35
|
3. **Package manager** - Choose your preferred package manager (bun, npm, yarn, pnpm)
|
|
36
36
|
|
|
@@ -48,7 +48,7 @@ Best for: Experienced developers who want full control.
|
|
|
48
48
|
### Full
|
|
49
49
|
|
|
50
50
|
Complete setup including:
|
|
51
|
-
-
|
|
51
|
+
- Extended templates for the current supported component set (title, image, text, video, gallery, card)
|
|
52
52
|
- Navigation components with dropdown support
|
|
53
53
|
- Dynamic routing with `[...slug]`
|
|
54
54
|
- Data fetching helpers
|
|
@@ -61,7 +61,7 @@ Best for: Most users starting a new project.
|
|
|
61
61
|
|
|
62
62
|
Everything from the full template, plus:
|
|
63
63
|
- Standalone mock API server (`scripts/mock-server.ts`)
|
|
64
|
-
- Sample fixtures (pages, menu, collection)
|
|
64
|
+
- Sample fixtures (pages, menu, collection) aligned with the current JSON/content standards used by the SDK/demo
|
|
65
65
|
- Scripts: `mock:api` and `dev:mock`
|
|
66
66
|
- Pre-configured `.env.local` for mock mode
|
|
67
67
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitalygo/create-diggocms-app",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "CLI tool to scaffold a new DiggoCMS project",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"create-diggocms-app": "./bin/cli.js"
|
|
8
8
|
},
|
|
9
|
-
"files": [
|
|
9
|
+
"files": [
|
|
10
|
+
"bin",
|
|
11
|
+
"templates"
|
|
12
|
+
],
|
|
10
13
|
"scripts": {
|
|
11
14
|
"prepublishOnly": "echo 'No build step needed'"
|
|
12
15
|
},
|
package/templates/full/README.md
CHANGED
|
@@ -5,7 +5,7 @@ A complete DiggoCMS application built with Next.js and the DiggoCMS SDK.
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- Dynamic routing with `[...slug]` pattern
|
|
8
|
-
- Extended components
|
|
8
|
+
- Extended components for the current supported standalone types: title, image, text, video, gallery, and card
|
|
9
9
|
- Navigation with dropdown support
|
|
10
10
|
- Mock mode for development
|
|
11
11
|
- Error handling and loading states
|
|
@@ -64,9 +64,10 @@ components/ # React components
|
|
|
64
64
|
├── DiggoProvider.tsx # SDK provider wrapper
|
|
65
65
|
├── server-components.ts # Server-safe component exports
|
|
66
66
|
├── ExtendedTitle.tsx
|
|
67
|
-
├── ExtendedSubtitle.tsx
|
|
68
67
|
├── ExtendedImage.tsx
|
|
69
|
-
├──
|
|
68
|
+
├── ExtendedText.tsx
|
|
69
|
+
├── ExtendedVideo.tsx
|
|
70
|
+
├── ExtendedGallery.tsx
|
|
70
71
|
├── ExtendedCard.tsx
|
|
71
72
|
├── ExtendedMenuItem.tsx
|
|
72
73
|
└── ExtendedMenuContainer.tsx
|
|
@@ -78,16 +79,19 @@ lib/ # Utility functions
|
|
|
78
79
|
|
|
79
80
|
## Extended Components
|
|
80
81
|
|
|
81
|
-
This template includes extended versions of
|
|
82
|
+
This template includes extended versions of the current SDK component set used by the starter:
|
|
82
83
|
|
|
83
84
|
- **ExtendedTitle** - Styled H1 heading
|
|
84
|
-
- **ExtendedSubtitle** - Styled H2 heading
|
|
85
85
|
- **ExtendedImage** - Responsive image with shadow
|
|
86
|
-
- **
|
|
87
|
-
- **
|
|
86
|
+
- **ExtendedText** - Styled paragraph content
|
|
87
|
+
- **ExtendedVideo** - Styled video wrapper for CMS media payloads
|
|
88
|
+
- **ExtendedGallery** - Ordered gallery renderer for image and video items
|
|
89
|
+
- **ExtendedCard** - Card layout with title, media, body copy, and CTA support
|
|
88
90
|
- **ExtendedMenuItem** - Navigation item with active state
|
|
89
91
|
- **ExtendedMenuContainer** - Navigation wrapper
|
|
90
92
|
|
|
93
|
+
Standalone page payloads in this template are expected to use only the supported types above. Card payloads can still include internal card fields such as `richtext` when provided by the CMS.
|
|
94
|
+
|
|
91
95
|
## Customization
|
|
92
96
|
|
|
93
97
|
1. Edit styles in `app/globals.css`
|
|
@@ -16,7 +16,6 @@ body {
|
|
|
16
16
|
padding: 0 1rem;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
/* Header Styles */
|
|
20
19
|
.header {
|
|
21
20
|
background: #fff;
|
|
22
21
|
border-bottom: 1px solid #e5e7eb;
|
|
@@ -39,13 +38,11 @@ body {
|
|
|
39
38
|
text-decoration: none;
|
|
40
39
|
}
|
|
41
40
|
|
|
42
|
-
/* Main Content */
|
|
43
41
|
.main {
|
|
44
42
|
min-height: calc(100vh - 200px);
|
|
45
43
|
padding-bottom: 3rem;
|
|
46
44
|
}
|
|
47
45
|
|
|
48
|
-
/* Footer Styles */
|
|
49
46
|
.footer {
|
|
50
47
|
background: #f9fafb;
|
|
51
48
|
border-top: 1px solid #e5e7eb;
|
|
@@ -54,7 +51,6 @@ body {
|
|
|
54
51
|
color: #6b7280;
|
|
55
52
|
}
|
|
56
53
|
|
|
57
|
-
/* Error Banner */
|
|
58
54
|
.error-banner {
|
|
59
55
|
background: #fef3c7;
|
|
60
56
|
border: 1px solid #fbbf24;
|
|
@@ -64,7 +60,6 @@ body {
|
|
|
64
60
|
color: #92400e;
|
|
65
61
|
}
|
|
66
62
|
|
|
67
|
-
/* Mock Badge */
|
|
68
63
|
.mock-badge {
|
|
69
64
|
display: inline-block;
|
|
70
65
|
background: #dbeafe;
|
|
@@ -76,7 +71,6 @@ body {
|
|
|
76
71
|
margin-bottom: 1rem;
|
|
77
72
|
}
|
|
78
73
|
|
|
79
|
-
/* Component Styles */
|
|
80
74
|
.diggo-title {
|
|
81
75
|
font-size: 2.5rem;
|
|
82
76
|
font-weight: 700;
|
|
@@ -110,6 +104,52 @@ body {
|
|
|
110
104
|
margin-bottom: 1rem;
|
|
111
105
|
}
|
|
112
106
|
|
|
107
|
+
.diggo-text {
|
|
108
|
+
margin: 1rem 0;
|
|
109
|
+
color: #374151;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.diggo-video-block {
|
|
113
|
+
margin: 1.5rem 0;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.diggo-video {
|
|
117
|
+
display: block;
|
|
118
|
+
width: 100%;
|
|
119
|
+
max-width: 100%;
|
|
120
|
+
border-radius: 0.75rem;
|
|
121
|
+
background: #111827;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.diggo-media-caption {
|
|
125
|
+
margin-top: 0.5rem;
|
|
126
|
+
color: #6b7280;
|
|
127
|
+
font-size: 0.875rem;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.diggo-gallery {
|
|
131
|
+
display: grid;
|
|
132
|
+
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
|
133
|
+
gap: 1rem;
|
|
134
|
+
margin: 1.5rem 0;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.diggo-gallery-image {
|
|
138
|
+
width: 100%;
|
|
139
|
+
height: 180px;
|
|
140
|
+
object-fit: cover;
|
|
141
|
+
border-radius: 0.75rem;
|
|
142
|
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.diggo-gallery-video {
|
|
146
|
+
width: 100%;
|
|
147
|
+
height: 180px;
|
|
148
|
+
object-fit: cover;
|
|
149
|
+
border-radius: 0.75rem;
|
|
150
|
+
background: #111827;
|
|
151
|
+
}
|
|
152
|
+
|
|
113
153
|
.diggo-card {
|
|
114
154
|
background: #fff;
|
|
115
155
|
border: 1px solid #e5e7eb;
|
|
@@ -131,7 +171,18 @@ body {
|
|
|
131
171
|
margin-bottom: 1rem;
|
|
132
172
|
}
|
|
133
173
|
|
|
134
|
-
|
|
174
|
+
.diggo-card-link {
|
|
175
|
+
display: inline-flex;
|
|
176
|
+
margin-top: 0.5rem;
|
|
177
|
+
color: #2563eb;
|
|
178
|
+
font-weight: 600;
|
|
179
|
+
text-decoration: none;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.diggo-card-link:hover {
|
|
183
|
+
text-decoration: underline;
|
|
184
|
+
}
|
|
185
|
+
|
|
135
186
|
.menu {
|
|
136
187
|
display: flex;
|
|
137
188
|
}
|
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
import type { CardProps } from '@digitalygo/diggocms-sdk-core';
|
|
2
2
|
import type { ReactElement } from 'react';
|
|
3
3
|
import { ExtendedTitle } from './ExtendedTitle';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { ExtendedImage } from './ExtendedImage';
|
|
5
|
+
import { ExtendedText } from './ExtendedText';
|
|
6
|
+
|
|
7
|
+
export function ExtendedCard({ title, image, content, richtext, callToAction }: CardProps): ReactElement | null {
|
|
8
|
+
const body = richtext ?? content;
|
|
9
|
+
const hasCallToAction = Boolean(callToAction?.text && callToAction?.url);
|
|
10
|
+
|
|
11
|
+
if (!title && !image?.src && !body && !hasCallToAction) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
6
14
|
|
|
7
|
-
export function ExtendedCard({ title, subtitle, content }: CardProps): ReactElement | null {
|
|
8
15
|
return (
|
|
9
16
|
<div className="diggo-card">
|
|
17
|
+
{image?.src && <ExtendedImage {...image} />}
|
|
10
18
|
{title && <ExtendedTitle content={title} />}
|
|
11
|
-
{
|
|
12
|
-
{
|
|
19
|
+
{body && <ExtendedText content={body} />}
|
|
20
|
+
{hasCallToAction ? (
|
|
21
|
+
<a href={callToAction?.url ?? '#'} className="diggo-card-link">
|
|
22
|
+
{callToAction?.text}
|
|
23
|
+
</a>
|
|
24
|
+
) : null}
|
|
13
25
|
</div>
|
|
14
26
|
);
|
|
15
27
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { GalleryProps, ImageProps, VideoProps } from '@digitalygo/diggocms-sdk-core';
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
|
+
|
|
4
|
+
type LegacyGalleryProps = {
|
|
5
|
+
images?: ImageProps[] | null;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
type ExtendedGalleryProps = GalleryProps & LegacyGalleryProps;
|
|
9
|
+
|
|
10
|
+
export function ExtendedGallery({ items, images }: ExtendedGalleryProps): ReactElement | null {
|
|
11
|
+
const normalizedItems = items ?? images?.map((image, index) => ({ type: 'image' as const, order: index, data: image })) ?? null;
|
|
12
|
+
|
|
13
|
+
if (!normalizedItems || normalizedItems.length === 0) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const sortedItems = [...normalizedItems].sort((left, right) => left.order - right.order);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div className="diggo-gallery">
|
|
21
|
+
{sortedItems.map((item, index) => (
|
|
22
|
+
item.type === 'video' ? (
|
|
23
|
+
<video
|
|
24
|
+
key={`${item.type}-${index}-${(item.data as VideoProps).src ?? 'video'}`}
|
|
25
|
+
className="diggo-gallery-video"
|
|
26
|
+
controls
|
|
27
|
+
poster={(item.data as VideoProps).poster ?? undefined}
|
|
28
|
+
>
|
|
29
|
+
<source src={(item.data as VideoProps).src ?? ''} />
|
|
30
|
+
{(item.data as VideoProps).alt ?? ''}
|
|
31
|
+
</video>
|
|
32
|
+
) : (
|
|
33
|
+
<img
|
|
34
|
+
key={`${item.type}-${index}-${(item.data as ImageProps).src ?? 'image'}`}
|
|
35
|
+
src={(item.data as ImageProps).src ?? ''}
|
|
36
|
+
alt={(item.data as ImageProps).alt ?? ''}
|
|
37
|
+
className="diggo-gallery-image"
|
|
38
|
+
/>
|
|
39
|
+
)
|
|
40
|
+
))}
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
|
|
3
|
+
type TextProps = {
|
|
4
|
+
content?: string | null;
|
|
5
|
+
text?: string | null;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export function ExtendedText({ content, text }: TextProps): ReactElement | null {
|
|
9
|
+
const value = content ?? text;
|
|
10
|
+
|
|
11
|
+
if (!value) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return <p className="diggo-text">{value}</p>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { VideoProps } from '@digitalygo/diggocms-sdk-core';
|
|
2
|
+
import type { ReactElement } from 'react';
|
|
3
|
+
|
|
4
|
+
type LegacyVideoProps = VideoProps & {
|
|
5
|
+
title?: string | null;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export function ExtendedVideo({
|
|
9
|
+
src,
|
|
10
|
+
poster,
|
|
11
|
+
alt,
|
|
12
|
+
title,
|
|
13
|
+
}: LegacyVideoProps): ReactElement | null {
|
|
14
|
+
if (!src) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<figure className="diggo-video-block">
|
|
20
|
+
<video className="diggo-video" controls poster={poster ?? undefined}>
|
|
21
|
+
<source src={src} />
|
|
22
|
+
{alt ?? title ?? ''}
|
|
23
|
+
</video>
|
|
24
|
+
{alt || title ? <figcaption className="diggo-media-caption">{alt ?? title}</figcaption> : null}
|
|
25
|
+
</figure>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// Re-export components for server-side usage (they're server-safe pure components)
|
|
2
1
|
export { ExtendedTitle } from './ExtendedTitle';
|
|
3
|
-
export { ExtendedSubtitle } from './ExtendedSubtitle';
|
|
4
2
|
export { ExtendedImage } from './ExtendedImage';
|
|
5
|
-
export {
|
|
3
|
+
export { ExtendedText } from './ExtendedText';
|
|
4
|
+
export { ExtendedVideo } from './ExtendedVideo';
|
|
5
|
+
export { ExtendedGallery } from './ExtendedGallery';
|
|
6
6
|
export { ExtendedCard } from './ExtendedCard';
|
|
7
7
|
export { ExtendedMenuItem } from './ExtendedMenuItem';
|
|
8
8
|
export { ExtendedMenuContainer } from './ExtendedMenuContainer';
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import type { ComponentRegistry, NavigationRegistry, DiggoConfig } from '@digitalygo/diggocms-sdk-core';
|
|
2
2
|
import {
|
|
3
|
-
ExtendedTitle,
|
|
4
|
-
ExtendedSubtitle,
|
|
5
3
|
ExtendedImage,
|
|
6
|
-
|
|
4
|
+
ExtendedText,
|
|
5
|
+
ExtendedVideo,
|
|
6
|
+
ExtendedGallery,
|
|
7
7
|
ExtendedCard,
|
|
8
8
|
ExtendedMenuItem,
|
|
9
9
|
ExtendedMenuContainer,
|
|
10
10
|
} from '@/components/server-components';
|
|
11
11
|
|
|
12
|
-
export const componentsRegistry
|
|
13
|
-
subtitle: ExtendedSubtitle,
|
|
12
|
+
export const componentsRegistry = {
|
|
14
13
|
image: ExtendedImage,
|
|
15
|
-
|
|
14
|
+
text: ExtendedText,
|
|
15
|
+
video: ExtendedVideo,
|
|
16
|
+
gallery: ExtendedGallery,
|
|
16
17
|
card: ExtendedCard,
|
|
17
|
-
};
|
|
18
|
+
} as ComponentRegistry;
|
|
18
19
|
|
|
19
20
|
export const navigationRegistry: NavigationRegistry = {
|
|
20
21
|
MenuItem: ExtendedMenuItem,
|