Skip to content

Commit

Permalink
Add SKIP_ASSETS=1 env variable for just export content, no assets f…
Browse files Browse the repository at this point in the history
…or speedup debug.
  • Loading branch information
huacnlee committed Nov 23, 2023
1 parent 2430291 commit 705fbee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions feishu-pages/src/feishu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 6 additions & 0 deletions feishu-pages/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
DOCS_DIR,
OUTPUT_DIR,
ROOT_NODE_TOKEN,
SKIP_ASSETS,
feishuConfig,
feishuDownload,
fetchTenantAccessToken,
Expand Down Expand Up @@ -143,6 +144,11 @@ const downloadFiles = async (
fileTokens: Record<string, FileToken>,
docFolder: string
) => {
if (SKIP_ASSETS) {
console.info('skip assets download.');
return content;
}

for (const fileToken in fileTokens) {
const filePath = await feishuDownload(
fileToken,
Expand Down

0 comments on commit 705fbee

Please sign in to comment.