Crates.io | npx-bin-helper |
lib.rs | npx-bin-helper |
version | 0.2.0 |
source | src |
created_at | 2022-11-11 17:01:04.61077 |
updated_at | 2022-11-12 12:54:39.851154 |
description | Generate commands that add node_modules/.bin to PATH |
homepage | https://github.com/Zolyn/npx-bin-helper |
repository | https://github.com/Zolyn/npx-bin-helper |
max_upload_size | |
id | 712939 |
size | 40,345 |
Generate commands that add node_modules/.bin
to PATH. Supports Linux, MacOS and Windows.
cargo install npx-bin-helper
npx-bin-helper -s <SHELL>
This will generate commands to set environment variables depending on your shell type.
Currently npx-bin-helper supports the following shells:
bash
(Including Git Bash on Windows)zsh
fish
powershell
(Windows, MacOS, Linux)For example:
npx-bin-helper -s bash
Output:
export _NPX_BIN="/path/to/project/node_modules/.bin"
export PATH="/path/to/project/node_modules/.bin:..."
To generate and evaluate commands automatically when changing directory, you need to set up your shell.
Add the following to .bashrc
eval "$(npx-bin-helper setup -s bash)"
Add the following to .zshrc
eval "$(npx-bin-helper setup -s zsh)"
Create ~/.config/fish/conf.d/npx-bin-helper.fish
and add the following to it
npx-bin-helper setup -s fish | source
Add the following to your profile
npx-bin-helper setup -s fish | Out-String | Invoke-Expression