Skip to content
Myr

[New] adding default and alias option to `nvm install`

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

For: `nvm install 8.12.0` after install: --alias=8 is equivalent to `nvm alias 8 8.12.0` --default is equivalent to `nvm alias default 8.12.0`

authored by Kayla Altepeter · committed by Jordan Harband · parent 18c6f98 · Browse files · 3 files+50 added−0 removed
This commit

State

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

Trailers

  • Co-authored-by: Kayla Altepeter <kayla@kaylaaltepeter.com>
  • Co-authored-by: Dena Burd <me@Denas-MacBook-Air.local>
  • Co-authored-by: Jordan Harband <ljharb@gmail.com>

Diff stats

3 files+50 added−0 removed

  • tests:+22 added−0 removed
  • other:+28 added−0 removed

3 files+50 added−0 removed

added:test/installation_node/install with --alias+11 added
1#!/bin/sh23set -ex45die () { echo "$@" ; exit 1; }67\. ../../nvm.sh89nvm install --alias=9 9.11.2 || die '`nvm install --alias=9 9.11.2` failed'1011TERM=dumb nvm alias | grep '9 -> 9.11.2 (-> v9.11.2 \*)' || die 'did not make the expected alias'
added:test/installation_node/install with --default+11 added
1#!/bin/sh23set -ex45die () { echo "$@" ; exit 1; }67\. ../../nvm.sh89nvm install --default node || die '`nvm install --default` failed'1011TERM=dumb nvm alias | grep "default -> node (-> $(nvm version node) \*)" || die 'did not make the expected alias'
modified:nvm.sh+28 added
1769 unmodified lines
1770 command mkdir -p "${VERSION_PATH}" && \1771 command mv "${TMPDIR}/"* "${VERSION_PATH}" && \1772 command rm -rf "${TMPDIR}"1773 ); then17741775 if [ -n "${ALIAS-}" ]; then1776 nvm alias "${ALIAS}" "${provided_version}"1777 fi1778 return 01779 fi17801781 nvm_err 'Binary download failed, trying source.'
591 unmodified lines
2373 nvm_echo ' --lts=<LTS name> When installing, only select from versions for a specific LTS line'2374 nvm_echo ' --skip-default-packages When installing, skip the default-packages file if it exists'2375 nvm_echo ' --latest-npm After installing, attempt to upgrade to the latest working npm on the given node version'2376 nvm_echo ' --no-progress Disable the progress bar on any downloads'2377 nvm_echo ' --alias=<name> After installing, set the alias specified to the version specified. (same as: nvm alias <name> <version>)'2378 nvm_echo ' --default After installing, set default alias to the version specified. (same as: nvm alias default <version>)'2379 nvm_echo ' nvm uninstall <version> Uninstall a version'2380 nvm_echo ' nvm uninstall --lts Uninstall using automatic LTS (long-term support) alias `lts/*`, if available.'2381 nvm_echo ' nvm uninstall --lts=<LTS name> Uninstall using automatic alias for provided LTS line, if available.'2382 nvm_echo ' nvm use [--silent] [<version>] Modify PATH to use <version>. Uses .nvmrc if available'
168 unmodified lines
2551 local noprogress2552 nobinary=02553 noprogress=02554 local LTS2555 local ALIAS2556 local NVM_UPGRADE_NPM2557 NVM_UPGRADE_NPM=025582559 local PROVIDED_REINSTALL_PACKAGES_FROM
31 unmodified lines
2591 --latest-npm)2592 NVM_UPGRADE_NPM=12593 shift2594 ;;2595 --default)2596 if [ -n "${ALIAS-}" ]; then2597 nvm_err '--default and --alias are mutually exclusive, and may not be provided more than once'2598 return 62599 fi2600 ALIAS='default'2601 shift2602 ;;2603 --alias=*)2604 if [ -n "${ALIAS-}" ]; then2605 nvm_err '--default and --alias are mutually exclusive, and may not be provided more than once'2606 return 62607 fi2608 ALIAS="${1##--alias=}"2609 shift2610 ;;2611 --reinstall-packages-from=*)2612 if [ -n "${PROVIDED_REINSTALL_PACKAGES_FROM-}" ]; then2613 nvm_err '--reinstall-packages-from may not be provided more than once'2614 return 6
173 unmodified lines
2788 nvm_ensure_default_set "lts/${LTS}"2789 else2790 nvm_ensure_default_set "${provided_version}"2791 fi27922793 if [ -n "${ALIAS}" ]; then2794 nvm alias "${ALIAS}" "${provided_version}"2795 fi27962797 return $?2798 fi27992800 local EXIT_CODE
995 unmodified lines