@c-time/frelio-data-json-generator 1.4.1 → 1.4.3

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/index.d.ts CHANGED
@@ -150,7 +150,7 @@ type GenerationOutputEntry = {
150
150
  /**
151
151
  * エラーコード
152
152
  */
153
- type GenerationErrorCode = 'RELATION_NOT_FOUND' | 'CONTENT_NOT_FOUND' | 'INVALID_TEMPLATE_VAR' | 'INVALID_JSON' | 'FILTER_ERROR' | 'CIRCULAR_REFERENCE' | 'INVALID_OUTPUT_PATH' | 'DUPLICATE_OUTPUT_PATH';
153
+ type GenerationErrorCode = 'RELATION_NOT_FOUND' | 'CONTENT_NOT_FOUND' | 'INVALID_TEMPLATE_VAR' | 'INVALID_JSON' | 'FILTER_ERROR' | 'CIRCULAR_REFERENCE' | 'INVALID_OUTPUT_PATH' | 'DUPLICATE_OUTPUT_PATH' | 'MISSING_DETAIL_REPLACER';
154
154
  /**
155
155
  * 生成エラー
156
156
  */
package/dist/index.js CHANGED
@@ -233,7 +233,7 @@ function parseContent(path, content) {
233
233
  contentId,
234
234
  contentTypeId,
235
235
  slug: json.slug ?? json.data?.slug ?? contentId,
236
- title: json.title ?? "",
236
+ title: json.title ?? json.data?.title ?? "",
237
237
  status: json.status ?? "draft",
238
238
  data: json.data ?? {},
239
239
  createdAt: json.createdAt ?? "",
@@ -733,6 +733,14 @@ async function processDetailRecipes(contentTypeId, recipes, targets, context) {
733
733
  const outputs = [];
734
734
  const contents = context.contentsByType.get(contentTypeId) ?? [];
735
735
  for (const recipe of recipes) {
736
+ if (!/\{\$this\.[^}]+\}/.test(recipe.outputPath)) {
737
+ context.errors.push({
738
+ code: "MISSING_DETAIL_REPLACER",
739
+ outputPath: recipe.outputPath,
740
+ message: `detail \u30EC\u30B7\u30D4\u306E outputPath \u306B\u306F {$this.slug} \u306A\u3069\u306E\u30EA\u30D7\u30EC\u30FC\u30B5\u30FC\u304C\u5FC5\u8981\u3067\u3059\uFF08\u7121\u3044\u3068\u5168\u30B3\u30F3\u30C6\u30F3\u30C4\u304C\u540C\u4E00\u30D5\u30A1\u30A4\u30EB\u306B\u885D\u7A81\u3057\u307E\u3059\uFF09: ${recipe.outputPath}`
741
+ });
742
+ continue;
743
+ }
736
744
  for (const content of contents) {
737
745
  if (!shouldProcessContent(recipe.outputPath, content, targets)) {
738
746
  continue;