Conversation
The wrapper is only used when npm is run directly from the shell. To work in all cases, the npm function needs to be moved to a PATH-accessible script.
davidchambers
changed the title
.bashrc: define
add npm wrapper which strips background coloursnpm wrapper which strips background colours
I moved the body of the npm function to ~/bin/npm and appended ~/bin to PATH, so the wrapper is now used when npm is run from within a script.
davidchambers added a commit that referenced this pull request
It seems this is what I am looking for, but I am not sure how to use it. Could you please add a short instruction?
Here are the steps to mirror my set-up:
$ cd ~ $ mkdir -p bin $ curl https://raw.githubusercontent.com/davidchambers/dotfiles/master/bin/npm >bin/npm $ chmod +x bin/npm $ echo 'export PATH="$HOME/bin:$PATH"' >>.bashrc $ source .bashrc
Note that the file needn't live at ~/bin/npm; it can live anywhere on your PATH. I keep it in ~/bin so it can live in this repository.