mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 10:59:13 +00:00
fix(node): Fix --allow-scripts
with no deno.json
(#24533)
We would resolve the wrong package.json, resulting in an inability to run CJS (or other node-mode) scripts
This commit is contained in:
parent
29186d7e59
commit
04f9db5b22
10 changed files with 82 additions and 20 deletions
|
@ -164,7 +164,9 @@ impl ShellCommand for NpmCommand {
|
|||
}
|
||||
}
|
||||
|
||||
pub struct NodeCommand;
|
||||
pub struct NodeCommand {
|
||||
pub force_node_modules_dir: bool,
|
||||
}
|
||||
|
||||
impl ShellCommand for NodeCommand {
|
||||
fn execute(
|
||||
|
@ -191,6 +193,9 @@ impl ShellCommand for NodeCommand {
|
|||
.execute(context);
|
||||
}
|
||||
args.extend(["run", "-A"].into_iter().map(|s| s.to_string()));
|
||||
if self.force_node_modules_dir {
|
||||
args.push("--node-modules-dir=true".to_string());
|
||||
}
|
||||
args.extend(context.args.iter().cloned());
|
||||
|
||||
let mut state = context.state;
|
||||
|
@ -303,6 +308,7 @@ impl ShellCommand for NodeModulesFileRunCommand {
|
|||
let mut args = vec![
|
||||
"run".to_string(),
|
||||
"--ext=js".to_string(),
|
||||
"--node-modules-dir=true".to_string(),
|
||||
"-A".to_string(),
|
||||
self.path.to_string_lossy().to_string(),
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue