Skip to content
Myr

Merge pull request #508 from creationix/nvm_copy_packages_not_npm

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Don't copy `npm` with `nvm copy-packages`

authored by Jordan Harband · committed by Jordan Harband · parents d24dc66, 214ce88 · Browse files · 2 files+7 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+7 added−9 removed

  • tests:+4 added−4 removed
  • other:+3 added−5 removed

2 files+7 added−9 removed

modified:test/slow/nvm copy-packages/should work as expected+4 added-4 removed
4 unmodified lines
5. ../../../nvm.sh67nvm use 0.10.2889EXPECTED_PACKAGES="autoprefixer bower david eslint grunt-cli grunth-cli http-server jshint marked node-gyp npm recursive-blame uglify-js yo"9EXPECTED_PACKAGES="autoprefixer bower david eslint grunt-cli grunth-cli http-server jshint marked node-gyp recursive-blame uglify-js yo"1011npm install -g --quiet $EXPECTED_PACKAGES11echo "$EXPECTED_PACKAGES" | xargs npm install -g --quiet1213nvm use 0.10.2914ORIGINAL_PACKAGES=$(npm list --global --parseable --depth=0 2> /dev/null | tail -n +2 | grep -o -e '/[^/]*$' | cut -c 2- | sort | uniq | xargs)14ORIGINAL_PACKAGES=$(npm list -g --depth=0 | tail -n +2 | \grep -o -e ' [^@]*' | cut -c 2- | \grep -v npm | sort | uniq | xargs)1516nvm copy-packages 0.10.2817FINAL_PACKAGES=$(npm list --global --parseable --depth=0 2> /dev/null | tail -n +2 | grep -o -e '/[^/]*$' | cut -c 2- | sort | uniq | xargs)17FINAL_PACKAGES=$(npm list -g --depth=0 | tail -n +2 | \grep -o -e ' [^@]*' | cut -c 2- | \grep -v npm | sort | uniq | xargs)1819[ "$FINAL_PACKAGES" = "$EXPECTED_PACKAGES" ] || die "final packages ($FINAL_PACKAGES) did not match expected packages ($EXPECTED_PACKAGES)"20[ "$ORIGINAL_PACKAGES" != "$FINAL_PACKAGES" ] || die "original packages matched final packages ($ORIGINAL_PACKAGES)"21
modified:nvm.sh+3 added-5 removed
783 unmodified lines
784 if [ $# -ne 2 ]; then785 nvm help786 return 127787 fi788 VERSION=$(nvm_version "$2")789 local ROOT790 ROOT=$(nvm use $VERSION && npm -g root)788 VERSION="$(nvm_version "$2")"789790 # declare local INSTALLS first, otherwise it doesn't work in zsh791 local INSTALLS794 INSTALLS=$(nvm use $VERSION > /dev/null && npm list --global --parseable --depth=0 2> /dev/null | tail -n +2 | \grep -o -e '/[^/]*$' | cut -c 2- | xargs)792 INSTALLS=$(nvm use "$VERSION" > /dev/null && npm list -g --depth=0 | tail -n +2 | \grep -o -e ' [^@]*' | cut -c 2- | \grep -v npm | xargs)793796 npm install -g --quiet $INSTALLS794 echo "$INSTALLS" | xargs npm install -g --quiet795 ;;796 "clear-cache" )797 rm -f $NVM_DIR/v* "$(nvm_version_dir)" 2>/dev/null798 echo "Cache cleared."
19 unmodified lines