Run npm install only when needed

This commit is contained in:
Bruno Barbieri 2018-07-06 15:26:06 -04:00 committed by GitHub
parent d9c78fc645
commit af04ca59e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -108,7 +108,10 @@ jobs:
- run:
name: Install deps via npm
command: |
sudo npm install -g npm@6
# Only run npm install if the package-lock.json or package.json was changed
CHANGED_FILES="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
echo "$CHANGED_FILES" | grep --quiet "package.*json" &&
sudo npm install -g npm@6 &&
npm install
- save_cache:
key: dependency-cache-{{ checksum "package-lock.json" }}