* Add 'make watch' This combines frontend and backend watch into a single command that runs them in parallel on on SIGINT terminates both. Termination is not super-clean but I guess it does not have to. * move to tools/, trap more signals, remove gnu-specific flag * simplify Co-authored-by: techknowlogick <techknowlogick@gitea.io>tags/v1.13.0-rc1
@echo " - build build everything" | @echo " - build build everything" | ||||
@echo " - frontend build frontend files" | @echo " - frontend build frontend files" | ||||
@echo " - backend build backend files" | @echo " - backend build backend files" | ||||
@echo " - watch watch everything and continuously rebuild" | |||||
@echo " - watch-frontend watch frontend files and continuously rebuild" | @echo " - watch-frontend watch frontend files and continuously rebuild" | ||||
@echo " - watch-backend watch backend files and continuously rebuild" | @echo " - watch-backend watch backend files and continuously rebuild" | ||||
@echo " - clean delete backend and integration files" | @echo " - clean delete backend and integration files" | ||||
.PHONY: lint-backend | .PHONY: lint-backend | ||||
lint-backend: golangci-lint revive vet | lint-backend: golangci-lint revive vet | ||||
.PHONY: watch | |||||
watch: | |||||
bash tools/watch.sh | |||||
.PHONY: watch-frontend | .PHONY: watch-frontend | ||||
watch-frontend: node-check $(FOMANTIC_DEST) node_modules | watch-frontend: node-check $(FOMANTIC_DEST) node_modules | ||||
rm -rf $(WEBPACK_DEST_ENTRIES) | rm -rf $(WEBPACK_DEST_ENTRIES) |
## Building continuously | ## Building continuously | ||||
Both the `frontend` and `backend` targets can be ran continuously when source files change: | |||||
To run and continously rebuild when source files change: | |||||
````bash | ````bash | ||||
# in your first terminal | |||||
make watch-backend | |||||
# in your second terminal | |||||
make watch-frontend | |||||
make watch | |||||
```` | ```` | ||||
On macOS, watching all backend source files may hit the default open files limit which can be increased via `ulimit -n 12288` for the current shell or in your shell startup file for all future shells. | On macOS, watching all backend source files may hit the default open files limit which can be increased via `ulimit -n 12288` for the current shell or in your shell startup file for all future shells. |
#!/bin/bash | |||||
set -euo pipefail | |||||
make watch-frontend & | |||||
make watch-backend & | |||||
trap 'kill $(jobs -p)' EXIT | |||||
wait |