forked from src-d/lookout
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.web
74 lines (56 loc) · 1.53 KB
/
Makefile.web
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Redefine targets from main Makefile
-include Makefile
# Makefile.main::test -> this::test
test: web-test
# this::build -> Makefile.main::build -> Makefile.main::$(COMMANDS)
# The @echo forces this prerequisites to be run before `Makefile.main::build` ones.
build: web-build web-pack
@echo
# To be used as -tags
WITH_STATIC_TAG := with_static
# Override Makefile.main defaults for arguments to be used in `go` commands.
GO_BUILD_ARGS := -ldflags "$(LD_FLAGS)" -tags "$(WITH_STATIC_TAG)"
FRONTEND_PATH := ./frontend
FRONTEND_BUILD_PATH := $(FRONTEND_PATH)/build
# Tools
YARN := yarn --cwd $(FRONTEND_PATH)
REMOVE := rm -rf
MOVE := mv
MKDIR := mkdir -p
# Environment and arguments to use in `go run` calls.
GO_RUN_ENV := LOG_LEVEL=DEBUG
GO_RUN_ARGS += -tags "$(WITH_STATIC_TAG)"
GOCMD = go
GORUN = $(GOCMD) run $(GO_RUN_ARGS)
build-path:
$(MKDIR) $(BUILD_PATH)
.PHONY: web-build
web-build: build-path web-dependencies
$(YARN) build
$(REMOVE) $(BUILD_PATH)/public
$(MOVE) $(FRONTEND_BUILD_PATH) $(BUILD_PATH)/public
.PHONY: web-dependencies
web-dependencies:
$(YARN) install
.PHONY: web-test
web-test:
CI=1 $(YARN) test
.PHONY: web-clean
web-clean:
$(REMOVE) $(FRONTEND_PATH)/node_modules
$(REMOVE) $(FRONTEND_BUILD_PATH)
.PHONY: web-pack
web-pack:
mkdir -p ./web/assets; \
$(ESC_BIN) \
-pkg assets \
-o ./web/assets/asset.go \
build/public
.PHONY: web-start
web-start:
$(GO_RUN_ENV) $(GORUN) cmd/lookoutd/*.go web
.PHONY: web-serve
web-serve: | web-dependencies web-build web-bindata web-start
.PHONY: lint
lint:
$(YARN) lint