-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
82 lines (67 loc) · 2.19 KB
/
Makefile
File metadata and controls
82 lines (67 loc) · 2.19 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
74
75
76
77
78
79
80
81
82
.PHONY: help
MAKEFLAGS += --silent
.DEFAULT_GOAL := help
help: ## Show help message
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[$$()% a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
include .env
setup: ## Prepare stack to run
npm install
start: ## Start application in dev mode
npm run start
lint: ## Run linters
npm run lint -- $(filter-out $@,$(MAKECMDGOALS))
$(call run_linter,)
lint-fix: ## Run linters
npm run lint:fix -- $(filter-out $@,$(MAKECMDGOALS))
$(MAKE) linter-fix
build: ## Build libs and applications
npm run build
test: ## Run tests
npm run test:ci
ci: ## Run tests in CI mode
$(MAKE) setup
npm audit fix || true
$(MAKE) lint-fix
$(MAKE) build
$(MAKE) test
linter-fix: ## Execute linting and fix
$(call run_linter, \
-e FIX_CSS_PRETTIER=true \
-e FIX_JSON_PRETTIER=true \
-e FIX_JAVASCRIPT_PRETTIER=true \
-e FIX_TYPESCRIPT_PRETTIER=true \
-e FIX_YAML_PRETTIER=true \
-e FIX_MARKDOWN=true \
-e FIX_MARKDOWN_PRETTIER=true \
-e FIX_NATURAL_LANGUAGE=true)
define run_linter
DEFAULT_WORKSPACE="$(CURDIR)"; \
LINTER_IMAGE="linter:latest"; \
VOLUME="$$DEFAULT_WORKSPACE:$$DEFAULT_WORKSPACE"; \
docker build --build-arg UID=$(shell id -u) --build-arg GID=$(shell id -g) --tag $$LINTER_IMAGE .; \
docker run \
-e DEFAULT_WORKSPACE="$$DEFAULT_WORKSPACE" \
-e FILTER_REGEX_INCLUDE="$(filter-out $@,$(MAKECMDGOALS))" \
-e IGNORE_GITIGNORED_FILES=true \
-e VALIDATE_TYPESCRIPT_ES=false \
-e VALIDATE_TSX=false \
-e VALIDATE_CSS=false \
$(1) \
-v $$VOLUME \
--rm \
$$LINTER_IMAGE
endef
define docker-compose
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose -f docker-compose.yml -f docker-compose.local.yml -f docker-compose.$(1).yml $(2)
endef
define open-in-browser
@if command -v x-www-browser &> /dev/null ; then x-www-browser $(1); \
elif command -v xdg-open &> /dev/null ; then xdg-open $(1); \
elif command -v open &> /dev/null ; then open $(1); \
elif command -v start &> /dev/null ; then start $(1); fi;
endef
#############################
# Argument fix workaround
#############################
%:
@: