diff --git a/lib/get-all-pages.ts b/lib/get-all-pages.ts index 53ced4a..023a14f 100644 --- a/lib/get-all-pages.ts +++ b/lib/get-all-pages.ts @@ -3,7 +3,7 @@ import { getAllPagesInSpace } from 'notion-utils' import * as types from './types' import { includeNotionIdInUrls } from './config' -import { notion } from './notion' +import { notion } from './notion-api' import { getCanonicalPageId } from './get-canonical-page-id' const uuid = !!includeNotionIdInUrls diff --git a/lib/notion-api.ts b/lib/notion-api.ts new file mode 100644 index 0000000..d429403 --- /dev/null +++ b/lib/notion-api.ts @@ -0,0 +1,5 @@ +import { NotionAPI } from 'notion-client' + +export const notion = new NotionAPI({ + apiBaseUrl: process.env.NOTION_API_BASE_URL +}) diff --git a/lib/notion.ts b/lib/notion.ts index f59d7cb..ddbb463 100644 --- a/lib/notion.ts +++ b/lib/notion.ts @@ -1,6 +1,6 @@ -import { NotionAPI } from 'notion-client' import { ExtendedRecordMap, SearchParams, SearchResults } from 'notion-types' +import { notion } from './notion-api' import { getPreviewImageMap } from './preview-images' import { getTweetAstMap } from './tweet-embeds' import { @@ -8,10 +8,6 @@ import { isTweetEmbedSupportEnabled } from './config' -export const notion = new NotionAPI({ - apiBaseUrl: process.env.NOTION_API_BASE_URL -}) - export async function getPage(pageId: string): Promise { const recordMap = await notion.getPage(pageId) diff --git a/package.json b/package.json index fc89d97..2d48c8a 100644 --- a/package.json +++ b/package.json @@ -49,9 +49,9 @@ "react-body-classname": "^1.3.1", "react-dom": "^17.0.2", "react-notion-x": "^6.7.0-alpha.2", - "react-static-tweets": "^0.7.1", + "react-static-tweets": "^0.7.2", "react-use": "^17.3.2", - "static-tweets": "^0.7.1" + "static-tweets": "^0.7.2" }, "devDependencies": { "@next/bundle-analyzer": "^12.1.0", diff --git a/pages/api/social-image.tsx b/pages/api/social-image.tsx index ac0cf47..074491e 100644 --- a/pages/api/social-image.tsx +++ b/pages/api/social-image.tsx @@ -10,7 +10,7 @@ import { } from 'notion-utils' import { PageBlock } from 'notion-types' -import { notion } from 'lib/notion' +import { notion } from 'lib/notion-api' import { getSiteForDomain } from 'lib/get-site-for-domain' import { mapImageUrl } from 'lib/map-image-url' import * as config from 'lib/config' diff --git a/yarn.lock b/yarn.lock index 46088cc..f6a528f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3590,10 +3590,10 @@ react-remove-scroll@^2.4.0: resolved "https://registry.npmjs.org/react-side-effect/-/react-side-effect-2.1.1.tgz" integrity sha512-2FoTQzRNTncBVtnzxFOk2mCpcfxQpenBMbk5kSVBg5UcPqV9fRbgY2zhb7GTWWOlpFmAxhClBDlIq8Rsubz1yQ== -react-static-tweets@^0.7.1: - version "0.7.1" - resolved "https://registry.npmjs.org/react-static-tweets/-/react-static-tweets-0.7.1.tgz" - integrity sha512-PWimW6Wcz1KEVPLVu7selfjmC2bOSucJlNDS3L3CdoUsvtbFj+4crv/4c+lu1QcktRZRAQplkCeEBRsRjoXrjA== +react-static-tweets@^0.7.2: + version "0.7.2" + resolved "https://registry.yarnpkg.com/react-static-tweets/-/react-static-tweets-0.7.2.tgz#295c15ff5d5c1dc0039505d06986a7c49722506f" + integrity sha512-aHXGnMs+NVf6vW51HEee0h84iAShE3lfmTBPnYrse9uVU3QcDe+Vf8EBgCs6tmrnxl4vrGC2+1T4IKiIad9L+w== dependencies: classnames "^2.2.6" swr "^1.0.0-beta.5" @@ -4069,10 +4069,10 @@ standard-as-callback@^2.1.0: resolved "https://registry.npmjs.org/standard-as-callback/-/standard-as-callback-2.1.0.tgz" integrity sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A== -static-tweets@^0.7.1: - version "0.7.1" - resolved "https://registry.npmjs.org/static-tweets/-/static-tweets-0.7.1.tgz" - integrity sha512-Jk9pmTXZOd+tibLvQxuQKX4txhwJIoYofco+R7v6wEctwIFFWxvwP5WpQdPRLWCRb4/l8EuWPiXqTt5TxbYRAg== +static-tweets@^0.7.2: + version "0.7.2" + resolved "https://registry.yarnpkg.com/static-tweets/-/static-tweets-0.7.2.tgz#d0bb8262856be600775562c05fd10ea3aedbbe9f" + integrity sha512-AyZOOOyAZ8UInonVsaOImQ5zcUfrFOhhV/UpnaecJ2joG7clG7I9Y5Uj9fJeYFE+QZaWQfsJQdJCUFaabzfQjQ== dependencies: "@mapbox/rehype-prism" "^0.5.0" "@vercel/fetch" "^6.1.0"