@paroicms/site-generator-plugin 0.1.1 → 0.2.0
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/gen-backend/dist/generator/fake-content-generator.ts/create-database-with-fake-content.js +5 -13
- package/gen-backend/dist/generator/fake-content-generator.ts/create-node-contents.js +7 -7
- package/gen-backend/dist/generator/site-generator/common-template-creator.js +15 -3
- package/gen-backend/dist/generator/site-generator/document-template-creator.js +4 -4
- package/gen-backend/dist/generator/site-generator/site-generator.js +8 -0
- package/gen-backend/dist/generator/site-generator/theme-creator.js +13 -0
- package/gen-backend/dist/generator/site-generator/theme-css.js +28 -38
- package/gen-front/dist/gen-front.css +1 -1
- package/gen-front/dist/gen-front.mjs +51 -51
- package/package.json +5 -5
package/gen-backend/dist/generator/fake-content-generator.ts/create-database-with-fake-content.js
CHANGED
|
@@ -75,14 +75,6 @@ async function updateSiteFields(ctx, options) {
|
|
|
75
75
|
value: siteTitle,
|
|
76
76
|
},
|
|
77
77
|
],
|
|
78
|
-
[
|
|
79
|
-
"contactEmail",
|
|
80
|
-
{
|
|
81
|
-
dataType: "string",
|
|
82
|
-
localized: false,
|
|
83
|
-
value: `${siteId}@yopmail.com`,
|
|
84
|
-
},
|
|
85
|
-
],
|
|
86
78
|
[
|
|
87
79
|
"favicon",
|
|
88
80
|
{
|
|
@@ -142,7 +134,7 @@ async function updateRoutingDocument(ctx, siteOptions, nodeOptions) {
|
|
|
142
134
|
});
|
|
143
135
|
await ctx.service.connector.updateDocumentContent(fqdn, {
|
|
144
136
|
nodeId: routingIds.nodeId,
|
|
145
|
-
content:
|
|
137
|
+
content: toRiDocumentContent(content, nodeType),
|
|
146
138
|
});
|
|
147
139
|
}
|
|
148
140
|
async function addRegularDocuments(ctx, siteOptions, nodeOptions) {
|
|
@@ -166,7 +158,7 @@ async function addRegularDocuments(ctx, siteOptions, nodeOptions) {
|
|
|
166
158
|
}
|
|
167
159
|
await ctx.service.connector.addMultipleDocumentContents(fqdn, {
|
|
168
160
|
parentNodeId,
|
|
169
|
-
contents: list.map((content) =>
|
|
161
|
+
contents: list.map((content) => toRiDocumentContent(content, nodeType)),
|
|
170
162
|
});
|
|
171
163
|
}
|
|
172
164
|
async function addParts(ctx, siteOptions, nodeOptions) {
|
|
@@ -190,10 +182,10 @@ async function addParts(ctx, siteOptions, nodeOptions) {
|
|
|
190
182
|
}
|
|
191
183
|
await ctx.service.connector.addMultiplePartContents(fqdn, {
|
|
192
184
|
parentNodeId,
|
|
193
|
-
contents: list.map((content) =>
|
|
185
|
+
contents: list.map((content) => toRiPartContent(content, nodeType)),
|
|
194
186
|
});
|
|
195
187
|
}
|
|
196
|
-
function
|
|
188
|
+
function toRiDocumentContent(content, nodeType) {
|
|
197
189
|
const { title, fields, featuredImage } = content;
|
|
198
190
|
return {
|
|
199
191
|
kind: "document",
|
|
@@ -203,7 +195,7 @@ function toNcDocumentContent(content, nodeType) {
|
|
|
203
195
|
fields,
|
|
204
196
|
};
|
|
205
197
|
}
|
|
206
|
-
function
|
|
198
|
+
function toRiPartContent(content, nodeType) {
|
|
207
199
|
const { fields } = content;
|
|
208
200
|
return {
|
|
209
201
|
kind: "part",
|
|
@@ -22,7 +22,7 @@ function createNodeContent(options) {
|
|
|
22
22
|
const fieldTypes = nodeType.fields ?? [];
|
|
23
23
|
if (nodeType.kind === "document") {
|
|
24
24
|
const { title, ...generatedFields } = generatedContent;
|
|
25
|
-
const fields =
|
|
25
|
+
const fields = toRiFieldSetContent(generatedFields, outputTags, fieldTypes, language);
|
|
26
26
|
const featuredImage = nodeType.withFeaturedImage
|
|
27
27
|
? {
|
|
28
28
|
file: getRandomImagePath(),
|
|
@@ -34,16 +34,16 @@ function createNodeContent(options) {
|
|
|
34
34
|
fields,
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
const fields =
|
|
37
|
+
const fields = toRiFieldSetContent(generatedContent, outputTags, fieldTypes, language);
|
|
38
38
|
return { fields };
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function toRiFieldSetContent(content, outputTags, fieldTypes, language) {
|
|
41
41
|
const result = {};
|
|
42
42
|
for (const fieldType of fieldTypes) {
|
|
43
43
|
const isMarkdown = outputTags.find((tag) => tag.key === fieldType.name)?.format === "markdown";
|
|
44
44
|
const localized = fieldType.localized;
|
|
45
45
|
const value = content[fieldType.name];
|
|
46
|
-
const fieldContent =
|
|
46
|
+
const fieldContent = toRiFieldContent({
|
|
47
47
|
fieldType,
|
|
48
48
|
generatedValue: value,
|
|
49
49
|
localized,
|
|
@@ -56,7 +56,7 @@ function toNcFieldSetContent(content, outputTags, fieldTypes, language) {
|
|
|
56
56
|
}
|
|
57
57
|
return result;
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function toRiFieldContent(options) {
|
|
60
60
|
const { fieldType, generatedValue, localized, language, isMarkdown } = options;
|
|
61
61
|
if (generatedValue !== undefined && localized) {
|
|
62
62
|
if (fieldType.dataType === "string") {
|
|
@@ -67,7 +67,7 @@ function toNcFieldContent(options) {
|
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
69
|
if (fieldType.dataType === "quillDelta" && isMarkdown) {
|
|
70
|
-
return
|
|
70
|
+
return toRiQuillDeltaContent(generatedValue);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
if (fieldType.storedAs === "mediaHandle") {
|
|
@@ -124,7 +124,7 @@ function toNcFieldContent(options) {
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function toRiQuillDeltaContent(content) {
|
|
128
128
|
return {
|
|
129
129
|
dataType: "quillDelta",
|
|
130
130
|
localized: true,
|
|
@@ -21,6 +21,14 @@ export function templateOfSiteHeader(ctx) {
|
|
|
21
21
|
<header class="Container Header">
|
|
22
22
|
${indent(content.filter(Boolean).join("\n"), 2, { skipFirst: true })}
|
|
23
23
|
</header>
|
|
24
|
+
</div>
|
|
25
|
+
<div
|
|
26
|
+
class="_mobileMenu"
|
|
27
|
+
data-effect="paMobileMenu"
|
|
28
|
+
style="display: none"
|
|
29
|
+
>
|
|
30
|
+
<div data-inject="logo"></div>
|
|
31
|
+
<div data-inject="content"></div>
|
|
24
32
|
</div>`;
|
|
25
33
|
}
|
|
26
34
|
function templateOfSiteLogoTitle(ctx) {
|
|
@@ -43,7 +51,8 @@ function templateOfSiteLogoTitle(ctx) {
|
|
|
43
51
|
return `<a
|
|
44
52
|
class="Header-logo"
|
|
45
53
|
href="{{ site.home.url }}"
|
|
46
|
-
data-menu-item-id="{{ site.home.id }}"
|
|
54
|
+
data-menu-item-id="{{ site.home.id }}"
|
|
55
|
+
data-mobile-menu-part="logoTitle">
|
|
47
56
|
${indent(content.filter(Boolean).join("\n"), 1, { skipFirst: true })}
|
|
48
57
|
</a>`;
|
|
49
58
|
}
|
|
@@ -60,7 +69,10 @@ function templateOfMainMenu(ctx) {
|
|
|
60
69
|
{{ ${typeName}.title }}
|
|
61
70
|
</a>`);
|
|
62
71
|
return `${variableTemplates.join("\n")}
|
|
63
|
-
<nav
|
|
72
|
+
<nav
|
|
73
|
+
data-activate-menu-items="{{ doc.id | activateMenuItemsData }}"
|
|
74
|
+
data-mobile-menu-part="content"
|
|
75
|
+
data-mobile-menu-action="move">
|
|
64
76
|
${indent(itemTemplates.join("\n"), 1, { skipFirst: true })}
|
|
65
77
|
</nav>`;
|
|
66
78
|
}
|
|
@@ -72,7 +84,7 @@ function templateOfSearchOpener(ctx) {
|
|
|
72
84
|
return;
|
|
73
85
|
return `{% getDoc ${typeName} id: site.home.${typeName}.id %}
|
|
74
86
|
<span
|
|
75
|
-
data-effect="
|
|
87
|
+
data-effect="paSearchOpener"
|
|
76
88
|
data-search-url="{{ ${typeName}.url }}"
|
|
77
89
|
data-icon-color="#fff"></span>`;
|
|
78
90
|
}
|
|
@@ -26,7 +26,7 @@ export function templateOfDocumentType(ctx, documentType) {
|
|
|
26
26
|
].filter(Boolean);
|
|
27
27
|
return `{% layout "layouts/main-layout.liquid" doc: doc site: site %}
|
|
28
28
|
{% block %}
|
|
29
|
-
${blocks.
|
|
29
|
+
${blocks.join("\n\n")}
|
|
30
30
|
{% endblock %}`;
|
|
31
31
|
}
|
|
32
32
|
function templateOfTitleAndFields(ctx, documentType) {
|
|
@@ -54,7 +54,7 @@ function templateOfSpecialDocument(ctx, documentType) {
|
|
|
54
54
|
addLiquidFile("partials", "result-item.public.liquid", templateOfDocumentTile("doc"));
|
|
55
55
|
return `<div
|
|
56
56
|
class="Container"
|
|
57
|
-
data-effect="
|
|
57
|
+
data-effect="paSearchApp"
|
|
58
58
|
data-template="result-item"
|
|
59
59
|
data-limit="10"></div>`;
|
|
60
60
|
}
|
|
@@ -62,7 +62,7 @@ function templateOfSpecialDocument(ctx, documentType) {
|
|
|
62
62
|
return `<div class="Container">
|
|
63
63
|
<div class="TextWidth Pt">
|
|
64
64
|
<div
|
|
65
|
-
data-effect="
|
|
65
|
+
data-effect="paContactForm"
|
|
66
66
|
data-recaptcha-key="{{ site.recaptchaKey }}"
|
|
67
67
|
data-home-url="{{ site.home.url }}"></div>
|
|
68
68
|
</div>
|
|
@@ -145,7 +145,7 @@ function templateOfRegularDocumentTiles(ctx, parentType, parentIdKeyProvider, {
|
|
|
145
145
|
<div class="Container">
|
|
146
146
|
<div
|
|
147
147
|
class="Page List"
|
|
148
|
-
data-effect="
|
|
148
|
+
data-effect="paInfiniteLoading"
|
|
149
149
|
data-parent-id="{{ ${idKey} }}"
|
|
150
150
|
data-start="{{ ${childrenVariableName}.pageSize }}"
|
|
151
151
|
data-limit="{{ ${childrenVariableName}.pageSize }}"
|
|
@@ -33,11 +33,19 @@ export async function generateSite(ctx, input) {
|
|
|
33
33
|
if (withFakeContent) {
|
|
34
34
|
await fillSiteWithFakeContent(ctx, { siteConf, siteId, siteTitle });
|
|
35
35
|
}
|
|
36
|
+
const account = {
|
|
37
|
+
kind: "local",
|
|
38
|
+
email: `${siteId}@yopmail.com`,
|
|
39
|
+
name: "Admin",
|
|
40
|
+
password: Math.random().toString(36).substring(2, 6), // 4 random lowercase characters,
|
|
41
|
+
};
|
|
42
|
+
await ctx.service.connector.createAccount(siteConf.fqdn, account, { asContactEmail: true });
|
|
36
43
|
const { siteUrl } = siteConf;
|
|
37
44
|
return {
|
|
38
45
|
siteId,
|
|
39
46
|
url: siteUrl,
|
|
40
47
|
boUrl: `${siteUrl}/adm`,
|
|
48
|
+
account,
|
|
41
49
|
};
|
|
42
50
|
}
|
|
43
51
|
function getPackageJsonContent(options) {
|
|
@@ -16,6 +16,7 @@ export async function createTheme(ctx, siteDir, siteSchema) {
|
|
|
16
16
|
themeContext.addLiquidFile("root", `${camelToKebabCase(nodeType.typeName)}.liquid`, templateOfDocumentType(themeContext, nodeType));
|
|
17
17
|
}
|
|
18
18
|
themeContext.addFile("theme.json", getThemeJsonContent());
|
|
19
|
+
themeContext.addFile(".theme-check.yml", getLiquidLinterCheckContent());
|
|
19
20
|
themeContext.addFile("assets/scss/theme.scss", getThemeCssContent());
|
|
20
21
|
themeContext.addFile("assets/css/theme.css", getThemeCssContent());
|
|
21
22
|
themeContext.addLiquidFile("layouts", "main-layout.liquid", templateOfLayout(themeContext));
|
|
@@ -169,6 +170,18 @@ function getThemeJsonContent() {
|
|
|
169
170
|
pixelRatio: 1.5,
|
|
170
171
|
}, null, 2);
|
|
171
172
|
}
|
|
173
|
+
function getLiquidLinterCheckContent() {
|
|
174
|
+
return `UndefinedObject:
|
|
175
|
+
enabled: false
|
|
176
|
+
TranslationKeyExists:
|
|
177
|
+
enabled: false
|
|
178
|
+
MissingTemplate:
|
|
179
|
+
enabled: false
|
|
180
|
+
RemoteAsset:
|
|
181
|
+
enabled: false
|
|
182
|
+
UnknownFilter:
|
|
183
|
+
enabled: false`;
|
|
184
|
+
}
|
|
172
185
|
async function ensureDirectory(dirPath, { recursive = false } = {}) {
|
|
173
186
|
try {
|
|
174
187
|
await mkdir(dirPath, { recursive });
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
export function getThemeCssContent() {
|
|
2
|
-
return `/*
|
|
2
|
+
return `/* Global */
|
|
3
|
+
:root {
|
|
4
|
+
--paInteractiveColor: #99f;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/* Reset */
|
|
3
8
|
* {
|
|
4
9
|
box-sizing: border-box;
|
|
5
10
|
}
|
|
@@ -43,6 +48,21 @@ header {
|
|
|
43
48
|
}
|
|
44
49
|
}
|
|
45
50
|
|
|
51
|
+
.Header-logo {
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.Header-logo img {
|
|
57
|
+
margin-right: 10px;
|
|
58
|
+
border-radius: 50%;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.Header-title {
|
|
62
|
+
font-size: 20px;
|
|
63
|
+
font-weight: bold;
|
|
64
|
+
}
|
|
65
|
+
|
|
46
66
|
footer {
|
|
47
67
|
margin-top: 30px;
|
|
48
68
|
padding: 20px;
|
|
@@ -182,21 +202,6 @@ nav a.active::after {
|
|
|
182
202
|
padding-bottom: 50px;
|
|
183
203
|
}
|
|
184
204
|
|
|
185
|
-
.HeaderLogo {
|
|
186
|
-
display: flex;
|
|
187
|
-
align-items: center;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
.HeaderLogo img {
|
|
191
|
-
margin-right: 10px;
|
|
192
|
-
border-radius: 50%;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
.HeaderTitle {
|
|
196
|
-
font-size: 20px;
|
|
197
|
-
font-weight: bold;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
205
|
.Text::after {
|
|
201
206
|
clear: both;
|
|
202
207
|
content: "";
|
|
@@ -240,17 +245,14 @@ nav a.active::after {
|
|
|
240
245
|
width: 100%;
|
|
241
246
|
}
|
|
242
247
|
|
|
243
|
-
.
|
|
248
|
+
.PaInfiniteLoading-loadMore {
|
|
244
249
|
align-items: center;
|
|
245
250
|
display: flex;
|
|
246
251
|
justify-content: center;
|
|
247
252
|
}
|
|
248
253
|
|
|
249
|
-
button,
|
|
250
254
|
.Button,
|
|
251
|
-
.
|
|
252
|
-
.InfiniteLoading-btn,
|
|
253
|
-
.ContactForm-btn {
|
|
255
|
+
.PaButton {
|
|
254
256
|
background-color: #3498db;
|
|
255
257
|
border: 1px solid #3498db;
|
|
256
258
|
border-radius: 5px;
|
|
@@ -263,24 +265,20 @@ button,
|
|
|
263
265
|
text-align: center;
|
|
264
266
|
text-decoration: none;
|
|
265
267
|
}
|
|
266
|
-
|
|
268
|
+
|
|
267
269
|
.Button:hover,
|
|
268
|
-
.
|
|
269
|
-
.InfiniteLoading-btn:hover,
|
|
270
|
-
.ContactForm-btn:hover {
|
|
270
|
+
.PaButton:hover {
|
|
271
271
|
background-color: #2980b9;
|
|
272
272
|
border-color: #2980b9;
|
|
273
273
|
}
|
|
274
|
-
|
|
274
|
+
|
|
275
275
|
.Button:disabled,
|
|
276
|
-
.
|
|
277
|
-
.InfiniteLoading-btn:disabled,
|
|
278
|
-
.ContactForm-btn:disabled {
|
|
276
|
+
.PaButton:disabled {
|
|
279
277
|
background-color: #ccc;
|
|
280
278
|
border-color: #ccc;
|
|
281
279
|
}
|
|
282
280
|
|
|
283
|
-
.
|
|
281
|
+
.PaSearchOpenerButton {
|
|
284
282
|
display: flex;
|
|
285
283
|
}
|
|
286
284
|
|
|
@@ -311,13 +309,5 @@ button:disabled,
|
|
|
311
309
|
|
|
312
310
|
.Row.spaceBetween {
|
|
313
311
|
justify-content: space-between;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
.SearchPageResponse,
|
|
317
|
-
.SearchPageResponse div {
|
|
318
|
-
display: flex;
|
|
319
|
-
flex-direction: column;
|
|
320
|
-
align-items: center;
|
|
321
|
-
gap: 20px;
|
|
322
312
|
}`;
|
|
323
313
|
}
|