blob: 4e65b0dc2f664789906c204dad78847a32ee7bc0 [file] [log] [blame]
#!/bin/bash
set -e
set -x
if [[ $# -ne 1 ]]; then
echo "Usage: $0 <path to custom element's directory>"
echo
echo "Example: $0 golden/modules/dots-sk"
echo
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
echo "Note: This script MUST be executed from the repository's root directory."
exit 1
fi
# Remove any trailing slashes that might arise from using Bash's autocompletion
# via the tab key.
DIR=$(echo $1 | sed 's:/*$::')
ls $DIR/* | 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.
reset
clear