Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/rcfile/javascript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ pub fn from_javascript_path(file_path: &Path) -> Result<Rcfile, RcfileError> {
"#
);

Command::new("npx")
// Prefer bunx if a Bun lockfile exists in the same directory as the config
let dir = file_path.parent().unwrap_or_else(|| Path::new("."));
let use_bunx = dir.join("bun.lock").exists() || dir.join("bun.lockb").exists();
let runner = if use_bunx { "bunx" } else { "npx" };

Command::new(runner)
.args(["tsx", "-e", &nodejs_script])
.current_dir(file_path.parent().unwrap_or_else(|| Path::new(".")))
.output()
Expand Down
Loading