-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
73 lines (53 loc) · 1.66 KB
/
Copy pathMakefile
File metadata and controls
73 lines (53 loc) · 1.66 KB
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
.DEFAULT_GOAL := help
REACT_APP_CMD := EXTEND_ESLINT=true npx react-scripts
LINTED_FILES := ./src/**/*.ts{,x} ./src/*.ts{,x}
ifneq (,$(findstring w,$(MAKEFLAGS)))
# interactive
WATCHFLAG:=-w
CI:=''
else
# non-interactive
WATCHFLAG:=
CI:=true
endif
# Porcelain
# ###############
.PHONY: run build lint lint-fix test container deploy typecheck show-coverage
run: setup ## run development server
$(REACT_APP_CMD) start
build: setup src ## create artifact
CI=false $(REACT_APP_CMD) build # ad hoc fix for warnings
lint-fix: setup ## automatically fix linter errors (if possible)
npx eslint $(LINTED_FILES) --fix
lint: setup ## run static analysis
npx eslint $(LINTED_FILES)
test: setup ## run all tests, use -w for watchmode
CI=$(CI) $(REACT_APP_CMD) test --coverage
container: build ## create container
docker build -t lmap .
init: ## one time setup
direnv allow
todo: ## list all TODOs in the project
git grep -I --line-number TODO | grep -v 'list all TODOs in the project' | grep TODO
deploy: ## deploy a container to Nomad
VERSION=$(VERSION) ./deploy.nomad.tpl > deploy.nomad
nomad job run -address=$(NOMAD_URL) deploy.nomad
show-coverage:
xdg-open coverage/lcov-report/index.html
typecheck: ## run typecheck, use -w for watchmode
npx tsc -p ./tsconfig.json $(WATCHFLAG)
# Plumbing
# ###############
.PHONY: setup clean
setup: node_modules
node_modules: package.json yarn.lock
yarn
touch $@
clean:
rm -f yarn-error.log deploy.nomad
rm -rf coverage
# Utilities
# ###############
.PHONY: help
help: ## print this message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'