forked from aws-samples/cdk-eks-blueprints-patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (49 loc) · 1.53 KB
/
Makefile
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
#!/bin/bash
# Libraries
TSC := node node_modules/.bin/tsc
ESLINT := node node_modules/.bin/eslint
CDK := node node_modules/.bin/cdk
pattern: pattern_name := $(firstword $(filter-out pattern, $(MAKECMDGOALS)))
pattern: pattern_command := $(subst pattern $(pattern_name), , $(MAKECMDGOALS))
pattern_files := $(notdir $(wildcard bin/*.ts))
formatted_pattern_names := $(patsubst %.ts,%,$(pattern_files))
# Dependecies
HOMEBREW_LIBS := nvm typescript argocd
list:
@$ echo "To work with patterns use: \n\t$$ make pattern <pattern-name> <list | deploy | synth | destroy>"
@$ echo "Example:\n\t$$ make pattern fargate deploy \n\nPatterns: \n"
@$ $(foreach pattern, $(formatted_pattern_names), echo "\t$(pattern)";)
deps: bootstrap
npm install
lint:
$(ESLINT) . --ext .js,.jsx,.ts,.tsx
lint-fix:
$(ESLINT) . --ext .js,.jsx,.ts,.tsx --fix
build:
rm -rf dist && $(TSC) --skipLibCheck
compile:
$(TSC) --build --incremental
mkdocs:
mkdocs serve
pattern:
@echo $(pattern_name) performing $(pattern_command)
$(CDK) --app "npx ts-node bin/$(pattern_name).ts" $(if $(pattern_command),$(pattern_command), list)
@:
%:
@:
test-all:
@for pattern in $(formatted_pattern_names) ; do \
echo "Building pattern $$pattern"; \
$(CDK) --app "npx ts-node bin/$$pattern.ts" list || exit 1 ;\
done
bootstrap:
@for LIB in $(HOMEBREW_LIBS) ; do \
LIB=$$LIB make check-lib ; \
done
check-lib:
ifeq ($(shell brew ls --versions $(LIB)),)
@echo Installing $(LIB) via Hombrew
@brew install $(LIB)
else
@echo $(LIB) is already installed, skipping.
endif