Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/big-words-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"notion-to-utils": minor
---

refactor: Remove makePreviewImage and formatNotionImageUrl functionality
2 changes: 0 additions & 2 deletions packages/notion-to-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"devDependencies": {
"@repo/eslint-config": "workspace:*",
"@repo/typescript-config": "workspace:*",
"@types/lqip-modern": "^1.1.7",
"@types/probe-image-size": "^7.2.5",
"@vitest/coverage-v8": "2.1.2",
"jsdom": "^26.0.0",
Expand All @@ -52,7 +51,6 @@
},
"dependencies": {
"@notionhq/client": "^2.2.15",
"lqip-modern": "^2.2.1",
"open-graph-scraper": "^6.9.0",
"probe-image-size": "^7.2.3"
}
Expand Down
6 changes: 3 additions & 3 deletions packages/notion-to-utils/src/client/getPageBlocks.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Client } from '@notionhq/client';
import ogs from 'open-graph-scraper';
import {
ListBlockChildrenResponse,
BlockObjectResponse,
PartialBlockObjectResponse,
} from '@notionhq/client/build/src/api-endpoints';
import { formatNotionImageUrl } from './formatNotionImageUrl';
import { addMetadataToImageBlock } from '../utils';
import ogs from 'open-graph-scraper';
import { formatNotionImageUrl } from '../utils/formatNotionImageUrl';
import { addMetadataToImageBlock } from './utils/getImageMetadata';

// 블록 타입 정의
export type NotionBlock = BlockObjectResponse | PartialBlockObjectResponse;
Expand Down
2 changes: 1 addition & 1 deletion packages/notion-to-utils/src/client/getPageProperties.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Client } from '@notionhq/client';
import { isPageObjectResponse } from './utils/isPageObjectResponse';
import { extractValuesFromProperties } from './utils/extractValuesFromProperties';
import { formatNotionImageUrl } from './formatNotionImageUrl';
import { formatNotionImageUrl } from '../utils/formatNotionImageUrl';

/**
* Retrieves properties of a Notion page.
Expand Down
5 changes: 1 addition & 4 deletions packages/notion-to-utils/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { ClientOptions } from '@notionhq/client/build/src/Client';
import { getPageProperties as getPagePropertiesFunc } from './getPageProperties';
import { getFileUrl as getFileUrlFunc } from './getFileUrl';
import { getPageBlocks as getPageBlocksFunc } from './getPageBlocks';
import { formatNotionImageUrl as formatNotionImageUrlFunc } from './formatNotionImageUrl';

export class Client extends NotionClient {
constructor(options: ClientOptions = {}) {
Expand All @@ -15,13 +14,11 @@ export class Client extends NotionClient {
keys: string[] = [],
extractValues = true
) => getPagePropertiesFunc(this, pageId, keys, extractValues);

getPageBlocks = (pageId: string) => getPageBlocksFunc(this, pageId);

getFileUrl = (pageId: string, propertyKey: string) =>
getFileUrlFunc(this, pageId, propertyKey);
//? 25.4.7 formatNotionImageUrl 외부에서 미사용
formatNotionImageUrl = (url: string, blockId?: string) =>
formatNotionImageUrlFunc(url, blockId);
}

export default Client;
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import probe from 'probe-image-size';
* @param url 이미지 URL
* @returns 이미지 메타데이터 (너비, 높이, 종횡비) 또는 null (추출 실패 시)
*/
export async function getImageMetadata(url: string): Promise<{
async function getImageMetadata(url: string): Promise<{
width: number;
height: number;
aspectRatio: number;
Expand Down
3 changes: 1 addition & 2 deletions packages/notion-to-utils/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './makePreviewImage';
export * from './getImageMetadata';
export * from './formatNotionImageUrl';
67 changes: 0 additions & 67 deletions packages/notion-to-utils/src/utils/makePreviewImage.spec.ts

This file was deleted.

41 changes: 0 additions & 41 deletions packages/notion-to-utils/src/utils/makePreviewImage.ts

This file was deleted.

Loading