-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
76 lines (62 loc) · 1.97 KB
/
Copy pathMakefile
File metadata and controls
76 lines (62 loc) · 1.97 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
.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 --workspaces --include-workspace-root || true
$(MAKE) lint-fix
$(MAKE) build
$(MAKE) test
linter-fix: ## Execute linting and fix
$(call run_linter, \
-e FIX_SPELL_CODESPELL=true \
-e FIX_MARKDOWN=true \
-e FIX_MARKDOWN_PRETTIER=true \
-e FIX_YAML_PRETTIER=true \
-e FIX_NATURAL_LANGUAGE=true \
-e FIX_SHELL_SHFMT=true \
-e FIX_BIOME_LINT=true \
-e FIX_BIOME_FORMAT=true \
)
define run_linter
DEFAULT_WORKSPACE="$(CURDIR)"; \
LINTER_IMAGE="linter:latest"; \
VOLUME="$$DEFAULT_WORKSPACE:$$DEFAULT_WORKSPACE"; \
docker build --platform linux/amd64 --build-arg UID=$(shell id -u) --build-arg GID=$(shell id -g) --tag $$LINTER_IMAGE .; \
docker run \
--platform linux/amd64 \
-v "$VOLUME" \
--rm \
-e DEFAULT_WORKSPACE="$$DEFAULT_WORKSPACE" \
-e FILTER_REGEX_INCLUDE="$(filter-out $@,$(MAKECMDGOALS))" \
$(1) \
$$LINTER_IMAGE
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
#############################
%:
@: