gatsby-source-notion-churnotion 1.0.19 → 1.0.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -125,7 +125,7 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
125
125
  }
126
126
  const bookId = page.properties?.book?.relation?.[0]?.id || null;
127
127
  const markdownContent = await connector_1.n2m.pageToMarkdown(page.id);
128
- await (0, imageProcessor_1.processBlocks)(markdownContent, actions, getCache, createNodeId, reporter);
128
+ const thumbnailUrl = await (0, imageProcessor_1.processBlocks)(markdownContent, actions, getCache, createNodeId, reporter);
129
129
  const postNode = {
130
130
  id: nodeId,
131
131
  category: parentCategoryId,
@@ -150,6 +150,7 @@ const getPages = async ({ databaseId, reporter, getCache, actions, createNode, c
150
150
  tags: tagIds,
151
151
  parent: null,
152
152
  url: `${constants_1.COMMON_URI}/${constants_1.POST_URI}${categoryUrl}/${slug}`,
153
+ thumbnailUrl: thumbnailUrl,
153
154
  };
154
155
  await createNode(postNode);
155
156
  // book과 post 부모-자식 관계 설정
@@ -20,6 +20,7 @@ const createSchemaCustomization = ({ actions }) => {
20
20
  slug: String
21
21
  category_list: [${constants_1.NODE_TYPE.Category}]
22
22
  url: String!
23
+ thumbnailUrl: String
23
24
  }
24
25
 
25
26
  type ${constants_1.NODE_TYPE.Tag} implements Node {
@@ -1,3 +1,3 @@
1
1
  import { Actions, GatsbyCache, Reporter } from "gatsby";
2
2
  import { MdBlock } from "notion-to-md/build/types";
3
- export declare const processBlocks: (blocks: MdBlock[], actions: Actions, getCache: (this: void, id: string) => GatsbyCache, createNodeId: (this: void, input: string) => string, reporter: Reporter) => Promise<void>;
3
+ export declare const processBlocks: (blocks: MdBlock[], actions: Actions, getCache: (this: void, id: string) => GatsbyCache, createNodeId: (this: void, input: string) => string, reporter: Reporter) => Promise<string>;
@@ -9,6 +9,7 @@ const path_1 = __importDefault(require("path"));
9
9
  const crypto_1 = __importDefault(require("crypto"));
10
10
  const processBlocks = async (blocks, actions, getCache, createNodeId, reporter) => {
11
11
  const { createNode } = actions;
12
+ let thumbnailUrl = ``;
12
13
  for (const block of blocks) {
13
14
  // 이미지 블록 처리
14
15
  if (block.type === `image` &&
@@ -34,6 +35,8 @@ const processBlocks = async (blocks, actions, getCache, createNodeId, reporter)
34
35
  if (fileNode) {
35
36
  const relativePath = `/static/images/${hashedFileName}`; // 해싱된 파일명을 사용
36
37
  block.parent = `![${hashedFileName}](${relativePath})`; // Markdown 형식으로 업데이트
38
+ if (thumbnailUrl.length === 0)
39
+ thumbnailUrl = relativePath;
37
40
  reporter.info(`[SUCCESS] Updated block with new hashed image path: ${block.parent}`);
38
41
  }
39
42
  }
@@ -43,5 +46,6 @@ const processBlocks = async (blocks, actions, getCache, createNodeId, reporter)
43
46
  }
44
47
  }
45
48
  }
49
+ return thumbnailUrl;
46
50
  };
47
51
  exports.processBlocks = processBlocks;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "gatsby-source-notion-churnotion",
3
3
  "description": "Gatsby plugin that can connect with One Notion Database RECURSIVELY using official API",
4
- "version": "1.0.19",
4
+ "version": "1.0.20",
5
5
  "skipLibCheck": true,
6
6
  "license": "0BSD",
7
7
  "main": "./dist/gatsby-node.js",