-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproject.js
More file actions
77 lines (66 loc) · 2.09 KB
/
project.js
File metadata and controls
77 lines (66 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import apostrophe from 'apostrophe';
export default function createApos(options = {}) {
const baseConfig = {
root: import.meta,
shortName: 'ai-poc',
baseUrl: 'http://localhost:3000',
modules: {
'@apostrophecms/vite': {},
'@apostrophecms/asset': {},
'@apostrophecms/seo': {},
asset: {},
helper: {},
'@apostrophecms/favicon': {},
'@apostrophecms/open-graph': {},
// Widgets
'@apostrophecms/rich-text-widget': {},
'@apostrophecms/image-widget': {},
'@apostrophecms/video-widget': {},
'button-widget': {},
'github-prs-widget': {},
'hero-widget': {},
'card-widget': {},
'card-title-rt-widget': {
extend: '@apostrophecms/rich-text-widget',
options: {
defaultData: { content: '<h3 class="card__title">My Card Title</h3>' }
}
},
'card-content-rt-widget': {
extend: '@apostrophecms/rich-text-widget',
options: {
defaultData: { content: '<p class="card__text">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>' }
}
},
'price-card-widget': {},
// Pages
'default-page': {},
// Pieces - configuration is in modules/article/index.js
article: {},
'article-widget': {},
'article-page': {},
'article-category': {},
'@apostrophecms/import-export': {},
chatbot: {}
}
};
// Deep merge the options
const mergedConfig = deepMerge(baseConfig, options);
return apostrophe(mergedConfig);
}
// Deep merge helper
function deepMerge(target, source) {
const result = { ...target };
for (const key of Object.keys(source)) {
if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {
if (target[key] && typeof target[key] === 'object' && !Array.isArray(target[key])) {
result[key] = deepMerge(target[key], source[key]);
} else {
result[key] = { ...source[key] };
}
} else {
result[key] = source[key];
}
}
return result;
}