diff --git a/cli/src/lib/deploy.ts b/cli/src/lib/deploy.ts index 4037e01..94472c5 100644 --- a/cli/src/lib/deploy.ts +++ b/cli/src/lib/deploy.ts @@ -12,6 +12,7 @@ import { execFileSync } from 'node:child_process'; import { mkdtempSync, readFileSync, writeFileSync, existsSync, readdirSync, statSync } from 'node:fs'; import { tmpdir } from 'node:os'; import { join } from 'node:path'; +import chalk from 'chalk'; /** GitHub repo(codeload tarball 來源)。fork 者改這裡或用 ARCRUN_REPO env。 * 注意:repo 名大小寫敏感(codeload 路徑需完全一致)。*/ @@ -185,10 +186,13 @@ async function applyD1Migration(ctx: DeployContext, sql: string): Promise /** 下載 codeload tarball 解壓到暫存目錄,回傳解壓出的 repo root 路徑。*/ async function downloadRepoTarball(ref: string): Promise { const url = `https://codeload.github.com/${ARCRUN_REPO}/tar.gz/${ref}`; + console.log(chalk.gray(` → 從 GitHub 下載最新版本(${ARCRUN_REPO}@${ref},約 10–30 秒,視網速)...`)); const res = await fetch(url, { signal: AbortSignal.timeout(120_000) }); if (!res.ok) throw new Error(`codeload HTTP ${res.status}(${url})`); const buf = Buffer.from(await res.arrayBuffer()); + const sizeMB = (buf.length / 1024 / 1024).toFixed(1); + console.log(chalk.gray(` → 下載完成(${sizeMB} MB),解壓中...`)); const dir = mkdtempSync(join(tmpdir(), 'arcrun-deploy-')); const tarPath = join(dir, 'repo.tar.gz'); writeFileSync(tarPath, buf);