-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
82 lines (71 loc) · 2.25 KB
/
Makefile
File metadata and controls
82 lines (71 loc) · 2.25 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
TARGET_HEADER=@printf '===== \033[34m%s\033[0m\n' $@
TARGET_OK=@printf '----- \033[32mOK\033[0m\n'
YARN=yarn
.PHONY: .yarnrc.yml
.yarnrc.yml: ## Generates yarn configuration
$(TARGET_HEADER)
cp .yarnrc.dist.yml .yarnrc.yml
$(TARGET_OK)
.PHONY: pnp
pnp: package.json yarn.lock ## Installs dependencies
$(TARGET_HEADER)
$(YARN) install --silent
@touch .pnp.loader.mjs || true
.PHONY: build
build: pnp ## Creates a dist catalogue with library build
$(TARGET_HEADER)
$(YARN) build
.PHONY: eslint
eslint: pnp ## Runs eslint
$(TARGET_HEADER)
ifdef cli
$(YARN) eslint $(cli)
else
$(YARN) eslint
endif
.PHONY: typecheck
typecheck: pnp ## Runs typecheck for all workspaces
$(TARGET_HEADER)
$(YARN) typecheck
.PHONY: peers-check
peers-check: pnp ## Validates peer requirements
$(TARGET_HEADER)
$(YARN) peers:check
.PHONY: ci-actionlint
ci-actionlint: ## Runs actionlint for GitHub Actions workflows
$(TARGET_HEADER)
@if command -v actionlint >/dev/null 2>&1; then \
actionlint -color; \
elif command -v docker >/dev/null 2>&1; then \
docker run --rm -v "$$(pwd):/repo" -w /repo rhysd/actionlint:latest -color; \
else \
echo "actionlint or docker is required to run ci-actionlint"; \
exit 1; \
fi
$(TARGET_OK)
.PHONY: test
test: pnp ## Runs autotests
$(TARGET_HEADER)
ifdef cli
$(YARN) test $(cli) --passWithNoTests
else
$(YARN) test
endif
.PHONY: test-coverage
test-coverage: pnp ## Runs autotests with --coverage
$(TARGET_HEADER)
$(YARN) test:coverage
.PHONY: help
help: ## Calls recipes list
@cat $(MAKEFILE_LIST) | grep -e "^[a-zA-Z_\-]*: *.*## *" | awk '\
BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
# Colors
$(call computable,CC_BLACK,$(shell tput -Txterm setaf 0 2>/dev/null))
$(call computable,CC_RED,$(shell tput -Txterm setaf 1 2>/dev/null))
$(call computable,CC_GREEN,$(shell tput -Txterm setaf 2 2>/dev/null))
$(call computable,CC_YELLOW,$(shell tput -Txterm setaf 3 2>/dev/null))
$(call computable,CC_BLUE,$(shell tput -Txterm setaf 4 2>/dev/null))
$(call computable,CC_MAGENTA,$(shell tput -Txterm setaf 5 2>/dev/null))
$(call computable,CC_CYAN,$(shell tput -Txterm setaf 6 2>/dev/null))
$(call computable,CC_WHITE,$(shell tput -Txterm setaf 7 2>/dev/null))
$(call computable,CC_END,$(shell tput -Txterm sgr0 2>/dev/null))