Have two module installers, one for linked modules (for ones you actively develop) and one that copies the module so that the original source tree can be deleted.
parent
09e7c3227b
commit
d67c7011f4
21
nvm.sh
21
nvm.sh
|
@ -25,7 +25,8 @@ nvm()
|
||||||
echo " nvm list (Show all installed versions)"
|
echo " nvm list (Show all installed versions)"
|
||||||
echo " nvm use version (Set this version in the PATH)"
|
echo " nvm use version (Set this version in the PATH)"
|
||||||
echo " nvm deactivate (Remove nvm entry from PATH)"
|
echo " nvm deactivate (Remove nvm entry from PATH)"
|
||||||
echo " nvm addlib (Adds the library in cwd to the current env)"
|
echo " nvm addlib (Copies the module in cwd to the current env)"
|
||||||
|
echo " nvm linklib (Links the module in cwd to the current env)"
|
||||||
echo
|
echo
|
||||||
echo "Example:"
|
echo "Example:"
|
||||||
echo " nvm install v0.1.91"
|
echo " nvm install v0.1.91"
|
||||||
|
@ -86,11 +87,22 @@ nvm()
|
||||||
;;
|
;;
|
||||||
"addlib" )
|
"addlib" )
|
||||||
mkdir -p $NODE_PATH
|
mkdir -p $NODE_PATH
|
||||||
|
mkdir -p $NODE_BIN
|
||||||
|
if [ -d `pwd`/lib ]; then
|
||||||
|
cp -r `pwd`/lib/ "$NODE_PATH/"
|
||||||
|
cp -r `pwd`/bin/ "$NODE_BIN/"
|
||||||
|
else
|
||||||
|
echo "Can't find lib dir at `pwd`/lib"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"linklib" )
|
||||||
|
mkdir -p $NODE_PATH
|
||||||
|
mkdir -p $NODE_BIN
|
||||||
if [ -d `pwd`/lib ]; then
|
if [ -d `pwd`/lib ]; then
|
||||||
ln -sf `pwd`/lib/* "$NODE_PATH/"
|
ln -sf `pwd`/lib/* "$NODE_PATH/"
|
||||||
ln -sf `pwd`/bin/* "$NODE_BIN/"
|
ln -sf `pwd`/bin/* "$NODE_BIN/"
|
||||||
else
|
else
|
||||||
ln -sf `pwd`/* "$NODE_PATH/"
|
echo "Can't find lib dir at `pwd`/lib"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
"use" )
|
"use" )
|
||||||
|
@ -108,9 +120,10 @@ nvm()
|
||||||
PATH="$NVM_DIR/$2/bin:$PATH"
|
PATH="$NVM_DIR/$2/bin:$PATH"
|
||||||
fi
|
fi
|
||||||
export PATH
|
export PATH
|
||||||
mkdir -p "$NVM_DIR/libs/$2"
|
export NODE_PATH="$NVM_DIR/$2/modules"
|
||||||
export NODE_PATH="$NVM_DIR/libs/$2"
|
|
||||||
export NODE_BIN="$NVM_DIR/$2/bin"
|
export NODE_BIN="$NVM_DIR/$2/bin"
|
||||||
|
mkdir -p "$NODE_PATH"
|
||||||
|
mkdir -p "$NODE_BIN"
|
||||||
echo "Now using node $2"
|
echo "Now using node $2"
|
||||||
;;
|
;;
|
||||||
"list" )
|
"list" )
|
||||||
|
|
Loading…
Reference in New Issue