summaryrefslogtreecommitdiff
path: root/cli/args
diff options
context:
space:
mode:
Diffstat (limited to 'cli/args')
-rw-r--r--cli/args/flags.rs14
-rw-r--r--cli/args/mod.rs9
2 files changed, 17 insertions, 6 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs
index 63ec2b947..c4d8a3f87 100644
--- a/cli/args/flags.rs
+++ b/cli/args/flags.rs
@@ -1343,7 +1343,7 @@ TypeScript compiler cache: Subdirectory containing TS compiler output.",
.arg(lock_arg())
.arg(config_arg())
.arg(import_map_arg())
- .arg(local_npm_arg())
+ .arg(node_modules_dir_arg())
.arg(
Arg::new("json")
.long("json")
@@ -1862,6 +1862,7 @@ Remote modules and multiple modules may also be specified:
.arg(config_arg())
.arg(import_map_arg())
.arg(lock_arg())
+ .arg(node_modules_dir_arg())
.arg(reload_arg())
.arg(ca_file_arg())
}
@@ -1875,7 +1876,7 @@ fn compile_args_without_check_args(app: Command) -> Command {
.arg(import_map_arg())
.arg(no_remote_arg())
.arg(no_npm_arg())
- .arg(local_npm_arg())
+ .arg(node_modules_dir_arg())
.arg(config_arg())
.arg(no_config_arg())
.arg(reload_arg())
@@ -2424,7 +2425,7 @@ fn no_npm_arg() -> Arg {
.help("Do not resolve npm modules")
}
-fn local_npm_arg() -> Arg {
+fn node_modules_dir_arg() -> Arg {
Arg::new("node-modules-dir")
.long("node-modules-dir")
.num_args(0..=1)
@@ -2719,7 +2720,7 @@ fn info_parse(flags: &mut Flags, matches: &mut ArgMatches) {
import_map_arg_parse(flags, matches);
location_arg_parse(flags, matches);
ca_file_arg_parse(flags, matches);
- local_npm_args_parse(flags, matches);
+ node_modules_dir_arg_parse(flags, matches);
lock_arg_parse(flags, matches);
no_lock_arg_parse(flags, matches);
no_remote_arg_parse(flags, matches);
@@ -2975,6 +2976,7 @@ fn vendor_parse(flags: &mut Flags, matches: &mut ArgMatches) {
config_args_parse(flags, matches);
import_map_arg_parse(flags, matches);
lock_arg_parse(flags, matches);
+ node_modules_dir_arg_parse(flags, matches);
reload_arg_parse(flags, matches);
flags.subcommand = DenoSubcommand::Vendor(VendorFlags {
@@ -3000,7 +3002,7 @@ fn compile_args_without_check_parse(
import_map_arg_parse(flags, matches);
no_remote_arg_parse(flags, matches);
no_npm_arg_parse(flags, matches);
- local_npm_args_parse(flags, matches);
+ node_modules_dir_arg_parse(flags, matches);
config_args_parse(flags, matches);
reload_arg_parse(flags, matches);
lock_args_parse(flags, matches);
@@ -3254,7 +3256,7 @@ fn no_npm_arg_parse(flags: &mut Flags, matches: &mut ArgMatches) {
}
}
-fn local_npm_args_parse(flags: &mut Flags, matches: &mut ArgMatches) {
+fn node_modules_dir_arg_parse(flags: &mut Flags, matches: &mut ArgMatches) {
flags.node_modules_dir = matches.remove_one::<bool>("node-modules-dir");
}
diff --git a/cli/args/mod.rs b/cli/args/mod.rs
index fef27f464..fdef50983 100644
--- a/cli/args/mod.rs
+++ b/cli/args/mod.rs
@@ -881,6 +881,15 @@ impl CliOptions {
self.maybe_node_modules_folder.clone()
}
+ pub fn node_modules_dir_enablement(&self) -> Option<bool> {
+ self.flags.node_modules_dir.or_else(|| {
+ self
+ .maybe_config_file
+ .as_ref()
+ .and_then(|c| c.node_modules_dir())
+ })
+ }
+
pub fn node_modules_dir_specifier(&self) -> Option<ModuleSpecifier> {
self
.maybe_node_modules_folder