From 416faba2bca4fd2fcbcdb8cd51fc6027b185cb45 Mon Sep 17 00:00:00 2001 From: Yifeng Wang Date: Thu, 5 Sep 2024 10:14:51 +0800 Subject: [PATCH] chore: support http proxy in bump script (#8098) --- tools/bump-blocksuite/README.md | 13 +++++++++++++ tools/bump-blocksuite/index.js | 5 +++++ tools/bump-blocksuite/package.json | 3 ++- yarn.lock | 1 + 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 tools/bump-blocksuite/README.md diff --git a/tools/bump-blocksuite/README.md b/tools/bump-blocksuite/README.md new file mode 100644 index 0000000000..be81a1fab2 --- /dev/null +++ b/tools/bump-blocksuite/README.md @@ -0,0 +1,13 @@ +# Bump BlockSuite + +To update BlockSuite, run following command in project root: + +```sh +node scripts/bump-blocksuite.js +``` + +For network issue, try setting proxy environment variables: + +```sh +export http_proxy=http://127.0.0.1:7890 +``` diff --git a/tools/bump-blocksuite/index.js b/tools/bump-blocksuite/index.js index db8a216aa4..69a8ea2ad8 100644 --- a/tools/bump-blocksuite/index.js +++ b/tools/bump-blocksuite/index.js @@ -11,6 +11,7 @@ import { Sort, } from '@napi-rs/simple-git'; import chalk from 'chalk'; +import { ProxyAgent, setGlobalDispatcher } from 'undici'; import corePackage from '../../packages/frontend/core/package.json' assert { type: 'json' }; @@ -32,6 +33,10 @@ if (oldHash === latestHash) { process.exit(0); } +if (process.env.http_proxy) { + setGlobalDispatcher(new ProxyAgent(process.env.http_proxy)); +} + console.info(`Upgrade blocksuite from ${oldHash} -> ${latestHash}`); const blockSuiteDeps = execSync(`yarn info -A --name-only --json`, { diff --git a/tools/bump-blocksuite/package.json b/tools/bump-blocksuite/package.json index af37ffbd64..2803e8f63c 100644 --- a/tools/bump-blocksuite/package.json +++ b/tools/bump-blocksuite/package.json @@ -8,6 +8,7 @@ "dependencies": { "@napi-rs/clipboard": "^1.1.2", "@napi-rs/simple-git": "^0.1.18", - "chalk": "^5.3.0" + "chalk": "^5.3.0", + "undici": "^6.12.0" } } diff --git a/yarn.lock b/yarn.lock index 87bebd4cc4..34e0aaeae7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -228,6 +228,7 @@ __metadata: "@napi-rs/clipboard": "npm:^1.1.2" "@napi-rs/simple-git": "npm:^0.1.18" chalk: "npm:^5.3.0" + undici: "npm:^6.12.0" languageName: unknown linkType: soft