build: fix cronjob snapshot jobs failing (#13595)

* Due to the fact that we modify the `package.json` in cronjobs without updating the actual lock-file, the `--frozen-lockfile` installation fails. In order to fix this, we should just re-install the dependencies after the general `yarn` installation.
This commit is contained in:
Paul Gschwendtner
2018-10-15 18:33:27 +02:00
committed by Andrew Seguin
parent 8c3457b50a
commit 1ccd1eed92
2 changed files with 6 additions and 15 deletions
+5 -14
View File
@@ -1,21 +1,12 @@
#!/bin/bash
# Script that modifies the project `package.json` by setting the version for all Angular
# dependencies to the Github snapshot builds. Afterwards, if the `--only-save` flag is not set,
# the script will also run NPM to install the new versions.
# Script that re-installs all Angular dependencies using the GitHub build snapshots. We need to
# this after the locked node modules have been installed because otherwise `--frozen-lockfile`
# would complain about outdated lock files.
set -e
# Go to the project root directory
cd $(dirname $0)/../
searchRegex='(@angular\/(.*))":\s+".*"'
searchReplace='\1": "github:angular\/\2-builds"'
# Replace the Angular versions in `package.json` with their corresponding
# build snapshots so that we only have to run `npm install` once.
sed -i -r "s/${searchRegex}/${searchReplace}/g" package.json
if [[ ${*} != *--only-save* ]]; then
npm install
fi
yarn add \
$(awk 'match($0, "@angular/(.*)\":", m){print "github:angular/"m[1]"-builds"}' package.json)