remcohaszing / zsh-node-bin

Add node_modules/.bin directories to your $PATH.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Zsh node-bin

Add node_modules/.bin directories to your $PATH.

Installation

Oh My Zsh

Clone the repository into your OMZ custom directory.

git clone https://github.com/remcohaszing/zsh-node-bin.git "${ZSH:-~/.oh-my-zsh}/custom/plugins/node-bin"

In your .zshrc file, add node-bin to the plugins array,

plugins+=(node-bin)

Without Oh My Zsh

Clone the repository somewhere.

git clone https://github.com/remcohaszing/zsh-node-bin.git ~/.local/share/zsh-node-bin

Source node-bin.plugin.zsh in your .zshrc

source ~/.local/share/zsh-node-bin/node-bin.plugin.zsh

Usage

This plugin runs a function before each command. This function searches for all node_modules/.bin directories up the file tree and adds them to your $PATH. This allows you to run these commands without the use of npx, pnpx, or bunx. This also works for subdirectories in your project and monorepos.

For example, without this plugin, you would run:

npx eslint .
pnpx prettier .
yarn remark .
bunx vitest

Now you can now run:

eslint .
prettier .
remark .
vitest

This plugin removes the overhead of those command runners, It also means those commands work with other integrations, such as autocompletion and thefuck.

Security

This plugin appends the paths. This means commands from node_modules/.bin can never override your system commands.

License

MIT © Remco Haszing

About

Add node_modules/.bin directories to your $PATH.

License:MIT License


Languages

Language:Shell 100.0%