Created
October 20, 2017 04:35
-
-
Save jameswomack/87f03b0d30ccb336bd6c7bd230e65e3f to your computer and use it in GitHub Desktop.
Check if NPM bins have been made available via PATH using Node.js on *nix
This file contains hidden or 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
| // CP.execSync('zsh -xl') <- example of getting all environment variable sets in the current ZSH load. Seems to not work for the subshells it's based on | |
| // Determine if $SHELL (convention used by Bash & ZSH) is a path to ZSH & add a $PATH with the CWD NPM bin path prepended to the current user's zshrc file | |
| !!~CP.execSync('echo $SHELL').toString().match(/(?!(^\/bin\/))([a-z]+)(?=(\n$))/g) || CP.execSync('echo \'export PATH=./node_modules/.bin:$PATH\' >> ~/.zshrc') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment