From 9a216806d514b5f41c73c777010572cdf3c51eab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Thu, 22 Sep 2022 16:39:58 +0200 Subject: feat(npm): add support for --reload=npm: and --reload=npm: (#15972) --- cli/npm/cache.rs | 1 + cli/npm/registry.rs | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'cli/npm') diff --git a/cli/npm/cache.rs b/cli/npm/cache.rs index 71a82fd51..a733ecceb 100644 --- a/cli/npm/cache.rs +++ b/cli/npm/cache.rs @@ -204,6 +204,7 @@ impl NpmCache { // if this file exists, then the package didn't successfully extract // the first time, or another process is currently extracting the zip file && !package_folder.join(NPM_PACKAGE_SYNC_LOCK_FILENAME).exists() + && self.cache_setting.should_use_for_npm_package(&id.name) { return Ok(()); } else if self.cache_setting == CacheSetting::Only { diff --git a/cli/npm/registry.rs b/cli/npm/registry.rs index 4fb926287..a0ffd0544 100644 --- a/cli/npm/registry.rs +++ b/cli/npm/registry.rs @@ -105,7 +105,6 @@ pub struct NpmRegistryApi { base_url: Url, cache: NpmCache, mem_cache: Arc>>>, - reload: bool, cache_setting: CacheSetting, progress_bar: ProgressBar, } @@ -133,7 +132,6 @@ impl NpmRegistryApi { pub fn new( base_url: Url, cache: NpmCache, - reload: bool, cache_setting: CacheSetting, progress_bar: ProgressBar, ) -> Self { @@ -141,7 +139,6 @@ impl NpmRegistryApi { base_url, cache, mem_cache: Default::default(), - reload, cache_setting, progress_bar, } @@ -171,7 +168,7 @@ impl NpmRegistryApi { Ok(info) } else { let mut maybe_package_info = None; - if !self.reload { + if self.cache_setting.should_use_for_npm_package(name) { // attempt to load from the file cache maybe_package_info = self.load_file_cached_package_info(name); } -- cgit v1.2.3