Skip to content

Commit cf3192e

Browse files
committed
feat: Enhance run and dev targets to manage PowerUserMail instances and improve file watching
1 parent bdfef6b commit cf3192e

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

Makefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ ui-test:
8080
run:
8181
@APP_PATH="$(BUILD_DIR)/Build/Products/$(CONFIGURATION)/PowerUserMail.app"; \
8282
if [ -d "$$APP_PATH" ]; then \
83+
echo "[Run] Stopping any running PowerUserMail instances..."; \
84+
pkill -x PowerUserMail 2>/dev/null || true; \
85+
sleep 0.5; \
8386
echo "[Run] Opening $$APP_PATH"; \
8487
open "$$APP_PATH"; \
8588
else \
@@ -142,9 +145,15 @@ dev:
142145
@echo "[Dev] Watching PowerUserMail/ for changes..."
143146
@echo "Tip: Press Ctrl+C to stop."
144147
@if command -v entr >/dev/null 2>&1; then \
145-
find PowerUserMail -type f \( -name "*.swift" -o -name "*.entitlements" -o -name "*.plist" \) | entr -r make build; \
148+
while true; do \
149+
find PowerUserMail -type f \( -name "*.swift" -o -name "*.entitlements" -o -name "*.plist" \) 2>/dev/null | \
150+
entr -d sh -c 'if make build; then make run; fi'; \
151+
done; \
146152
elif command -v fswatch >/dev/null 2>&1; then \
147-
fswatch -r PowerUserMail --event Created --event Updated --event Removed | xargs -n 1 -I {} make build; \
153+
fswatch -r PowerUserMail --event Created --event Updated --event Removed | \
154+
while read -r event; do \
155+
if make build; then make run; fi; \
156+
done; \
148157
else \
149158
echo "[Dev] ERROR: 'entr' or 'fswatch' not found."; \
150159
echo "Install via:"; \

0 commit comments

Comments
 (0)