-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
113 lines (86 loc) · 4.47 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Executables (local)
PKG_MANAGER = yarn
PKG_EXECUTE = npx
MONOREPO_TOOL = lerna
# Flags
# Modify these variables in local.mk to add flags to the commands, ie.
# YARN_FLAGS += --prefer-offline
PKG_MANAGER_FLAGS :=
# On CI servers, use the `yarn install --frozen-lockfile` installer to avoid introducing changes to the package-lock.json
# On developer machines, prefer the generally more flexible `yarn install`. 💪
PKG_MANAGER_INSTALL := $(if $(CI), install --frozen-lockfile, install)
MONOREPO_TOOL_FLAGS :=
# Use `make target DEBUG=true` for enabling debug mode
MONOREPO_TOOL_NO_PUSH := $(if $(DEBUG), --no-git-tag-version)
# Misc
.DEFAULT_GOAL = help
.PHONY = help sh bash
# If this file exists, load it and add it to this makefile.
# Useful for defining per-developer variables or make targets. This file should not be under
# version control. ⚠️
-include local.mk
## —— 👻 The Spirit Design System Makefile 👻 —————————————————————————————————
help: ## Outputs this help screen
@grep -E '(^[a-zA-Z0-9_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}{printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
## —— Dependencies 📦 ——————————————————————————————————————————————————————————————
install: ## Install dependencies
$(PKG_MANAGER) $(PKG_MANAGER_INSTALL) $(PKG_MANAGER_FLAGS) && touch node_modules
outdated: ## List outdated dependencies
$(PKG_MANAGER) outdated || true
$(PKG_MANAGER) $(MONOREPO_TOOL) exec "$(PKG_MANAGER) outdated || true"
unlock: ## Unlock dependencies
pristine
rm -f yarn.lock packages/*/yarn.lock
touch package.json
pristine: clean ## Remove all `node_modules` and files
rm -rf node_modules {packages,apps}/*/node_modules
## —— Development 🏗️ ——————————————————————————————————————————————————————————————
ifeq ($(pkg),)
start: ## Starts development environment, pass the parameter "pkg=" to start specific package environment, example: make start pkg=web
@$(eval pkg ?=)
@$(PKG_MANAGER) start
else
start:
@$(eval pkg ?=)
@$(PKG_MANAGER) run start --scope @lmc-eu/spirit-$(pkg)
endif
## —— Testing 🚦 ——————————————————————————————————————————————————————————————
format: ## Checks code formatting of all packages
$(PKG_MANAGER) format
format-fix: ## Fixes code formatting
$(PKG_MANAGER) format:fix
lint: ## Lints all packages
$(PKG_MANAGER) lint
test: ## Run tests in all packages
$(PKG_MANAGER) test
test-e2e: ## Run End-to-End tests
./bin/make/e2e.sh
test-e2e-update: ## Update snapshots for End-to-End tests
./bin/make/e2e.sh --update
test-e2e-report: ## Open report for End-to-End tests
./bin/make/e2e.sh --report
test-e2e-ui: ## Open UI for End-to-End tests
./bin/make/e2e.sh --ui
types: ## Check types in all packages
$(PKG_MANAGER) types
## —— Release 🚀 ——————————————————————————————————————————————————————————————
version: ## Create new version of packages
# @see https://github.com/lerna/lerna/tree/main/commands/version#readme
# Bump version of packages changed since the last release
# --yes` - skip all confirmation prompts
$(PKG_MANAGER) $(MONOREPO_TOOL) version --yes --no-push $(MONOREPO_TOOL_FLAGS) $(MONOREPO_TOOL_NO_PUSH)
build: ## Builds all packages
$(PKG_MANAGER) build
ifeq ($(pkg),web-twig)
publish: ## Publish packages to repository, pass the parameter "pkg=" to publish specific package (supports only `web-twig`), example: make publish pkg=web-twig
@$(eval pkg ?=)
git push web-twig-readonly `git subtree split --prefix packages/web-twig main`:main
else
publish:
@$(eval pkg ?=)
$(PKG_EXECUTE) $(MONOREPO_TOOL) publish from-package --yes $(MONOREPO_TOOL_FLAGS)
endif
## —— Miscellaneous 🛠️ ——————————————————————————————————————————————————————————————
clean: ## Clean output files
rm -rf {.nyc_output,coverage,dist,build,esm,cjs,umd,types}
find . -name '*.log' -print -delete