npx-bin-helper

Crates.ionpx-bin-helper
lib.rsnpx-bin-helper
version0.2.0
sourcesrc
created_at2022-11-11 17:01:04.61077
updated_at2022-11-12 12:54:39.851154
descriptionGenerate commands that add node_modules/.bin to PATH
homepagehttps://github.com/Zolyn/npx-bin-helper
repositoryhttps://github.com/Zolyn/npx-bin-helper
max_upload_size
id712939
size40,345
Yumeoto Zorin (Zolyn)

documentation

README

npx-bin-helper

Crates.io

Generate commands that add node_modules/.bin to PATH. Supports Linux, MacOS and Windows.

Installation

cargo install npx-bin-helper

Usage

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.

Shell setup

Bash

Add the following to .bashrc

eval "$(npx-bin-helper setup -s bash)"

Zsh

Add the following to .zshrc

eval "$(npx-bin-helper setup -s zsh)"

Fish

Create ~/.config/fish/conf.d/npx-bin-helper.fish and add the following to it

npx-bin-helper setup -s fish | source

PowerShell

Add the following to your profile

npx-bin-helper setup -s fish | Out-String | Invoke-Expression

License

MIT

References

Commit count: 35

cargo fmt