Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(task): handle node_modules/.bin directory with byonm #21386

Merged
merged 10 commits into from
Dec 6, 2023

Conversation

dsherret
Copy link
Member

A bit hacky, but it works. Essentially, this will checks for all the scripts in the node_modules/.bin directory then forces them to run with Deno via deno_task_shell.

cli/args/flags.rs Outdated Show resolved Hide resolved
cli/args/flags.rs Outdated Show resolved Hide resolved
cli/factory.rs Outdated Show resolved Hide resolved
Comment on lines +312 to +314
context
.new_command()
.args_vec(["task", "say"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome 👍

];
args.extend(context.args);
let executable_command =
deno_task_shell::ExecutableCommand::new("deno".to_string());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will use the system deno binary and not the current binary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deno_task_shell has some code that will always make the "deno" command use the current executing binary (for the time being, the tests would fail if that weren't the case)

@@ -213,6 +213,14 @@ pub struct RunFlags {
}

impl RunFlags {
#[cfg(test)]
pub fn new_default(script: String) -> Self {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept this change because I think it will make things easier in the future if we ever add another flag to this sub command.

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, great fix 👍

@dsherret dsherret merged commit e372fc7 into denoland:main Dec 6, 2023
14 checks passed
@dsherret dsherret deleted the fix_task_commands_npm branch December 6, 2023 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants