blob: c40bdebd8d44736473ed9462d5df074384a539d2 [file] [log] [blame]
set -e
set -x
if [[ $# -ne 1 ]]; then
echo "Usage: $0 <path to custom element's directory>"
echo "Example: $0 golden/modules/dots-sk"
echo "This script uses the \"entr\" command to launch a demo page server via"
echo "\"bazel run\". When the files in the custom element's directory change, entr will"
echo "reexecute the Bazel command to rebuild and serve the element's demo page with"
echo "the latest changes. Users must manually refresh the browser to see the changes."
echo "Note: This script MUST be executed from the repository's root directory."
exit 1
# Remove any trailing slashes that might arise from using Bash's autocompletion
# via the tab key.
DIR=$(echo $1 | sed 's:/*$::')
git ls-files | entr -r bazelisk run --config=mayberemote //$DIR:demo_page_server
# For some reason entr leaves the terminal in a corrupted state after being killed with Ctrl+C. The
# following commands restore the terminal to a workable state.