2270ff425a
* Add dev tools for live-reloading the web stack while running Anki * Handle CDP connection errors more graciously * Include sass in web stack watchers * Refactor monitored folder and event definition * Switch to more specific build target Thanks to @hikaru-y * Add PyChromeDevTools to dev requirements * Update rebuild-web for ninja * Satisfy mypy * Remove ts-watch Superseded by web-watch (the version here was also still based around bazel) * Simplify calls to other build tools Given that `./ninja qt/aqt` has to be run from the project root anyways, it doesn't make sense to use calls relative to `rebuild-web` in an ill-guided effort to lower dependencies on hard-coded paths. * Remove remaining script-relative tool path
24 lines
782 B
Bash
Executable File
24 lines
782 B
Bash
Executable File
#!/bin/bash
|
|
# Copyright: Ankitects Pty Ltd and contributors
|
|
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
# Monitor all web-related folders and rebuild and reload Anki's web stack
|
|
# when a change is detected.
|
|
|
|
set -e
|
|
|
|
MONITORED_FOLDERS=("ts/" "sass/" "qt/aqt/data/web/")
|
|
MONITORED_EVENTS=("Created" "Updated" "Removed")
|
|
|
|
on_change_detected="printf \\033c\\n; \"./tools/rebuild-web\""
|
|
|
|
event_args=""
|
|
for event in "${MONITORED_EVENTS[@]}"; do
|
|
event_args+="--event ${event} "
|
|
done
|
|
|
|
# poll_monitor comes with a slight performance penalty, but seems to more
|
|
# reliably identify file system events across both macOS and Linux
|
|
fswatch -r -o -m poll_monitor ${event_args[@]} \
|
|
"${MONITORED_FOLDERS[@]}" | xargs -n1 -I{} sh -c "$on_change_detected"
|