From 705fbee48f6874884d813bed695016e82d0248ee Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Thu, 23 Nov 2023 11:42:02 +0800 Subject: [PATCH] Add `SKIP_ASSETS=1` env variable for just export content, no assets for speedup debug. --- feishu-pages/src/feishu.ts | 4 ++++ feishu-pages/src/index.ts | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/feishu-pages/src/feishu.ts b/feishu-pages/src/feishu.ts index b656312..0a9850e 100644 --- a/feishu-pages/src/feishu.ts +++ b/feishu-pages/src/feishu.ts @@ -32,6 +32,10 @@ export const TMP_DIR = path.resolve( * nested: /slug1/slug2/slug3 */ export const URL_STYLE = process.env.URL_STYLE || 'nested'; +/** + * Skip download assets, for debug speed up. + */ +export const SKIP_ASSETS = process.env.SKIP_ASSETS || false; const feishuConfig = { endpoint: process.env.FEISHU_ENDPOINT || 'https://open.feishu.cn', diff --git a/feishu-pages/src/index.ts b/feishu-pages/src/index.ts index 4f85c71..7237cd0 100644 --- a/feishu-pages/src/index.ts +++ b/feishu-pages/src/index.ts @@ -8,6 +8,7 @@ import { DOCS_DIR, OUTPUT_DIR, ROOT_NODE_TOKEN, + SKIP_ASSETS, feishuConfig, feishuDownload, fetchTenantAccessToken, @@ -143,6 +144,11 @@ const downloadFiles = async ( fileTokens: Record, docFolder: string ) => { + if (SKIP_ASSETS) { + console.info('skip assets download.'); + return content; + } + for (const fileToken in fileTokens) { const filePath = await feishuDownload( fileToken,