Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Commit

Permalink
Merge pull request #114 from netlify/handle-npm-lock
Browse files Browse the repository at this point in the history
Install npm modules if any of the npm lock files change
  • Loading branch information
brycekahle committed Dec 12, 2017
2 parents 10a2dc3 + 37bd36b commit bf9a879
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion run-build-functions.sh
Expand Up @@ -106,7 +106,9 @@ run_npm() {
fi
fi

if install_deps package.json $NODE_VERSION $NETLIFY_CACHE_DIR/package-sha
if install_deps package.json $NODE_VERSION $NETLIFY_CACHE_DIR/package-sha || \
install_deps package-lock.json $NODE_VERSION $NETLIFY_CACHE_DIR/package-lock-sha || \
install_deps npm-shrinkwrap.json $NODE_VERSION $NETLIFY_CACHE_DIR/package-shrinkwrap-sha
then
echo "Installing NPM modules using NPM version $(npm --version)"
run_npm_set_temp
Expand All @@ -118,6 +120,14 @@ run_npm() {
fi

echo "$(shasum package.json)-$NODE_VERSION" > $NETLIFY_CACHE_DIR/package-sha
if [ -f package-lock.json ]
then
echo "$(shasum package-lock.json)-$NODE_VERSION" > $NETLIFY_CACHE_DIR/package-lock-sha
fi
if [ -f npm-shrinkwrap.json ]
then
echo "$(shasum npm-shrinkwrap.json)-$NODE_VERSION" > $NETLIFY_CACHE_DIR/package-shrinkwrap-sha
fi
fi
export PATH=$(npm bin):$PATH
}
Expand Down

0 comments on commit bf9a879

Please sign in to comment.