Skip to content

Commit

Permalink
[caching] nvm install: Do not remove src dir after compilation succ…
Browse files Browse the repository at this point in the history
…eeds

This will help speed up the installation time for the non-first time
installation, especially can speed up the build time and test time on
Travis-CI as we'll cache .cache dir.
  • Loading branch information
PeterDaveHello authored and ljharb committed Nov 13, 2016
1 parent fd33179 commit 0360829
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions nvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1871,20 +1871,19 @@ nvm_install_source() {
local TMPDIR
local VERSION_PATH

# shellcheck disable=SC2086
TARBALL="$(nvm_download_artifact "${FLAVOR}" source "${TYPE}" "${VERSION}" | command tail -1)" && \
[ -f "${TARBALL}" ] && \
TMPDIR="$(dirname "${TARBALL}")/files" && \
if (
TARBALL="$(nvm_download_artifact "${FLAVOR}" source "${TYPE}" "${VERSION}" | command tail -1)" && \
[ -f "${TARBALL}" ] && \
TMPDIR="$(dirname "${TARBALL}")/files" && \
# shellcheck disable=SC2086
command mkdir -p "${TMPDIR}" && \
command "${tar}" -x${tar_compression_flag}f "${TARBALL}" -C "${TMPDIR}" --strip-components 1 && \
VERSION_PATH="$(nvm_version_path "${PREFIXED_VERSION}")" && \
nvm_cd "${TMPDIR}" && \
./configure --prefix="${VERSION_PATH}" $ADDITIONAL_PARAMETERS && \
$make -j "${NVM_MAKE_JOBS}" ${MAKE_CXX-} && \
command rm -f "${VERSION_PATH}" 2>/dev/null && \
$make -j "${NVM_MAKE_JOBS}" ${MAKE_CXX-} install && \
command rm -rf "${TMPDIR}"
$make -j "${NVM_MAKE_JOBS}" ${MAKE_CXX-} install
); then
if ! nvm_has "npm" ; then
nvm_echo 'Installing npm...'
Expand All @@ -1904,6 +1903,7 @@ nvm_install_source() {
fi

nvm_err "nvm: install ${VERSION} failed!"
command rm -rf "${TMPDIR-}"
return 1
}

Expand Down

0 comments on commit 0360829

Please sign in to comment.