Add mechanism for bundling UI assets. (#153)

* Add mechanism for bundling UI assets.

The scripts/uigen.sh script will check out the UI repo, build assets,
create a static assets file, and clean up.

The dev Makefile target has been modified to run this script if no
assets file is found. There is also a build-ui target that will
unilaterally update (the dev target only builds if the file isn't found,
but doesn't update).

The handler has been updated to add the default org ID as a header if
the request path is "/".

Co-authored-by: Randall Morey <randall@randallmorey.com>
This commit is contained in:
Jeff MitchellandRandall Morey authored and GitHub committed 2020-06-30 11:26:22 -04:00
1 parent 8d8bb42418
commit 8da4effd5e
10 files changed
+147 -65

No files matched your search

+15 -3
View File
@@ -15,16 +15,28 @@ export GEN_BASEPATH := $(shell pwd)
api:
$(MAKE) --environment-overrides -C api/internal/genapi api
bootstrap:
tools:
go generate -tags tools tools/tools.go
cleangen:
@rm -f ${GENERATED_CODE}
dev: BUILD_TAGS+=dev
dev:
dev: build-ui-ifne
@echo "==> Building Watchtower with dev features enabled"
@CGO_ENABLED=$(CGO_ENABLED) BUILD_TAGS='$(BUILD_TAGS)' WATCHTOWER_DEV_BUILD=1 sh -c "'$(CURDIR)/scripts/build.sh'"
build-ui:
@scripts/uigen.sh
build-ui-ifne:
ifeq (,$(wildcard internal/ui/assets.go))
@echo "==> No UI assets found, building..."
@scripts/uigen.sh
else
@echo "==> UI assets found, use build-ui target to update"
endif
gen: cleangen proto api migrations
migrations:
@@ -66,6 +78,6 @@ protobuild:
protolint:
@buf check lint
.PHONY: api bootstrap gen migrations proto
.PHONY: api tools gen migrations proto
.NOTPARALLEL: