Skip to content
Myr

Merge pull request #690 from hax/patch-1

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

Only filter the package `npm`, not any package name that contains 'npm'

authored by Jordan Harband · committed by Jordan Harband · parents 2b63f37, 14b23bf · Browse files · 2 files+9 added−6 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+9 added−6 removed

  • tests:+7 added−4 removed
  • other:+2 added−2 removed

2 files+9 added−6 removed

modified:test/slow/nvm reinstall-packages/should work as expected+7 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 recursive-blame uglify-js yo"9EXPECTED_PACKAGES="autoprefixer bower david eslint grunt-cli grunth-cli http-server jshint marked node-gyp npmlist recursive-blame uglify-js yo"1011echo "$EXPECTED_PACKAGES" | xargs npm install -g --quiet1213get_packages() {14 npm list -g --depth=0 | \sed -e '1 d' -e 's/^.* \(.*\)@.*/\1/' -e '/^npm$/ d' | xargs15}1617nvm use 0.10.2914ORIGINAL_PACKAGES=$(npm list -g --depth=0 | tail -n +2 | \grep -o -e ' [^@]*' | cut -c 2- | \grep -v npm | sort | uniq | xargs)18ORIGINAL_PACKAGES=$(get_packages)1920nvm reinstall-packages 0.10.2817FINAL_PACKAGES=$(npm list -g --depth=0 | tail -n +2 | \grep -o -e ' [^@]*' | cut -c 2- | \grep -v npm | sort | uniq | xargs)21FINAL_PACKAGES=$(get_packages)2223[ "$FINAL_PACKAGES" = "$EXPECTED_PACKAGES" ] || die "final packages ($FINAL_PACKAGES) did not match expected packages ($EXPECTED_PACKAGES)"24[ "$ORIGINAL_PACKAGES" != "$FINAL_PACKAGES" ] || die "original packages matched final packages ($ORIGINAL_PACKAGES)"21
modified:nvm.sh+2 added-2 removed
1656 unmodified lines
1657 if ! nvm_has_system_node && ! nvm_has_system_iojs; then1658 echo 'No system version of node or io.js detected.' >&21659 return 31660 fi1661 INSTALLS=$(nvm deactivate > /dev/null && npm list -g --depth=0 | command tail -n +2 | command grep -o -e ' [^@]*' | command cut -c 2- | command grep -v npm | command xargs)1661 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)1662 else1663 local VERSION1664 VERSION="$(nvm_version "$PROVIDED_VERSION")"1665 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 -v npm | command xargs)1665 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)1666 fi16671668 echo "Copying global packages from $VERSION..."1669 echo "$INSTALLS" | command xargs npm install -g --quiet
46 unmodified lines