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

Switch to npm ci #513

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions run-build-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -145,21 +145,27 @@ run_npm() {
fi
fi
fi

restore_home_cache ".npm" "npm cache"

if install_deps package.json $NODE_VERSION $NETLIFY_CACHE_DIR/package-sha
echo "Installing NPM modules using NPM version $(npm --version)"
run_npm_set_temp
if [ -f package-lock.json ]
then
echo "Installing NPM modules using NPM version $(npm --version)"
run_npm_set_temp
if npm install ${NPM_FLAGS:+"$NPM_FLAGS"}
if ! npm ci
then
echo "Error during NPM ci"
exit 1
fi
else
if ! npm install ${NPM_FLAGS:+"$NPM_FLAGS"}
then
echo "NPM modules installed"
else
echo "Error during NPM install"
exit 1
fi

echo "$(shasum package.json)-$NODE_VERSION" > $NETLIFY_CACHE_DIR/package-sha
fi
echo "NPM modules installed"

export PATH=$(npm bin):$PATH
}

Expand Down Expand Up @@ -677,6 +683,7 @@ cache_artifacts() {
cache_cwd_directory ".netlify/plugins" "build plugins"
cache_cwd_directory "target" "rust compile output"

cache_home_directory ".npm" "npm cache"
cache_home_directory ".yarn_cache" "yarn cache"
cache_home_directory ".cache/pip" "pip cache"
cache_home_directory ".cask" "emacs cask dependencies"
Expand Down