@paroicms/site-generator-plugin 0.12.0 → 0.13.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/gen-backend/dist/generator/lib/create-prompt.js +4 -4
- package/gen-backend/dist/generator/llm-queries/invoke-message-guard.js +1 -1
- package/gen-backend/dist/generator/llm-queries/invoke-new-site-analysis.js +2 -2
- package/gen-backend/dist/generator/llm-queries/invoke-update-site-schema.js +2 -2
- package/gen-backend/dist/generator/site-generator/common-template-creator.js +1 -1
- package/gen-backend/dist/generator/site-generator/document-template-creator.js +11 -9
- package/gen-backend/dist/generator/site-generator/site-generator.js +2 -0
- package/gen-backend/dist/generator/site-generator/theme-creator.js +4 -4
- package/gen-backend/dist/generator/site-generator/theme-css.js +0 -23
- package/gen-backend/dist/generator/site-schema-generator/create-site-schema.js +3 -2
- package/gen-front/dist/gen-front.mjs +75 -91
- package/package.json +26 -26
|
@@ -7,8 +7,8 @@ const contextContent = await readPromptFile("0-context.md");
|
|
|
7
7
|
const siteSchemaTsDefs = await readFile(join(connectorPackageDir, "typeonly", "site-schema-json-types.d.ts"), "utf-8");
|
|
8
8
|
const predefinedFields = JSON.parse(await readPromptFile("predefined-fields.json"));
|
|
9
9
|
export async function createPromptTemplate(options) {
|
|
10
|
-
const {
|
|
11
|
-
const promptContent = await readPromptFile(
|
|
10
|
+
const { filename, withSiteSchemaTsDefs } = options;
|
|
11
|
+
const promptContent = await readPromptFile(filename);
|
|
12
12
|
const schemaTypeDefTemplate = withSiteSchemaTsDefs
|
|
13
13
|
? `
|
|
14
14
|
|
|
@@ -29,8 +29,8 @@ ${promptContent}
|
|
|
29
29
|
`;
|
|
30
30
|
return buildPromptTemplate(template);
|
|
31
31
|
}
|
|
32
|
-
export async function readPromptFile(
|
|
33
|
-
return await readFile(join(projectDir, "prompts",
|
|
32
|
+
export async function readPromptFile(filename) {
|
|
33
|
+
return await readFile(join(projectDir, "prompts", filename), "utf-8");
|
|
34
34
|
}
|
|
35
35
|
export function getPredefinedFields() {
|
|
36
36
|
if (!predefinedFields)
|
|
@@ -5,7 +5,7 @@ import { createPromptTemplate } from "../lib/create-prompt.js";
|
|
|
5
5
|
import { debugLlmOutput } from "../lib/debug-utils.js";
|
|
6
6
|
import { parseLlmResponseAsProperties } from "../lib/parse-llm-response.js";
|
|
7
7
|
const guardPrompt = await createPromptTemplate({
|
|
8
|
-
|
|
8
|
+
filename: "message-guard.md",
|
|
9
9
|
});
|
|
10
10
|
const invalidCauses = new Set(["rude", "malicious", "outOfScope", "technicalLimits", "noSense"]);
|
|
11
11
|
export async function invokeMessageGuard(ctx, input, { skipOutOfScopeCheck = false } = {}) {
|
|
@@ -11,11 +11,11 @@ import { createL10n } from "../site-schema-generator/create-l10n.js";
|
|
|
11
11
|
import { createSiteSchemaFromAnalysis } from "../site-schema-generator/create-site-schema.js";
|
|
12
12
|
import { invokeUpdateSiteSchema } from "./invoke-update-site-schema.js";
|
|
13
13
|
export const analyzePrompt = await createPromptTemplate({
|
|
14
|
-
|
|
14
|
+
filename: "initial-1-analysis.md",
|
|
15
15
|
withSiteSchemaTsDefs: true,
|
|
16
16
|
});
|
|
17
17
|
const fieldsPrompt = await createPromptTemplate({
|
|
18
|
-
|
|
18
|
+
filename: "initial-2-fields.md",
|
|
19
19
|
withSiteSchemaTsDefs: true,
|
|
20
20
|
});
|
|
21
21
|
export async function startInitialAnalysis(ctx, input) {
|
|
@@ -6,10 +6,10 @@ import { debugLlmOutput } from "../lib/debug-utils.js";
|
|
|
6
6
|
import { parseLlmResponseAsProperties } from "../lib/parse-llm-response.js";
|
|
7
7
|
import { safeCallStep } from "../lib/session-utils.js";
|
|
8
8
|
const prompt1Tpl = await createPromptTemplate({
|
|
9
|
-
|
|
9
|
+
filename: "update-site-schema-1-write-details.md",
|
|
10
10
|
});
|
|
11
11
|
const prompt2Tpl = await createPromptTemplate({
|
|
12
|
-
|
|
12
|
+
filename: "update-site-schema-2-execute.md",
|
|
13
13
|
});
|
|
14
14
|
export async function startUpdateSiteSchema(ctx, input) {
|
|
15
15
|
const fromStepSchema = await readStepSchema(ctx, input.fromStepNumber);
|
|
@@ -37,7 +37,7 @@ function templateOfSiteLogoTitle(ctx) {
|
|
|
37
37
|
const content = [
|
|
38
38
|
siteType.fields?.includes("logo")
|
|
39
39
|
? `{% if site.field.logo %}
|
|
40
|
-
{% useImage logo
|
|
40
|
+
{% useImage logo image: site.field.logo resize: "50x50" %}
|
|
41
41
|
<img
|
|
42
42
|
src="{{ logo.url }}"
|
|
43
43
|
width="{{ logo.width }}"
|
|
@@ -197,7 +197,7 @@ function templateOfField(ctx, fieldOrName, parentKey) {
|
|
|
197
197
|
if (dataType === "gallery") {
|
|
198
198
|
return `<div class="Field">
|
|
199
199
|
{% for media in ${parentKey}.${fieldName} %}
|
|
200
|
-
{% useImage im
|
|
200
|
+
{% useImage im image: media resize: "150x150" %}
|
|
201
201
|
<img
|
|
202
202
|
class="Field-img"
|
|
203
203
|
src="{{ im.url }}"
|
|
@@ -205,13 +205,14 @@ function templateOfField(ctx, fieldOrName, parentKey) {
|
|
|
205
205
|
height="{{ im.height }}"
|
|
206
206
|
loading="lazy"
|
|
207
207
|
alt=""
|
|
208
|
-
|
|
208
|
+
{{ media | zoomable }}
|
|
209
|
+
>
|
|
209
210
|
{% endfor %}
|
|
210
211
|
</div>`;
|
|
211
212
|
}
|
|
212
213
|
if (dataType === "media") {
|
|
213
|
-
const
|
|
214
|
-
return `{% useImage im
|
|
214
|
+
const mediaKey = `${parentKey}.${fieldName}`;
|
|
215
|
+
return `{% useImage im image: ${mediaKey} resize: "x250x" %}
|
|
215
216
|
<div class="Field">
|
|
216
217
|
<img
|
|
217
218
|
class="Field-img"
|
|
@@ -220,7 +221,8 @@ function templateOfField(ctx, fieldOrName, parentKey) {
|
|
|
220
221
|
height="{{ im.height }}"
|
|
221
222
|
loading="lazy"
|
|
222
223
|
alt=""
|
|
223
|
-
|
|
224
|
+
{{ ${mediaKey} | zoomable }}
|
|
225
|
+
>
|
|
224
226
|
</div>`;
|
|
225
227
|
}
|
|
226
228
|
if (fieldName === "title") {
|
|
@@ -230,15 +232,15 @@ function templateOfField(ctx, fieldOrName, parentKey) {
|
|
|
230
232
|
}
|
|
231
233
|
function templateOfPicture({ imageKey }) {
|
|
232
234
|
return `{% if ${imageKey} %}
|
|
233
|
-
{% useImage smallIm
|
|
234
|
-
{% useImage largeIm
|
|
235
|
+
{% useImage smallIm image: ${imageKey} resize: "360x48" %}
|
|
236
|
+
{% useImage largeIm image: ${imageKey} resize: "1200x160" %}
|
|
235
237
|
<div class="Container">
|
|
236
238
|
<picture class="Hero">
|
|
237
239
|
<source
|
|
238
240
|
srcset="{{ largeIm.url }}"
|
|
239
241
|
width="{{ largeIm.width }}"
|
|
240
242
|
height="{{ largeIm.height }}"
|
|
241
|
-
media="(min-width:
|
|
243
|
+
media="(min-width: 361px)">
|
|
242
244
|
<img
|
|
243
245
|
src="{{ smallIm.url }}"
|
|
244
246
|
width="{{ smallIm.width }}"
|
|
@@ -327,7 +329,7 @@ function templateOfDocumentTile(docVariableName) {
|
|
|
327
329
|
<article>
|
|
328
330
|
{% if ${docVariableName}.defaultImage %}
|
|
329
331
|
<div>
|
|
330
|
-
{% useImage im
|
|
332
|
+
{% useImage im image: ${docVariableName}.defaultImage resize: "120x120" %}
|
|
331
333
|
<img
|
|
332
334
|
src="{{ im.url }}"
|
|
333
335
|
width="{{ im.width }}"
|
|
@@ -78,8 +78,10 @@ function getPackageJsonContent(options) {
|
|
|
78
78
|
dependencies: {
|
|
79
79
|
"@paroicms/contact-form-plugin": "*",
|
|
80
80
|
"@paroicms/content-loading-plugin": "*",
|
|
81
|
+
"@paroicms/internal-link-plugin": "*",
|
|
81
82
|
"@paroicms/public-menu-plugin": "*",
|
|
82
83
|
"@paroicms/quill-editor-plugin": "*",
|
|
84
|
+
"@paroicms/video-plugin": "*",
|
|
83
85
|
"@paroicms/server": "*",
|
|
84
86
|
},
|
|
85
87
|
devDependencies: {
|
|
@@ -59,12 +59,12 @@ function createThemeCreatorContext(siteSchema) {
|
|
|
59
59
|
f[language] = value;
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
|
-
hasLiquidFile(directory,
|
|
63
|
-
const path = directory === "root" ? `templates/${
|
|
62
|
+
hasLiquidFile(directory, filename) {
|
|
63
|
+
const path = directory === "root" ? `templates/${filename}` : `templates/${directory}/${filename}`;
|
|
64
64
|
return liquidFiles.has(path);
|
|
65
65
|
},
|
|
66
|
-
addLiquidFile(directory,
|
|
67
|
-
const path = directory === "root" ? `templates/${
|
|
66
|
+
addLiquidFile(directory, filename, content, { skipIfExists = false } = {}) {
|
|
67
|
+
const path = directory === "root" ? `templates/${filename}` : `templates/${directory}/${filename}`;
|
|
68
68
|
if (liquidFiles.has(path)) {
|
|
69
69
|
if (skipIfExists)
|
|
70
70
|
return;
|
|
@@ -216,29 +216,6 @@ nav a.active::after {
|
|
|
216
216
|
display: block;
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
.Text .Img {
|
|
220
|
-
height: auto;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
.Text .Img.left {
|
|
224
|
-
float: left;
|
|
225
|
-
margin: 5px 20px 10px 0;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
.Text .Img.right {
|
|
229
|
-
float: right;
|
|
230
|
-
margin: 5px 0 10px 20px;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
.Text .Img.left, .Text .Img.right {
|
|
234
|
-
max-width: 50%;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
.Text .Img.center {
|
|
238
|
-
display: block;
|
|
239
|
-
margin: 20px auto;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
219
|
.Text a,
|
|
243
220
|
.Text a:visited,
|
|
244
221
|
.TextLink,
|
|
@@ -5,10 +5,11 @@ export function createSiteSchemaFromAnalysis(analysis) {
|
|
|
5
5
|
version: "8",
|
|
6
6
|
languages: [siteProperties.language],
|
|
7
7
|
plugins: [
|
|
8
|
-
"@paroicms/
|
|
8
|
+
"@paroicms/contact-form-plugin",
|
|
9
9
|
"@paroicms/content-loading-plugin",
|
|
10
|
+
"@paroicms/internal-link-plugin",
|
|
10
11
|
"@paroicms/public-menu-plugin",
|
|
11
|
-
"@paroicms/
|
|
12
|
+
"@paroicms/quill-editor-plugin",
|
|
12
13
|
"@paroicms/video-plugin",
|
|
13
14
|
],
|
|
14
15
|
nodeTypes: [
|