diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-02-23 10:58:10 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-23 10:58:10 -0500 |
commit | 344317ec501fa124f0c74b44035fa4516999dce6 (patch) | |
tree | 3a0e4ca3d83b1a47a0903f08648ef1b896b32195 /cli/args/flags.rs | |
parent | 214bdbbc2b09ab3f56f0ffe1ad5930d48ec0c76f (diff) |
feat(npm): support bare specifiers from package.json in more subcommands and language server (#17891)
Diffstat (limited to 'cli/args/flags.rs')
-rw-r--r-- | cli/args/flags.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs index 825bf96d0..35da62fc8 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -19,6 +19,8 @@ use std::num::NonZeroUsize; use std::path::PathBuf; use std::str::FromStr; +use crate::util::fs::canonicalize_path; + use super::flags_allow_net; static LONG_VERSION: Lazy<String> = Lazy::new(|| { @@ -499,6 +501,16 @@ impl Flags { Some(vec![]) } } + Task(TaskFlags { + cwd: Some(path), .. + }) => { + // attempt to resolve the config file from the task subcommand's + // `--cwd` when specified + match canonicalize_path(&PathBuf::from(path)) { + Ok(path) => Some(vec![path]), + Err(_) => Some(vec![]), + } + } _ => Some(vec![]), } } @@ -533,7 +545,8 @@ impl Flags { .to_file_path() .ok() } - Task(TaskFlags { cwd: None, .. }) => std::env::current_dir().ok(), + Task(_) | Check(_) | Coverage(_) | Cache(_) | Info(_) | Eval(_) + | Test(_) | Bench(_) => std::env::current_dir().ok(), _ => None, } } |