-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(scripts): builddown should use foreach to support resuming buil…
…ds (#8784) buildup and builddown currently use two entirely different approaches. This fix makes the builddown mirror the current buildup script, and alters foreach to support a --down flag in addition to --up. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
2 changed files
with
39 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,27 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
scriptdir=$(cd $(dirname $0) && pwd) | ||
|
||
echo "************************************************************" | ||
echo " builddown usage:" | ||
echo " - execute 'builddown --resume' to resume after failure" | ||
echo " - execute 'builddown' to restart the build from the start" | ||
echo "" | ||
echo " for advanced usage, see ${scriptdir}/foreach.sh" | ||
echo "************************************************************" | ||
|
||
if ! [ -x "$(command -v yarn)" ]; then | ||
echo "yarn is not installed. Follow the guide to install yarn - https://yarnpkg.com/en/docs/install." | ||
exit 1 | ||
if [ "$#" -eq 0 ]; then | ||
${scriptdir}/foreach.sh --reset | ||
else | ||
if [ "$1" != "--resume" ]; then | ||
echo "Unknown option: $1" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
export NODE_OPTIONS="--max-old-space-size=4096 ${NODE_OPTIONS:-}" | ||
${scriptdir}/foreach.sh --down yarn build | ||
${scriptdir}/foreach.sh --reset | ||
|
||
scriptdir=$(cd $(dirname $0) && pwd) | ||
export PATH=$(cd $scriptdir && npm bin):$PATH | ||
scope=$(${scriptdir}/current-scope) | ||
exec lerna run ${1:-build} --scope ${scope} --include-dependents | ||
echo "************************************************************" | ||
echo "builddown done" | ||
echo "************************************************************" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters