diff options
author | Bartek Iwańczuk <biwanczuk@gmail.com> | 2023-12-15 11:27:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-15 10:27:10 +0000 |
commit | 62e3f5060ef9cc6a31b3e496dd15548c0abd07e6 (patch) | |
tree | e03148c86caebe8b23a8d5f04f9df9357769f7fb /cli/args/mod.rs | |
parent | a1870c70a1adcd58798541aa965c915afa6f6c89 (diff) |
refactor: check if scope and package exist before publish (#21575)
Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Luca Casonato <lucacasonato@yahoo.com>
Diffstat (limited to 'cli/args/mod.rs')
-rw-r--r-- | cli/args/mod.rs | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/cli/args/mod.rs b/cli/args/mod.rs index 17711371a..2cc4517fc 100644 --- a/cli/args/mod.rs +++ b/cli/args/mod.rs @@ -132,31 +132,9 @@ pub fn deno_registry_url() -> &'static Url { pub fn deno_registry_api_url() -> &'static Url { static DENO_REGISTRY_API_URL: Lazy<Url> = Lazy::new(|| { - let env_var_name = "DENO_REGISTRY_API_URL"; - if let Ok(registry_url) = std::env::var(env_var_name) { - // ensure there is a trailing slash for the directory - let registry_url = format!("{}/", registry_url.trim_end_matches('/')); - match Url::parse(®istry_url) { - Ok(url) => { - return url; - } - Err(err) => { - log::debug!( - "Invalid {} environment variable: {:#}", - env_var_name, - err, - ); - } - } - } - - let host = deno_graph::source::DEFAULT_DENO_REGISTRY_URL - .host_str() - .unwrap(); - - let mut url = deno_graph::source::DEFAULT_DENO_REGISTRY_URL.clone(); - url.set_host(Some(&format!("api.{}", host))).unwrap(); - url + let mut deno_registry_api_url = deno_registry_url().clone(); + deno_registry_api_url.set_path("api/"); + deno_registry_api_url }); &DENO_REGISTRY_API_URL |