@paroicms/site-generator-plugin 0.5.2 → 0.7.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 +1 -1
- package/gen-backend/dist/generator/fake-content-generator.ts/create-node-contents.js +10 -4
- package/gen-backend/dist/generator/llm-queries/invoke-update-site-schema.js +2 -1
- package/gen-backend/dist/generator/site-generator/document-template-creator.js +19 -2
- package/gen-backend/dist/generator/site-generator/template-helpers.js +5 -2
- package/gen-backend/dist/generator/site-schema-generator/create-site-schema.js +1 -1
- package/gen-backend/images/im01.webp +0 -0
- package/gen-backend/images/im02.webp +0 -0
- package/gen-backend/images/im03.webp +0 -0
- package/gen-backend/images/im04.webp +0 -0
- package/gen-backend/images/im05.webp +0 -0
- package/gen-backend/images/im06.webp +0 -0
- package/gen-backend/images/im07.webp +0 -0
- package/gen-backend/images/im08.webp +0 -0
- package/gen-backend/images/im09.webp +0 -0
- package/gen-backend/images/im10.webp +0 -0
- package/gen-backend/images/im11.webp +0 -0
- package/gen-backend/images/im12.webp +0 -0
- package/gen-backend/prompts/generate-fake-content-multiple-documents.md +1 -1
- package/gen-backend/prompts/new-site-1-analysis.md +8 -17
- package/gen-backend/prompts/predefined-fields.json +25 -21
- package/gen-backend/prompts/update-site-schema-2-execute.md +2 -1
- package/gen-front/dist/gen-front.css +1 -1
- package/package.json +6 -6
- package/gen-backend/images/im01.jpg +0 -0
- package/gen-backend/images/im02.jpg +0 -0
- package/gen-backend/images/im03.jpg +0 -0
- package/gen-backend/images/im04.jpg +0 -0
- package/gen-backend/images/im05.jpg +0 -0
- package/gen-backend/images/im06.jpg +0 -0
- package/gen-backend/images/im07.jpg +0 -0
- package/gen-backend/images/im08.jpg +0 -0
- package/gen-backend/images/im09.jpg +0 -0
- package/gen-backend/images/im10.jpg +0 -0
- package/gen-backend/images/im11.jpg +0 -0
- package/gen-backend/images/im12.jpg +0 -0
|
@@ -66,7 +66,7 @@ function toRiFieldContent(options) {
|
|
|
66
66
|
value: generatedValue,
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
if (fieldType.dataType === "
|
|
69
|
+
if (fieldType.dataType === "json" && fieldType.renderAs === "html" && isMarkdown) {
|
|
70
70
|
return toRiQuillDeltaContent(generatedValue);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
@@ -123,15 +123,19 @@ function toRiFieldContent(options) {
|
|
|
123
123
|
};
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
+
if (fieldType.storedAs === "labeling")
|
|
127
|
+
return; // TODO: Generate values for labeling fields
|
|
126
128
|
}
|
|
127
129
|
function toRiQuillDeltaContent(content) {
|
|
128
130
|
return {
|
|
129
|
-
dataType: "
|
|
131
|
+
dataType: "json",
|
|
130
132
|
localized: true,
|
|
131
133
|
value: Object.fromEntries(Object.entries(content).map(([language, text]) => [
|
|
132
134
|
language,
|
|
133
135
|
{
|
|
134
|
-
|
|
136
|
+
j: {
|
|
137
|
+
ops: markdownToDelta(text),
|
|
138
|
+
},
|
|
135
139
|
},
|
|
136
140
|
])),
|
|
137
141
|
};
|
|
@@ -150,7 +154,9 @@ export function generateLocalizedFooterMention(siteSchema) {
|
|
|
150
154
|
return Object.fromEntries(languages.map((language) => [
|
|
151
155
|
language,
|
|
152
156
|
{
|
|
153
|
-
|
|
157
|
+
j: {
|
|
158
|
+
ops: markdownToDelta(`Powered by ParoiCMS in ${languageLabels[language]}`),
|
|
159
|
+
},
|
|
154
160
|
},
|
|
155
161
|
]));
|
|
156
162
|
}
|
|
@@ -107,7 +107,8 @@ async function invokeUpdateSiteSchemaStep2(ctx, input) {
|
|
|
107
107
|
function fixSiteSchema(siteSchema) {
|
|
108
108
|
for (const nodeType of siteSchema.nodeTypes ?? []) {
|
|
109
109
|
for (const field of nodeType.fields ?? []) {
|
|
110
|
-
if (typeof field !== "string" && field.
|
|
110
|
+
if (typeof field !== "string" && field.renderAs === "html") {
|
|
111
|
+
field.dataType = "json";
|
|
111
112
|
field.plugin = "@paroicms/quill-editor-plugin";
|
|
112
113
|
}
|
|
113
114
|
}
|
|
@@ -164,8 +164,25 @@ function templateOfFields(ctx, fields, { parentKey }) {
|
|
|
164
164
|
}
|
|
165
165
|
function templateOfField(ctx, fieldOrName, parentKey) {
|
|
166
166
|
const fieldName = typeof fieldOrName === "string" ? fieldOrName : fieldOrName.name;
|
|
167
|
-
const dataType = typeof fieldOrName === "string"
|
|
168
|
-
|
|
167
|
+
const { dataType, renderAs } = typeof fieldOrName === "string"
|
|
168
|
+
? getPredefinedDataType(ctx, fieldName)
|
|
169
|
+
: fieldOrName.storedAs === "labeling"
|
|
170
|
+
? { dataType: "labeling" }
|
|
171
|
+
: fieldOrName;
|
|
172
|
+
if (dataType === "labeling") {
|
|
173
|
+
return `{% if ${parentKey}.${fieldName} %}
|
|
174
|
+
<div class="Field">
|
|
175
|
+
{% for tag in ${parentKey}.${fieldName} %}
|
|
176
|
+
{% if tag.inRightLanguage %}
|
|
177
|
+
<a href="{{ tag.url }}">{{ tag.title }}</a>
|
|
178
|
+
{% else %}
|
|
179
|
+
<span>{{ tag.title }}</span>
|
|
180
|
+
{% endif %}
|
|
181
|
+
{% endfor %}
|
|
182
|
+
</div>
|
|
183
|
+
{% endif %}`;
|
|
184
|
+
}
|
|
185
|
+
if (renderAs === "html") {
|
|
169
186
|
return `<div class="Field Text">{{ ${parentKey}.${fieldName} | raw }}</div>`;
|
|
170
187
|
}
|
|
171
188
|
if (dataType === "date") {
|
|
@@ -11,8 +11,11 @@ export function indent(template, level, { skipFirst = false } = {}) {
|
|
|
11
11
|
export function getPredefinedDataType(ctx, fieldName) {
|
|
12
12
|
const predefinedField = ctx.predefinedFields.get(fieldName);
|
|
13
13
|
if (!predefinedField)
|
|
14
|
-
return "string";
|
|
15
|
-
return
|
|
14
|
+
return { dataType: "string", renderAs: undefined };
|
|
15
|
+
return {
|
|
16
|
+
dataType: predefinedField.dataType,
|
|
17
|
+
renderAs: predefinedField.renderAs,
|
|
18
|
+
};
|
|
16
19
|
}
|
|
17
20
|
export function localizedLabelTemplate(ctx, label) {
|
|
18
21
|
const { siteSchema, setLocalizedLabel: appendLocalizedLabel } = ctx;
|
|
@@ -2,7 +2,7 @@ import { generateSlug } from "@paroicms/public-anywhere-lib";
|
|
|
2
2
|
export function createSiteSchemaFromAnalysis(analysis) {
|
|
3
3
|
const { siteProperties } = analysis;
|
|
4
4
|
const siteSchema = {
|
|
5
|
-
version: "
|
|
5
|
+
version: "8",
|
|
6
6
|
languages: [siteProperties.language],
|
|
7
7
|
plugins: [
|
|
8
8
|
"@paroicms/quill-editor-plugin",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -14,7 +14,7 @@ Make sure web pages are distinct from each other by:
|
|
|
14
14
|
|
|
15
15
|
Guidelines:
|
|
16
16
|
|
|
17
|
-
- NEVER repeat
|
|
17
|
+
- NEVER repeat the same title among several sub-contents.
|
|
18
18
|
- Never invite the user to write a comment. There is no comment system.
|
|
19
19
|
|
|
20
20
|
Each web page is composed by several sub-contents. Use the following exact format:
|
|
@@ -55,11 +55,10 @@ Guidelines for creating the hierarchical bullet list:
|
|
|
55
55
|
- Write `"list of"`, and then the **type name** within backquotes.
|
|
56
56
|
- Append `(parts)`.
|
|
57
57
|
- Add a coma, then write: `"list name:"` and append an identifier for the list name.
|
|
58
|
-
-
|
|
59
|
-
- Reusing the same node type several times (for recursivity etc.):
|
|
60
|
-
- When the same node type is reused as a child in several places, then write its children only on the first occurence.
|
|
58
|
+
- Avoid recursivity. But if you can't avoid reusing a node type, then write its children only on the first occurence.
|
|
61
59
|
- On this task, do not focus on fields. If the website description provide fields then you will report them in the unused information. In particular, a collection of medias (a carousel, a slider, an image gallery, a slideshow, etc.) is a type of field.
|
|
62
60
|
- Don't try to provide a comment mechanism when the user requests a blog. Blog comments do not belong to the hierarchy of node types.
|
|
61
|
+
- NEVER ever reuse the same type name for 2 distinct node type. Pay particular attention to words spelled identically in the singular and plural. Each distinct node type must have a unique name through the whole tree structure.
|
|
63
62
|
|
|
64
63
|
Here's an example of a correct output:
|
|
65
64
|
|
|
@@ -83,27 +82,18 @@ Here is another incorrect example:
|
|
|
83
82
|
|
|
84
83
|
<incorrect_example>
|
|
85
84
|
* `home` (routing document)
|
|
86
|
-
* `
|
|
87
|
-
* `
|
|
88
|
-
* list of `page` (regular documents)
|
|
89
|
-
* `vegetals`
|
|
90
|
-
* `pages` (regular document)
|
|
91
|
-
* list of `page` (regular documents)
|
|
85
|
+
* `species` (routing document)
|
|
86
|
+
* list of `species` (regular documents)
|
|
92
87
|
</incorrect_example>
|
|
93
88
|
|
|
94
|
-
This incorrect example fails because the
|
|
89
|
+
This incorrect example fails because the type name `species` is used for 2 different types. You can distinguish them by suffixing both the collection and the item types:
|
|
95
90
|
|
|
96
91
|
<correct_example>
|
|
97
92
|
* `home` (routing document)
|
|
98
|
-
* `
|
|
99
|
-
* `
|
|
100
|
-
* list of `page` (regular documents)
|
|
101
|
-
* `vegetals`
|
|
102
|
-
* `pages` (regular document)
|
|
93
|
+
* `speciesColl` (routing document)
|
|
94
|
+
* list of `speciesItem` (regular documents)
|
|
103
95
|
</correct_example>
|
|
104
96
|
|
|
105
|
-
Notice: the `pages` node will have the same child types for both usage. But we describe them only the first time it appears on the tree.
|
|
106
|
-
|
|
107
97
|
Here's an example of correct output using parts, and with the default contact and search pages:
|
|
108
98
|
|
|
109
99
|
<correct_example>
|
|
@@ -126,6 +116,7 @@ Guidelines for creating the dictionnary YAML:
|
|
|
126
116
|
|
|
127
117
|
- Use a YAML syntax: pay attention to the indentation.
|
|
128
118
|
- Keys: each key is the name of a node type or the name of a list of parts.
|
|
119
|
+
- If the same type is reused several times, then write only one entry in this dictionnary.
|
|
129
120
|
- Values contains the properties. For a node type, provide the following properties:
|
|
130
121
|
- confidence: Your confidence level for the accuracy of this node type (0.0-1.0).
|
|
131
122
|
- kind: Can be `routingDocument`, `regularDocument`, `part`.
|
|
@@ -1,110 +1,114 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
3
|
"fieldName": "leadParagraph",
|
|
4
|
-
"dataType": "quillDelta",
|
|
5
4
|
"localized": true,
|
|
5
|
+
"dataType": "json",
|
|
6
|
+
"renderAs": "html",
|
|
6
7
|
"description": "Lead paragraph, or \"chapo\", of a post (HTML)"
|
|
7
8
|
},
|
|
8
9
|
{
|
|
9
10
|
"fieldName": "htmlContent",
|
|
10
|
-
"dataType": "quillDelta",
|
|
11
11
|
"localized": true,
|
|
12
|
+
"dataType": "json",
|
|
13
|
+
"renderAs": "html",
|
|
12
14
|
"description": "HTML Content"
|
|
13
15
|
},
|
|
14
16
|
{
|
|
15
17
|
"fieldName": "introduction",
|
|
16
|
-
"dataType": "quillDelta",
|
|
17
18
|
"localized": true,
|
|
19
|
+
"dataType": "json",
|
|
20
|
+
"renderAs": "html",
|
|
18
21
|
"description": "A short introduction (HTML)"
|
|
19
22
|
},
|
|
20
23
|
{
|
|
21
24
|
"fieldName": "footerMention",
|
|
22
|
-
"dataType": "
|
|
25
|
+
"dataType": "json",
|
|
26
|
+
"renderAs": "html",
|
|
23
27
|
"localized": true,
|
|
24
28
|
"description": "The footer mention is used to display a legal notice or a disclaimer (HTML). Usually included as a site field."
|
|
25
29
|
},
|
|
26
30
|
{
|
|
27
31
|
"fieldName": "logo",
|
|
28
|
-
"dataType": "media",
|
|
29
32
|
"localized": false,
|
|
33
|
+
"dataType": "media",
|
|
30
34
|
"description": "A logo is an image that represents a brand"
|
|
31
35
|
},
|
|
32
36
|
{
|
|
33
37
|
"fieldName": "slogan",
|
|
34
|
-
"dataType": "string",
|
|
35
38
|
"localized": true,
|
|
39
|
+
"dataType": "string",
|
|
36
40
|
"description": "A slogan is a memorable motto or phrase as a repetitive expression of an idea or purpose"
|
|
37
41
|
},
|
|
38
42
|
{
|
|
39
43
|
"fieldName": "phone",
|
|
40
|
-
"dataType": "string",
|
|
41
44
|
"localized": false,
|
|
45
|
+
"dataType": "string",
|
|
42
46
|
"description": "Phone number"
|
|
43
47
|
},
|
|
44
48
|
{
|
|
45
49
|
"fieldName": "phone2",
|
|
46
|
-
"dataType": "string",
|
|
47
50
|
"localized": false,
|
|
51
|
+
"dataType": "string",
|
|
48
52
|
"description": "Secondary phone number"
|
|
49
53
|
},
|
|
50
54
|
{
|
|
51
55
|
"fieldName": "title",
|
|
52
|
-
"dataType": "string",
|
|
53
56
|
"localized": true,
|
|
57
|
+
"dataType": "string",
|
|
54
58
|
"description": "Store a title"
|
|
55
59
|
},
|
|
56
60
|
{
|
|
57
61
|
"fieldName": "shortTitle",
|
|
58
|
-
"dataType": "string",
|
|
59
62
|
"localized": true,
|
|
63
|
+
"dataType": "string",
|
|
60
64
|
"description": "A short title can be useful for buttons or menu items"
|
|
61
65
|
},
|
|
62
66
|
{
|
|
63
67
|
"fieldName": "gallery",
|
|
64
|
-
"dataType": "gallery",
|
|
65
68
|
"localized": false,
|
|
69
|
+
"dataType": "gallery",
|
|
66
70
|
"description": "A collection of medias. It can be rendered as a carousel, a slider, a slideshow, an image gallery etc."
|
|
67
71
|
},
|
|
68
72
|
{
|
|
69
73
|
"fieldName": "image",
|
|
70
|
-
"dataType": "media",
|
|
71
74
|
"localized": false,
|
|
75
|
+
"dataType": "media",
|
|
72
76
|
"description": "An image"
|
|
73
77
|
},
|
|
74
78
|
{
|
|
75
79
|
"fieldName": "backgroundImage",
|
|
76
|
-
"dataType": "media",
|
|
77
80
|
"localized": false,
|
|
81
|
+
"dataType": "media",
|
|
78
82
|
"description": "A background image"
|
|
79
83
|
},
|
|
80
84
|
{
|
|
81
85
|
"fieldName": "translatedImage",
|
|
82
|
-
"dataType": "media",
|
|
83
86
|
"localized": true,
|
|
87
|
+
"dataType": "media",
|
|
84
88
|
"description": "Image that will be different depending on the language (localized)"
|
|
85
89
|
},
|
|
86
90
|
{
|
|
87
91
|
"fieldName": "featuredDocument",
|
|
88
|
-
"dataType": "string",
|
|
89
92
|
"localized": false,
|
|
93
|
+
"dataType": "string",
|
|
90
94
|
"description": "A link to a featured document"
|
|
91
95
|
},
|
|
92
96
|
{
|
|
93
97
|
"fieldName": "phones",
|
|
94
|
-
"dataType": "json",
|
|
95
98
|
"localized": false,
|
|
99
|
+
"dataType": "json",
|
|
96
100
|
"description": "A list of phone numbers"
|
|
97
101
|
},
|
|
98
102
|
{
|
|
99
103
|
"fieldName": "video",
|
|
100
|
-
"dataType": "string",
|
|
101
104
|
"localized": false,
|
|
102
|
-
"
|
|
105
|
+
"dataType": "string",
|
|
106
|
+
"description": "A YouTube video"
|
|
103
107
|
},
|
|
104
108
|
{
|
|
105
|
-
"fieldName": "
|
|
106
|
-
"dataType": "string",
|
|
109
|
+
"fieldName": "oneLanguageVideo",
|
|
107
110
|
"localized": true,
|
|
108
|
-
"
|
|
111
|
+
"dataType": "string",
|
|
112
|
+
"description": "A YouTube video, but different for each language"
|
|
109
113
|
}
|
|
110
114
|
]
|
|
@@ -23,7 +23,8 @@ Here is an example of an object for describing a custom **HTML** field type:
|
|
|
23
23
|
"name": "myCustomField",
|
|
24
24
|
"localized": true,
|
|
25
25
|
"storedAs": "text",
|
|
26
|
-
"dataType": "
|
|
26
|
+
"dataType": "json",
|
|
27
|
+
"renderAs": "html",
|
|
27
28
|
"useAsExcerpt": 1,
|
|
28
29
|
"plugin": "@paroicms/quill-editor-plugin"
|
|
29
30
|
}}
|