diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-07-12 15:33:30 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-12 15:33:30 -0400 |
commit | 9510a8b7d19798f08a6513ee303a63247306bc66 (patch) | |
tree | ca0e47020582784d82509039798289adf147a079 /cli/args/lockfile.rs | |
parent | 17111589848045b1f2d6b6b47f077c5b63accfc0 (diff) |
fix(config): regression - should not discover npm workspace for nested deno.json not in workspace (#24559)
Closes #24554
Diffstat (limited to 'cli/args/lockfile.rs')
-rw-r--r-- | cli/args/lockfile.rs | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/cli/args/lockfile.rs b/cli/args/lockfile.rs index 3421addae..fa505e7b1 100644 --- a/cli/args/lockfile.rs +++ b/cli/args/lockfile.rs @@ -2,13 +2,12 @@ use std::path::PathBuf; +use deno_config::workspace::Workspace; use deno_core::anyhow::Context; use deno_core::error::AnyError; use deno_core::parking_lot::Mutex; use deno_core::parking_lot::MutexGuard; -use deno_runtime::deno_node::PackageJson; -use crate::args::ConfigFile; use crate::cache; use crate::util::fs::atomic_write_file_with_retries; use crate::Flags; @@ -92,8 +91,7 @@ impl CliLockfile { pub fn discover( flags: &Flags, - maybe_config_file: Option<&ConfigFile>, - maybe_package_json: Option<&PackageJson>, + workspace: &Workspace, ) -> Result<Option<CliLockfile>, AnyError> { if flags.no_lock || matches!( @@ -109,23 +107,9 @@ impl CliLockfile { let filename = match flags.lock { Some(ref lock) => PathBuf::from(lock), - None => match maybe_config_file { - Some(config_file) => { - if config_file.specifier.scheme() == "file" { - match config_file.resolve_lockfile_path()? { - Some(path) => path, - None => return Ok(None), - } - } else { - return Ok(None); - } - } - None => match maybe_package_json { - Some(package_json) => { - package_json.path.parent().unwrap().join("deno.lock") - } - None => return Ok(None), - }, + None => match workspace.resolve_lockfile_path()? { + Some(path) => path, + None => return Ok(None), }, }; |