@c-time/frelio-data-json-generator 2.3.0 → 2.5.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 CHANGED
@@ -186,7 +186,8 @@ function calculateRegenerationScope(changes, dependencyMap, recipe) {
186
186
  }
187
187
  }
188
188
  for (const ctPath of [...changes.contentTypes.added, ...changes.contentTypes.modified]) {
189
- const affected = findAffectedOutputs(dependencyMap, ctPath);
189
+ const depPath = ctPath.replace(/\.json$/, "");
190
+ const affected = findAffectedOutputs(dependencyMap, depPath);
190
191
  for (const outputPath of affected) {
191
192
  addTarget({
192
193
  outputPath,
@@ -956,7 +957,7 @@ async function processListRecipes(contentTypeId, recipes, targets, context) {
956
957
  }
957
958
  return outputs;
958
959
  }
959
- async function processListWithoutPagination(contentTypeId, recipe, context) {
960
+ async function buildListPageData(contentTypeId, recipe, context) {
960
961
  let contents = context.contentsByType.get(contentTypeId) ?? [];
961
962
  contents = applyFilters(contents, recipe.filters);
962
963
  contents = applySort(contents, recipe.sort);
@@ -967,6 +968,10 @@ async function processListWithoutPagination(contentTypeId, recipe, context) {
967
968
  contents = contents.slice(0, recipe.limit);
968
969
  }
969
970
  const items = await processListItems(contents, recipe, context);
971
+ return { items, totalCount: items.length };
972
+ }
973
+ async function processListWithoutPagination(contentTypeId, recipe, context) {
974
+ const { items, totalCount } = await buildListPageData(contentTypeId, recipe, context);
970
975
  const outputPath = sanitizePath(recipe.outputPath);
971
976
  const pathError = validateOutputPath(outputPath);
972
977
  if (pathError) {
@@ -986,7 +991,7 @@ async function processListWithoutPagination(contentTypeId, recipe, context) {
986
991
  outputFile: toHtmlOutputPath(outputPath),
987
992
  data: {
988
993
  items,
989
- totalCount: items.length
994
+ totalCount
990
995
  }
991
996
  };
992
997
  return {