Last active
March 10, 2023 18:25
-
-
Save airtonix/9925531 to your computer and use it in GitHub Desktop.
dynamic npm .bin.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copy this into your `~/.profile`. | |
# This setup an incredibly ugly hack that recompiles your `PATH` | |
# everytime the prompt is printed. | |
# I need this to inject the nearest `node_modules/.bin` into my | |
# path to make it easy to use the binarys there. | |
# Your normal PATH exports here | |
export PATH=$HOME/bin:$PATH | |
ORIGINAL_PATH=$PATH | |
function build_path { | |
export PATH=$(npm bin):$ORIGINAL_PATH | |
} | |
#this line causes the PATH to be regenerated each time a new | |
# prompt is printed to the screen | |
PROMPT_COMMAND=build_path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment