commit
65a986c633
18
nvm.sh
18
nvm.sh
|
@ -1652,21 +1652,32 @@ $NVM_LS_REMOTE_IOJS_OUTPUT" | command grep -v "N/A" | sed '/^$/d')"
|
||||||
return 2
|
return 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local INSTALLS
|
local NPMLIST
|
||||||
if [ "_$PROVIDED_VERSION" = "_system" ]; then
|
if [ "_$PROVIDED_VERSION" = "_system" ]; then
|
||||||
if ! nvm_has_system_node && ! nvm_has_system_iojs; then
|
if ! nvm_has_system_node && ! nvm_has_system_iojs; then
|
||||||
echo 'No system version of node or io.js detected.' >&2
|
echo 'No system version of node or io.js detected.' >&2
|
||||||
return 3
|
return 3
|
||||||
fi
|
fi
|
||||||
INSTALLS=$(nvm deactivate > /dev/null && npm list -g --depth=0 | command tail -n +2 | command grep -o -e ' [^@]*' | command cut -c 2- | command grep -vx npm | command xargs)
|
NPMLIST=$(nvm deactivate > /dev/null && npm list -g --depth=0 | command tail -n +2)
|
||||||
else
|
else
|
||||||
local VERSION
|
local VERSION
|
||||||
VERSION="$(nvm_version "$PROVIDED_VERSION")"
|
VERSION="$(nvm_version "$PROVIDED_VERSION")"
|
||||||
INSTALLS=$(nvm use "$VERSION" > /dev/null && npm list -g --depth=0 | command tail -n +2 | command grep -o -e ' [^@]*' | command cut -c 2- | command grep -vx npm | command xargs)
|
NPMLIST=$(nvm use "$VERSION" > /dev/null && npm list -g --depth=0 | command tail -n +2)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
local INSTALLS
|
||||||
|
INSTALLS=$(echo "$NPMLIST" | command sed -e '/ -> / d' -e 's/^.* \(.*\)@.*/\1/' -e '/^npm$/ d' | command xargs)
|
||||||
|
|
||||||
echo "Copying global packages from $VERSION..."
|
echo "Copying global packages from $VERSION..."
|
||||||
echo "$INSTALLS" | command xargs npm install -g --quiet
|
echo "$INSTALLS" | command xargs npm install -g --quiet
|
||||||
|
|
||||||
|
local LINKS
|
||||||
|
LINKS=$(echo "$NPMLIST" | command sed -n 's/.* -> \(.*\)/\1/ p')
|
||||||
|
|
||||||
|
echo "Linking global packages from $VERSION..."
|
||||||
|
for LINK in $LINKS; do
|
||||||
|
(cd "$LINK" && npm link)
|
||||||
|
done
|
||||||
;;
|
;;
|
||||||
"clear-cache" )
|
"clear-cache" )
|
||||||
command rm -f $NVM_DIR/v* "$(nvm_version_dir)" 2>/dev/null
|
command rm -f $NVM_DIR/v* "$(nvm_version_dir)" 2>/dev/null
|
||||||
|
@ -1712,4 +1723,3 @@ elif nvm ls default >/dev/null; then
|
||||||
elif nvm_rc_version >/dev/null 2>&1; then
|
elif nvm_rc_version >/dev/null 2>&1; then
|
||||||
nvm use >/dev/null
|
nvm use >/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,9 @@ die () { echo "$@" ; exit 1; }
|
||||||
. ../../../nvm.sh
|
. ../../../nvm.sh
|
||||||
|
|
||||||
nvm use 0.10.28
|
nvm use 0.10.28
|
||||||
|
(cd test-npmlink && npm link)
|
||||||
|
|
||||||
EXPECTED_PACKAGES="autoprefixer bower david eslint grunt-cli grunth-cli http-server jshint marked node-gyp npmlist recursive-blame uglify-js yo"
|
EXPECTED_PACKAGES="autoprefixer bower david eslint grunt-cli grunth-cli http-server jshint marked node-gyp npmlist recursive-blame test-npmlink uglify-js yo"
|
||||||
|
|
||||||
echo "$EXPECTED_PACKAGES" | xargs npm install -g --quiet
|
echo "$EXPECTED_PACKAGES" | xargs npm install -g --quiet
|
||||||
|
|
||||||
|
@ -22,3 +23,5 @@ FINAL_PACKAGES=$(get_packages)
|
||||||
|
|
||||||
[ "$FINAL_PACKAGES" = "$EXPECTED_PACKAGES" ] || die "final packages ($FINAL_PACKAGES) did not match expected packages ($EXPECTED_PACKAGES)"
|
[ "$FINAL_PACKAGES" = "$EXPECTED_PACKAGES" ] || die "final packages ($FINAL_PACKAGES) did not match expected packages ($EXPECTED_PACKAGES)"
|
||||||
[ "$ORIGINAL_PACKAGES" != "$FINAL_PACKAGES" ] || die "original packages matched final packages ($ORIGINAL_PACKAGES)"
|
[ "$ORIGINAL_PACKAGES" != "$FINAL_PACKAGES" ] || die "original packages matched final packages ($ORIGINAL_PACKAGES)"
|
||||||
|
|
||||||
|
[ $(test-npmlink) = 'ok' ] || die "failed to run test-npmlink"
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
console.log('ok')
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"name": "test-npmlink",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"description": "Stub package for testing npm link",
|
||||||
|
"bin": {
|
||||||
|
"test-npmlink": "index.js"
|
||||||
|
},
|
||||||
|
"author": "hax",
|
||||||
|
"license": "ISC"
|
||||||
|
}
|
Loading…
Reference in New Issue