From 6ed5d442584e41e9dfa76de158d53705b69f5e43 Mon Sep 17 00:00:00 2001 From: Thien Tran Date: Tue, 13 May 2025 09:47:54 +0700 Subject: [PATCH] [feat] Download bun+uv on `make dev-tauri` (#4981) * only download if not exist * add download:bin to dev-tauri --- Makefile | 1 + scripts/download-bin.js | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 1f8b4f4ba..176140a64 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,7 @@ dev: check-file-counts dev-tauri: check-file-counts yarn install:cortex + yarn download:bin yarn dev:tauri # Linting diff --git a/scripts/download-bin.js b/scripts/download-bin.js index 618f8f785..93d57fec2 100755 --- a/scripts/download-bin.js +++ b/scripts/download-bin.js @@ -110,8 +110,11 @@ async function main() { } console.log(`Downloading Bun for ${bunPlatform}...`) - await download(bunUrl, path.join(tempBinDir, `bun-${bunPlatform}.zip`)) - await decompress(bunPath, tempBinDir) + const bunSaveDir = path.join(tempBinDir, `bun-${bunPlatform}.zip`) + if (!fs.existsSync(bunSaveDir)) { + await download(bunUrl, bunSaveDir) + await decompress(bunPath, tempBinDir) + } try { copySync( path.join(tempBinDir, `bun-${bunPlatform}`, 'bun'), @@ -156,12 +159,12 @@ async function main() { console.log('Bun downloaded.') console.log(`Downloading UV for ${uvPlatform}...`) - if (platform === 'win32') { - await download(uvUrl, path.join(tempBinDir, `uv-${uvPlatform}.zip`)) - } else { - await download(uvUrl, path.join(tempBinDir, `uv-${uvPlatform}.tar.gz`)) + const uvExt = platform === 'win32' ? `zip` : `tar.gz` + const uvSaveDir = path.join(tempBinDir, `uv-${uvPlatform}.${uvExt}`) + if (!fs.existsSync(uvSaveDir)) { + await download(uvUrl, uvSaveDir) + await decompress(uvPath, tempBinDir) } - await decompress(uvPath, tempBinDir) try { copySync( path.join(tempBinDir, `uv-${uvPlatform}`, 'uv'),