summaryrefslogtreecommitdiff
path: root/cli/standalone/mod.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-05-23 22:26:23 +0100
committerGitHub <noreply@github.com>2024-05-23 23:26:23 +0200
commit959739f609dddacde3bbe9ecede2f409214fb34c (patch)
tree04d1776efbd3561205829f78288d26b6e14c3429 /cli/standalone/mod.rs
parent5de30c53239ac74843725d981afc0bb8c45bdf16 (diff)
FUTURE: initial support for .npmrc file (#23560)
This commit adds initial support for ".npmrc" files. Currently we only discover ".npmrc" files next to "package.json" files and discovering these files in user home dir is left for a follow up. This pass supports "_authToken" and "_auth" configuration for providing authentication. LSP support has been left for a follow up PR. Towards https://github.com/denoland/deno/issues/16105
Diffstat (limited to 'cli/standalone/mod.rs')
-rw-r--r--cli/standalone/mod.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/cli/standalone/mod.rs b/cli/standalone/mod.rs
index 288618287..1c081bc86 100644
--- a/cli/standalone/mod.rs
+++ b/cli/standalone/mod.rs
@@ -1,5 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
+use crate::args::create_default_npmrc;
use crate::args::get_root_cert_store;
use crate::args::npm_pkg_req_ref_to_binary_command;
use crate::args::CaData;
@@ -349,7 +350,8 @@ pub async fn run(
let root_path = std::env::temp_dir()
.join(format!("deno-compile-{}", current_exe_name))
.join("node_modules");
- let npm_cache_dir = NpmCacheDir::new(root_path.clone());
+ let npm_cache_dir =
+ NpmCacheDir::new(root_path.clone(), vec![npm_registry_url.clone()]);
let npm_global_cache_dir = npm_cache_dir.get_cache_location();
let cache_setting = CacheSetting::Only;
let (package_json_deps_provider, fs, npm_resolver, maybe_vfs_root) =
@@ -363,7 +365,7 @@ pub async fn run(
let vfs_root_dir_path = if node_modules_dir {
root_path
} else {
- npm_cache_dir.registry_folder(&npm_registry_url)
+ npm_cache_dir.root_dir().to_owned()
};
let vfs = load_npm_vfs(vfs_root_dir_path.clone())
.context("Failed to load npm vfs.")?;
@@ -392,8 +394,10 @@ pub async fn run(
CliNpmResolverManagedPackageJsonInstallerOption::ConditionalInstall(
package_json_deps_provider.clone(),
),
- npm_registry_url,
npm_system_info: Default::default(),
+ // Packages from different registries are already inlined in the ESZip,
+ // so no need to create actual `.npmrc` configuration.
+ npmrc: create_default_npmrc(),
}),
)
.await?;
@@ -448,8 +452,10 @@ pub async fn run(
CliNpmResolverManagedPackageJsonInstallerOption::ConditionalInstall(
package_json_deps_provider.clone(),
),
- npm_registry_url,
npm_system_info: Default::default(),
+ // Packages from different registries are already inlined in the ESZip,
+ // so no need to create actual `.npmrc` configuration.
+ npmrc: create_default_npmrc(),
}),
)
.await?;