From 8cba5a2e30a09d3015ea174168800925cfaa461f Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Wed, 28 May 2025 18:09:43 -0400 Subject: Put `npm`'s bin directory on `$PATH` when using direnv. This allows developers (hi) to run tools installed via NPM without having to run `npm exec` or `npx` to do so. It's mostly for ergonomics, but it's nice to be able to run `vite build` and have it "just" work. The "canonical" invocations, used in tool scripts or when `build.rs` has to run Node, uses `npx`. More generally, we don't assume direnv, even though the source tree provides it. There is no corresponding `layout rust` in `direnv`, but the same niche is fulfilled by the `PATH_add` targeting Cargo's output directory. I also considered using `PATH_add` instead of `layout` for this, as they do the same thing (at least as of this version of `direnv`), but I think it's probably more appropriate to use the parts of direnv that express the broader intention to use Node's tools than to manually implement them myself. If you're using `direnv` across this change, you'll need to re-run `direnv allow`. --- .envrc | 2 ++ 1 file changed, 2 insertions(+) (limited to '.envrc') diff --git a/.envrc b/.envrc index 56295f5..28a3690 100644 --- a/.envrc +++ b/.envrc @@ -1,3 +1,5 @@ +layout node + PATH_add tools PATH_add target/debug -- cgit v1.2.3