From: Alexander Barton Date: Thu, 25 Apr 2019 13:31:59 +0000 (+0200) Subject: Add new "nodejs" plugin X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ax-zsh.git;a=commitdiff_plain;h=6c27d541f630d6414b04d6b4a800a72526b4a233;hp=c782d82badde9f8f59745ab57b5bbf4687838098 Add new "nodejs" plugin 1. Create user-local NPM package directory ~/.npm-packages 2. Setup PATH and MANPATH to include NodeJS search paths --- diff --git a/plugins/nodejs/README.md b/plugins/nodejs/README.md new file mode 100644 index 0000000..a1a6824 --- /dev/null +++ b/plugins/nodejs/README.md @@ -0,0 +1,6 @@ +## nodejs + +Enable ZSH *NodeJS* integration: + +1. Create user-local NPM package directory ~/.npm-packages +2. Setup PATH and MANPATH to include NodeJS search paths diff --git a/plugins/nodejs/nodejs.zprofile b/plugins/nodejs/nodejs.zprofile new file mode 100644 index 0000000..807ba23 --- /dev/null +++ b/plugins/nodejs/nodejs.zprofile @@ -0,0 +1,19 @@ +# AX-ZSH: Alex' Modular ZSH Configuration +# nodejs.zprofile: Setup Nodejs (and NPM) environment. + +# Make sure that NodeJS is installed +(( $+commands[node] )) || return + +npm_packages="${HOME}/.npm-packages" + +if [[ -z "$AXZSH_PLUGIN_CHECK" && ! -d "$npm_packages" ]]; then + # Create the user-local NPM package directory (when not running then + # "plugin check" right now) and the directory doesn't exist yet: + mkdir -p "$npm_packages" +fi + +# Append nodejs paths to binary and manual search paths. +export PATH="$PATH:$npm_packages/bin" +export MANPATH="$MANPATH:$npm_packages/share/man" + +unset npm_packages