-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwatch
executable file
·30 lines (24 loc) · 860 Bytes
/
watch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
# ------- CONFIGURATION ----------------
export GITHUB_WEBHOOK_URL="https://smee.io/Y5RCGl8sZxD9QBOY"
export GITHUB_WEBHOOK_SECRET="ff-my-github-webhook-secret"
# ------- END CONFIGURATION ------------
echo "Flutter hotreload watch for a DART files changes..."
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
trap ctrl_c INT
function ctrl_c() {
# echo "** Trapped CTRL-C"
kill -9 $child_1_pid
kill -9 "$$"
}
# REQUIREMENTS
# 1. Run `npm install -- prefix ./tools/github`
# 2. Setup GITHUB_WEBHOOK_URL and GITHUB_WEBHOOK_SECRET in this script and in the GitHub Webhook settings
$SCRIPT_DIR/./tools/github/listen &
child_1_pid=$!
while true
do
# 3. install `entr` with `brew install entr`
find "$SCRIPT_DIR/./lib/" -name '*.dart' | entr -dnp "$SCRIPT_DIR/./tools/hotreloader.sh" /_
sleep 1
done