From 2a2ff96be13047cb50612fde0f12e5f6df374ad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 26 Jun 2024 23:17:00 +0100 Subject: fix(ext/node): discover .npmrc in user's homedir (#24021) This commit adds discovery of `.npmrc` files in user's homedir. This is not a perfect fix as it doesn't merge multiple `.npmrc` files together as per https://github.com/denoland/deno/issues/23954 but allows to fallback if no `.npmrc` file is discovered in the project root. --- cli/cache/deno_dir.rs | 4 ++-- cli/cache/mod.rs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'cli/cache') diff --git a/cli/cache/deno_dir.rs b/cli/cache/deno_dir.rs index 00df41c5a..05de1cf7c 100644 --- a/cli/cache/deno_dir.rs +++ b/cli/cache/deno_dir.rs @@ -169,7 +169,7 @@ impl DenoDir { /// To avoid the poorly managed dirs crate #[cfg(not(windows))] -mod dirs { +pub mod dirs { use std::path::PathBuf; pub fn cache_dir() -> Option { @@ -227,7 +227,7 @@ mod dirs { // https://github.com/dirs-dev/dirs-sys-rs/blob/ec7cee0b3e8685573d847f0a0f60aae3d9e07fa2/src/lib.rs#L140-L164 // MIT license. Copyright (c) 2018-2019 dirs-rs contributors #[cfg(windows)] -mod dirs { +pub mod dirs { use std::ffi::OsString; use std::os::windows::ffi::OsStringExt; use std::path::PathBuf; diff --git a/cli/cache/mod.rs b/cli/cache/mod.rs index 64d046c15..3430f74f7 100644 --- a/cli/cache/mod.rs +++ b/cli/cache/mod.rs @@ -43,6 +43,7 @@ pub use caches::Caches; pub use check::TypeCheckCache; pub use code_cache::CodeCache; pub use common::FastInsecureHasher; +pub use deno_dir::dirs::home_dir; pub use deno_dir::DenoDir; pub use deno_dir::DenoDirProvider; pub use disk_cache::DiskCache; -- cgit v1.2.3