@c-time/frelio-data-json-generator 3.0.0 → 3.1.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/dist/cli.js +27 -10
- package/dist/cli.js.map +1 -1
- package/dist/index.js +27 -10
- package/dist/index.js.map +1 -1
- package/dist/preview/index.d.ts +35 -2
- package/dist/preview/index.js +164 -8
- package/dist/preview/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -185,6 +185,19 @@ function calculateRegenerationScope(changes, dependencyMap, recipe) {
|
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
+
const changedTemplateRel = new Set(
|
|
189
|
+
[...changes.templates.added, ...changes.templates.modified].map(
|
|
190
|
+
(p) => p.startsWith("templates/") ? p.slice("templates/".length) : p
|
|
191
|
+
)
|
|
192
|
+
);
|
|
193
|
+
for (const sp of recipe.staticPages ?? []) {
|
|
194
|
+
if (sp.templatePath && changedTemplateRel.has(sp.templatePath)) {
|
|
195
|
+
addTarget({
|
|
196
|
+
outputPath: sp.outputPath,
|
|
197
|
+
reason: "template_changed"
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
188
201
|
for (const ctPath of [...changes.contentTypes.added, ...changes.contentTypes.modified]) {
|
|
189
202
|
const depPath = ctPath.replace(/\.json$/, "");
|
|
190
203
|
const affected = findAffectedOutputs(dependencyMap, depPath);
|
|
@@ -857,16 +870,7 @@ async function processDetailRecipes(contentTypeId, recipes, targets, context) {
|
|
|
857
870
|
}
|
|
858
871
|
return outputs;
|
|
859
872
|
}
|
|
860
|
-
async function
|
|
861
|
-
const outputPath = sanitizePath(resolveOutputPath(recipe.outputPath, content));
|
|
862
|
-
const pathError = validateOutputPath(outputPath);
|
|
863
|
-
if (pathError) {
|
|
864
|
-
context.errors.push({
|
|
865
|
-
...pathError,
|
|
866
|
-
contentId: content.contentId
|
|
867
|
-
});
|
|
868
|
-
return null;
|
|
869
|
-
}
|
|
873
|
+
async function buildDetailPageData(recipe, content, allContents, context) {
|
|
870
874
|
let data = { ...content.data };
|
|
871
875
|
data.contentId = content.contentId;
|
|
872
876
|
data.slug = content.slug;
|
|
@@ -889,6 +893,19 @@ async function processDetailContent(recipe, content, allContents, context) {
|
|
|
889
893
|
data.first = nav.first;
|
|
890
894
|
data.last = nav.last;
|
|
891
895
|
}
|
|
896
|
+
return data;
|
|
897
|
+
}
|
|
898
|
+
async function processDetailContent(recipe, content, allContents, context) {
|
|
899
|
+
const outputPath = sanitizePath(resolveOutputPath(recipe.outputPath, content));
|
|
900
|
+
const pathError = validateOutputPath(outputPath);
|
|
901
|
+
if (pathError) {
|
|
902
|
+
context.errors.push({
|
|
903
|
+
...pathError,
|
|
904
|
+
contentId: content.contentId
|
|
905
|
+
});
|
|
906
|
+
return null;
|
|
907
|
+
}
|
|
908
|
+
const data = await buildDetailPageData(recipe, content, allContents, context);
|
|
892
909
|
const dataJson = {
|
|
893
910
|
type: "update",
|
|
894
911
|
template: recipe.templatePath,
|