Skip to content

Commit ea7b86d

Browse files
authored
feat: support bunx when available
1 parent 9604bef commit ea7b86d

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/rcfile/javascript.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ pub fn from_javascript_path(file_path: &Path) -> Result<Rcfile, RcfileError> {
6969
"#
7070
);
7171

72-
Command::new("npx")
72+
// Prefer bunx if a Bun lockfile exists in the same directory as the config
73+
let dir = file_path.parent().unwrap_or_else(|| Path::new("."));
74+
let use_bunx = dir.join("bun.lock").exists() || dir.join("bun.lockb").exists();
75+
let runner = if use_bunx { "bunx" } else { "npx" };
76+
77+
Command::new(runner)
7378
.args(["tsx", "-e", &nodejs_script])
7479
.current_dir(file_path.parent().unwrap_or_else(|| Path::new(".")))
7580
.output()

0 commit comments

Comments
 (0)