blob: 305f2804087d36f22b0baa1171d92d2aa1ce83bf [file]
#!/usr/bin/env bash
set -eu -o pipefail
# -e: exits if a command fails
# -u: errors if an variable is referenced before being set
# -o pipefail: causes a pipeline to produce a failure return code if any command errors
readonly EXAMPLES=${@:?"No example names specified"}
readonly RULES_NODEJS_DIR=$(cd $(dirname "$0")/..; pwd)
readonly EXAMPLES_DIR="${RULES_NODEJS_DIR}/examples"
echo_and_run() { echo "+ $@" ; "$@" ; }
for example in ${EXAMPLES[@]} ; do
(
# Clean example
cd "${EXAMPLES_DIR}/${example}"
printf "\n\nCleaning example ${example}\n"
${RULES_NODEJS_DIR}/scripts/unlink_deps.sh
echo_and_run bazel clean --expunge
echo_and_run rm -rf node_modules
)
done