noredink-ui/script/develop.sh

36 lines
953 B
Bash
Raw Normal View History

2019-04-02 23:26:32 +03:00
#!/usr/bin/env bash
set -euo pipefail
2019-04-03 13:48:26 +03:00
if test -d public; then
rm -rf public
fi
2020-10-30 18:34:11 +03:00
SHAKE_TARGET="${1:-public}"
shake --compact "$SHAKE_TARGET"
2019-05-09 19:03:30 +03:00
cat <<EOF
== 👋 Hello! ==================================================================
2019-04-02 23:26:32 +03:00
I'm watching files in styleguide-app and src for changes. If you make any
changes, I'll try to be smart about what should change (things end up in the
"public" directory if you want to check my work.) If you remove a file and it's
still showing up, delete the "public" directory and restart me.
2020-11-06 15:22:39 +03:00
To quit, hit ctrl-c.
2019-04-02 23:26:32 +03:00
== thaaat's it from me! =======================================================
EOF
2019-04-02 23:53:48 +03:00
# start a web server in the background and tear it down when exiting
2019-04-02 23:44:28 +03:00
./script/serve.sh public &
SERVER_PID=$!
cleanup() {
kill "$SERVER_PID"
}
trap cleanup EXIT INT
2019-04-02 23:44:28 +03:00
# start a watcher. This loops forever, so we don't need to loop ourselves.
watchexec --clear --postpone -- shake --compact "$SHAKE_TARGET"