Skip to content

Commit 3218b1a

Browse files
committed
feat: Blog module #285
1 parent af4508b commit 3218b1a

239 files changed

Lines changed: 11612 additions & 12 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package-lock.json

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/evershop/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@
162162
"@editorjs/quote": "^2.6.0",
163163
"@editorjs/raw": "^2.5.0",
164164
"@evershop/editorjs-image": "^1.1.0",
165+
"@evershop/editorjs-product-list": "^1.0.0",
165166
"@evershop/postgres-query-builder": "^2.0.1",
166167
"@evershop/sonner": "^2.0.7",
167168
"@graphql-tools/load-files": "^6.6.1",

packages/evershop/src/bin/lib/loadModules.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ const coreModules = [
1616
resolve: path.resolve(__dirname, '../../modules/base'),
1717
path: path.resolve(__dirname, '../../modules/base')
1818
},
19+
{
20+
name: 'blog',
21+
resolve: path.resolve(__dirname, '../../modules/blog'),
22+
path: path.resolve(__dirname, '../../modules/blog')
23+
},
1924
{
2025
name: 'catalog',
2126
resolve: path.resolve(__dirname, '../../modules/catalog'),
Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
{
2+
"categories": [
3+
{
4+
"name": "Guides",
5+
"url_key": "guides",
6+
"comment_policy": "open",
7+
"status": 1,
8+
"short_description": "Practical how-tos for running and growing your store."
9+
},
10+
{
11+
"name": "Tutorials",
12+
"url_key": "tutorials",
13+
"comment_policy": "open",
14+
"status": 1,
15+
"short_description": "Step-by-step technical walkthroughs."
16+
},
17+
{
18+
"name": "Announcements",
19+
"url_key": "announcements",
20+
"comment_policy": "moderated",
21+
"status": 1,
22+
"short_description": "Product news and store updates."
23+
}
24+
],
25+
"tags": [
26+
{ "name": "Getting Started", "url_key": "getting-started" },
27+
{ "name": "Tips", "url_key": "tips" },
28+
{ "name": "EverShop", "url_key": "evershop" },
29+
{ "name": "SEO", "url_key": "seo" }
30+
],
31+
"posts": [
32+
{
33+
"name": "Getting Started with Your Online Store",
34+
"url_key": "getting-started-with-your-online-store",
35+
"status": 1,
36+
"category": "Guides",
37+
"tags": ["Getting Started", "EverShop"],
38+
"short_description": "Everything you need to launch your store and make your first sale — from setup to your first order.",
39+
"thumbnail": "https://picsum.photos/seed/evershop-store-launch/1200/675",
40+
"meta_title": "Getting Started with Your Online Store",
41+
"meta_description": "A friendly walkthrough to launch your store and take your first order.",
42+
"content": [
43+
{
44+
"id": "r1",
45+
"size": 1,
46+
"columns": [
47+
{
48+
"id": "c1",
49+
"size": 1,
50+
"data": {
51+
"blocks": [
52+
{ "type": "header", "data": { "text": "Welcome to your new store", "level": 2 } },
53+
{ "type": "paragraph", "data": { "text": "Launching an online store has never been easier. In this guide we'll walk through the essentials so you can go from an empty catalog to taking real orders." } },
54+
{ "type": "header", "data": { "text": "Your first three steps", "level": 3 } },
55+
{ "type": "list", "data": { "style": "ordered", "items": ["Add your first products with clear photos and descriptions.", "Set up a payment method so customers can check out.", "Configure shipping rates for the regions you serve."] } },
56+
{ "type": "paragraph", "data": { "text": "Once those are in place, your storefront is ready for business." } },
57+
{ "type": "quote", "data": { "text": "The secret of getting ahead is getting started.", "caption": "Mark Twain" } }
58+
]
59+
}
60+
}
61+
]
62+
}
63+
],
64+
"comments": [
65+
{
66+
"name": "Sarah",
67+
"comment": "This was exactly what I needed — thank you!",
68+
"status": "approved",
69+
"replies": [
70+
{ "name": "Store Team", "comment": "Glad it helped, Sarah! Let us know if you get stuck.", "status": "approved" }
71+
]
72+
},
73+
{ "name": "Mike", "comment": "Great starting point. Bookmarked for later.", "status": "approved" }
74+
]
75+
},
76+
{
77+
"name": "10 Tips to Boost Your Conversion Rate",
78+
"url_key": "10-tips-to-boost-your-conversion-rate",
79+
"status": 1,
80+
"category": "Guides",
81+
"tags": ["Tips"],
82+
"short_description": "Small changes that add up to more sales. Ten practical, proven tactics to turn visitors into customers.",
83+
"thumbnail": "https://picsum.photos/seed/evershop-conversion/1200/675",
84+
"meta_title": "10 Tips to Boost Your Conversion Rate",
85+
"meta_description": "Ten proven tactics to turn store visitors into paying customers.",
86+
"content": [
87+
{
88+
"id": "r1",
89+
"size": 1,
90+
"columns": [
91+
{
92+
"id": "c1",
93+
"size": 1,
94+
"data": {
95+
"blocks": [
96+
{ "type": "paragraph", "data": { "text": "Traffic is only half the battle — what matters is how many visitors actually buy. Here are ten tactics that consistently move the needle." } },
97+
{ "type": "list", "data": { "style": "ordered", "items": ["Use high-quality product images from multiple angles.", "Write benefit-driven product descriptions.", "Show real customer reviews and ratings.", "Make your add-to-cart button impossible to miss.", "Offer a free-shipping threshold.", "Reduce checkout to the fewest steps possible.", "Display trust badges near payment.", "Send abandoned-cart reminders.", "Create urgency with limited-time offers.", "Optimize page speed on mobile."] } },
98+
{ "type": "paragraph", "data": { "text": "Pick two or three to test this week — you don't have to do them all at once." } }
99+
]
100+
}
101+
}
102+
]
103+
}
104+
],
105+
"comments": [
106+
{ "name": "Jen", "comment": "Tip #6 made a huge difference for our checkout. 👍", "status": "approved" }
107+
]
108+
},
109+
{
110+
"name": "How to Optimize Product Pages for SEO",
111+
"url_key": "how-to-optimize-product-pages-for-seo",
112+
"status": 1,
113+
"category": "Tutorials",
114+
"tags": ["SEO", "Tips"],
115+
"short_description": "A practical checklist for ranking your product pages higher and earning rich results in search.",
116+
"thumbnail": "https://picsum.photos/seed/evershop-seo/1200/675",
117+
"meta_title": "How to Optimize Product Pages for SEO",
118+
"meta_description": "A practical checklist to rank product pages higher and win rich results.",
119+
"content": [
120+
{
121+
"id": "r1",
122+
"size": 1,
123+
"columns": [
124+
{
125+
"id": "c1",
126+
"size": 1,
127+
"data": {
128+
"blocks": [
129+
{ "type": "paragraph", "data": { "text": "Your product pages are where buying decisions happen — and where a lot of organic traffic can come from if you get the details right." } },
130+
{ "type": "header", "data": { "text": "Nail the basics", "level": 3 } },
131+
{ "type": "list", "data": { "style": "unordered", "items": ["Write a unique, keyword-aware title and meta description.", "Use a clean, readable URL.", "Add descriptive alt text to every image."] } },
132+
{ "type": "header", "data": { "text": "Go further with structured data", "level": 3 } },
133+
{ "type": "paragraph", "data": { "text": "Structured data helps search engines understand your content and can earn you rich results — star ratings, prices, and availability right in the search listing." } },
134+
{ "type": "paragraph", "data": { "text": "Combine these with fast load times and you'll have pages that both rank and convert." } }
135+
]
136+
}
137+
}
138+
]
139+
}
140+
],
141+
"comments": [
142+
{ "name": "Priya", "comment": "The structured data section finally made this click for me. Thanks!", "status": "approved" }
143+
]
144+
},
145+
{
146+
"name": "Introducing Our Spring Collection",
147+
"url_key": "introducing-our-spring-collection",
148+
"status": 1,
149+
"category": "Announcements",
150+
"tags": ["EverShop"],
151+
"short_description": "Fresh arrivals for the season — lighter fabrics, brighter colors, and a few surprises.",
152+
"thumbnail": "https://picsum.photos/seed/evershop-spring/1200/675",
153+
"meta_title": "Introducing Our Spring Collection",
154+
"meta_description": "Fresh seasonal arrivals — lighter fabrics, brighter colors, limited editions.",
155+
"content": [
156+
{
157+
"id": "r1",
158+
"size": 1,
159+
"columns": [
160+
{
161+
"id": "c1",
162+
"size": 1,
163+
"data": {
164+
"blocks": [
165+
{ "type": "paragraph", "data": { "text": "Spring is here, and so is our brand-new collection. We've spent months curating pieces that feel fresh, comfortable, and ready for warmer days." } },
166+
{ "type": "header", "data": { "text": "What's new", "level": 3 } },
167+
{ "type": "list", "data": { "style": "unordered", "items": ["Lightweight everyday essentials.", "A refreshed palette of seasonal colors.", "Limited-edition pieces you won't find again."] } },
168+
{ "type": "paragraph", "data": { "text": "Browse the collection today and let us know your favorites in the comments." } }
169+
]
170+
}
171+
}
172+
]
173+
}
174+
],
175+
"comments": [
176+
{ "name": "Alex", "comment": "Can't wait to see it!", "status": "pending" }
177+
]
178+
},
179+
{
180+
"name": "Building a Headless Storefront with EverShop",
181+
"url_key": "building-a-headless-storefront-with-evershop",
182+
"status": 1,
183+
"category": "Tutorials",
184+
"tags": ["EverShop", "Getting Started"],
185+
"short_description": "Go beyond the default theme — use EverShop's GraphQL API to power a fully custom frontend.",
186+
"thumbnail": "https://picsum.photos/seed/evershop-headless/1200/675",
187+
"meta_title": "Building a Headless Storefront with EverShop",
188+
"meta_description": "Use EverShop's GraphQL API to power a fully custom, headless frontend.",
189+
"content": [
190+
{
191+
"id": "r1",
192+
"size": 1,
193+
"columns": [
194+
{
195+
"id": "c1",
196+
"size": 1,
197+
"data": {
198+
"blocks": [
199+
{ "type": "paragraph", "data": { "text": "EverShop ships with a capable storefront, but sometimes you want complete control over the frontend. Its GraphQL API makes a headless setup straightforward." } },
200+
{ "type": "header", "data": { "text": "Why go headless?", "level": 3 } },
201+
{ "type": "list", "data": { "style": "unordered", "items": ["Total design freedom on the frontend.", "Reuse the same backend for web, mobile, and more.", "Adopt modern frameworks without forking the core."] } },
202+
{ "type": "paragraph", "data": { "text": "Start by exploring the GraphQL playground, then wire your frontend to the queries you need." } },
203+
{ "type": "quote", "data": { "text": "Make it work, make it right, make it fast.", "caption": "Kent Beck" } }
204+
]
205+
}
206+
}
207+
]
208+
}
209+
],
210+
"comments": [
211+
{ "name": "Dev", "comment": "Would love a follow-up on authentication for the headless setup.", "status": "approved" }
212+
]
213+
}
214+
]
215+
}

packages/evershop/src/bin/seed/index.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import yargs from 'yargs';
55
import { hideBin } from 'yargs/helpers';
66
import { error, success, info } from '../../lib/log/logger.js';
77
import { seedAttributeGroup, seedAttributes } from './seedAttributes.js';
8+
import { seedBlog } from './seedBlog.js';
89
import { seedCategories } from './seedCategories.js';
910
import { seedCollections } from './seedCollections.js';
1011
import { seedPages } from './seedPages.js';
@@ -41,9 +42,15 @@ const { argv } = yargs(hideBin(process.argv))
4142
type: 'boolean',
4243
default: false
4344
})
45+
.option('blog', {
46+
alias: 'b',
47+
description: 'Seed blog (categories, tags, posts, comments)',
48+
type: 'boolean',
49+
default: false
50+
})
4451
.option('all', {
4552
description:
46-
'Seed all demo data (attributes, categories, collections, products, pages)',
53+
'Seed all demo data (attributes, categories, collections, products, pages, blog)',
4754
type: 'boolean',
4855
default: false
4956
})
@@ -54,10 +61,11 @@ const { argv } = yargs(hideBin(process.argv))
5461
!argv.collections &&
5562
!argv.products &&
5663
!argv.pages &&
64+
!argv.blog &&
5765
!argv.all
5866
) {
5967
throw new Error(
60-
'Please specify at least one option: --attributes, --categories, --collections, --products, --pages, or --all'
68+
'Please specify at least one option: --attributes, --categories, --collections, --products, --pages, --blog, or --all'
6169
);
6270
}
6371
return true;
@@ -70,6 +78,7 @@ interface SeedOptions {
7078
collections: boolean;
7179
products: boolean;
7280
pages: boolean;
81+
blog: boolean;
7382
all: boolean;
7483
}
7584

@@ -117,6 +126,11 @@ async function seed() {
117126
console.log();
118127
}
119128

129+
if (options.all || options.blog) {
130+
await seedBlog();
131+
console.log();
132+
}
133+
120134
success('✓ Demo data seeding completed successfully!');
121135
process.exit(0);
122136
} catch (e: any) {

0 commit comments

Comments
 (0)