Skip to content
Myr

[Fix] `reinstall-packages`: do not reinstall corepack

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

Fixes #3544

authored by Jordan Harband · committed by Jordan Harband · parent 8dbc22f · Browse files · 3 files+14 added−5 removed
This commit

State

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

Diff stats

3 files+14 added−5 removed

  • tests:+13 added−4 removed
  • other:+1 added−1 removed

3 files+14 added−5 removed

modified:test/slow/nvm reinstall-packages/should work as expected+1 added-1 removed
14 unmodified lines
1516echo "$EXPECTED_PACKAGES_INSTALL" | sed -e 's/test-npmlink //' | xargs npm install -g --quiet1718get_packages() {19 npm list -g --depth=0 | \sed -e '1 d' -e 's/^.* \(.*\)@.*/\1/' -e '/^npm$/ d' | xargs19 npm list -g --depth=0 | \sed -e '1 d' -e 's/^.* \(.*\)@.*/\1/' -e '/^npm$/ d' -e '/^corepack$/ d' | xargs20}2122nvm use 0.10.2923ORIGINAL_PACKAGES=$(get_packages)
8 unmodified lines
modified:test/slow/nvm reinstall-packages/works with no installs+12 added-3 removed
3 unmodified lines
45\. ../../../nvm.sh67get_packages() {8 npm list -g --depth=0 | \sed -e '1 d' -e 's/^.* \(.*\)@.*/\1/' -e '/^npm$/ d' | xargs8 npm list -g --depth=0 | \sed -e '1 d' -e 's/^.* \(.*\)@.*/\1/' -e '/^npm$/ d' -e '/^corepack$/ d' | xargs9}1011nvm use 4.7.212ORIGINAL_PACKAGES=$(get_packages)1314nvm reinstall-packages 4.7.115FINAL_PACKAGES=$(get_packages)1617[ -z "${ORIGINAL_PACKAGES}" ] || die "original packages were not empty: ${ORIGINAL_PACKAGES}"18[ -z "${FINAL_PACKAGES}" ] || die "final packages were not empty: ${FINAL_PACKAGES}"17[ -z "${ORIGINAL_PACKAGES}" ] || die "v4: original packages were not empty: ${ORIGINAL_PACKAGES}"18[ -z "${FINAL_PACKAGES}" ] || die "v4: final packages were not empty: ${FINAL_PACKAGES}"1920nvm use 23.8.2021ORIGINAL_PACKAGES=$(get_packages)2223nvm reinstall-packages 23.8.024FINAL_PACKAGES=$(get_packages)2526[ -z "${ORIGINAL_PACKAGES}" ] || die "v23: original packages were not empty: ${ORIGINAL_PACKAGES}"27[ -z "${FINAL_PACKAGES}" ] || die "v23: final packages were not empty: ${FINAL_PACKAGES}"
modified:nvm.sh+1 added-1 removed
2738 unmodified lines
2739 VERSION="$1"2740 NPMLIST=$(nvm use "${VERSION}" >/dev/null && npm list -g --depth=0 2>/dev/null | command sed -e '1d' -e '/UNMET PEER DEPENDENCY/d')27412742 local INSTALLS2743 INSTALLS=$(nvm_echo "${NPMLIST}" | command sed -e '/ -> / d' -e '/\(empty\)/ d' -e 's/^.* \(.*@[^ ]*\).*/\1/' -e '/^npm@[^ ]*.*$/ d' | command xargs)2743 INSTALLS=$(nvm_echo "${NPMLIST}" | command sed -e '/ -> / d' -e '/\(empty\)/ d' -e 's/^.* \(.*@[^ ]*\).*/\1/' -e '/^npm@[^ ]*.*$/ d' -e '/^corepack@[^ ]*.*$/ d' | command xargs)27442745 local LINKS2746 LINKS="$(nvm_echo "${NPMLIST}" | command sed -n 's/.* -> \(.*\)/\1/ p')"2747
1914 unmodified lines