summaryrefslogtreecommitdiff
path: root/cli/npm/cache.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-09-09 21:57:39 +0200
committerGitHub <noreply@github.com>2022-09-09 15:57:39 -0400
commitf92bd986de7f083ac164c0e3a2b04d3504c29741 (patch)
treedbd0a3484014da69ab8258c5f8e86616574741af /cli/npm/cache.rs
parent3bce2af0ebc997278519f5d6270915bb3fe8fd56 (diff)
feat: download progress bar (#15814)
Diffstat (limited to 'cli/npm/cache.rs')
-rw-r--r--cli/npm/cache.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/cli/npm/cache.rs b/cli/npm/cache.rs
index e39957a6b..a0082fb29 100644
--- a/cli/npm/cache.rs
+++ b/cli/npm/cache.rs
@@ -11,12 +11,12 @@ use deno_core::anyhow::Context;
use deno_core::error::custom_error;
use deno_core::error::AnyError;
use deno_core::url::Url;
-use deno_runtime::colors;
use deno_runtime::deno_fetch::reqwest;
use crate::deno_dir::DenoDir;
use crate::file_fetcher::CacheSetting;
use crate::fs_util;
+use crate::progress_bar::ProgressBar;
use super::semver::NpmVersion;
use super::tarball::verify_and_extract_tarball;
@@ -173,13 +173,19 @@ impl ReadonlyNpmCache {
pub struct NpmCache {
readonly: ReadonlyNpmCache,
cache_setting: CacheSetting,
+ progress_bar: ProgressBar,
}
impl NpmCache {
- pub fn from_deno_dir(dir: &DenoDir, cache_setting: CacheSetting) -> Self {
+ pub fn from_deno_dir(
+ dir: &DenoDir,
+ cache_setting: CacheSetting,
+ progress_bar: ProgressBar,
+ ) -> Self {
Self {
readonly: ReadonlyNpmCache::from_deno_dir(dir),
cache_setting,
+ progress_bar,
}
}
@@ -211,13 +217,7 @@ impl NpmCache {
);
}
- log::log!(
- log::Level::Info,
- "{} {}",
- colors::green("Download"),
- dist.tarball,
- );
-
+ let _guard = self.progress_bar.update(&dist.tarball);
let response = reqwest::get(&dist.tarball).await?;
if response.status() == 404 {