summaryrefslogtreecommitdiff
path: root/cli/factory.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-12-06 16:36:06 -0500
committerGitHub <noreply@github.com>2023-12-06 16:36:06 -0500
commite372fc73e806faeeb3c67df2d5b10a63fe5e8213 (patch)
tree8231a04ab1ea19dc4aa9d8e6be502cbf6c136ede /cli/factory.rs
parent7fdc3c8f1fc27be2ca7d4ff62b9fd8ecb3d24e61 (diff)
fix(task): handle node_modules/.bin directory with byonm (#21386)
A bit hacky, but it works. Essentially, this will check for all the scripts in the node_modules/.bin directory then force them to run with Deno via deno_task_shell.
Diffstat (limited to 'cli/factory.rs')
-rw-r--r--cli/factory.rs19
1 files changed, 5 insertions, 14 deletions
diff --git a/cli/factory.rs b/cli/factory.rs
index 027cc8fe4..78f8f5b86 100644
--- a/cli/factory.rs
+++ b/cli/factory.rs
@@ -1,6 +1,5 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-use crate::args::npm_pkg_req_ref_to_binary_command;
use crate::args::CliOptions;
use crate::args::DenoSubcommand;
use crate::args::Flags;
@@ -60,7 +59,6 @@ use deno_runtime::deno_node::NodeResolver;
use deno_runtime::deno_tls::RootCertStoreProvider;
use deno_runtime::deno_web::BlobStore;
use deno_runtime::inspector_server::InspectorServer;
-use deno_semver::npm::NpmPackageReqReference;
use import_map::ImportMap;
use log::warn;
use std::future::Future;
@@ -692,18 +690,11 @@ impl CliFactory {
is_inspecting: self.options.is_inspecting(),
is_npm_main: self.options.is_npm_main(),
location: self.options.location_flag().clone(),
- maybe_binary_npm_command_name: {
- let mut maybe_binary_command_name = None;
- if let DenoSubcommand::Run(flags) = self.options.sub_command() {
- if let Ok(pkg_ref) = NpmPackageReqReference::from_str(&flags.script) {
- // if the user ran a binary command, we'll need to set process.argv[0]
- // to be the name of the binary command instead of deno
- maybe_binary_command_name =
- Some(npm_pkg_req_ref_to_binary_command(&pkg_ref));
- }
- }
- maybe_binary_command_name
- },
+ // if the user ran a binary command, we'll need to set process.argv[0]
+ // to be the name of the binary command instead of deno
+ maybe_binary_npm_command_name: self
+ .options
+ .take_binary_npm_command_name(),
origin_data_folder_path: Some(self.deno_dir()?.origin_data_folder_path()),
seed: self.options.seed(),
unsafely_ignore_certificate_errors: self