-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
166 lines (137 loc) Β· 4.42 KB
/
Makefile
File metadata and controls
166 lines (137 loc) Β· 4.42 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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#!make
## Set 'bash' as default shell
SHELL := $(shell which bash)
## Set 'help' target as the default goal
.DEFAULT_GOAL := help
## Test if the dependencies we need to run this Makefile are installed
NPM := $(shell command -v npm)
MISE := $(shell command -v mise)
## Versions
NODE ?= $(shell cat $(PWD)/.nvmrc 2> /dev/null || echo v24)
.PHONY: help
help: ## Show this help
@echo 'Usage: make [target] ...'
@echo ''
@echo 'targets:'
@egrep -h '^[a-zA-Z0-9_\/-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort -d | awk 'BEGIN {FS = ":.*?## "; printf "Usage: make \033[0;34mTARGET\033[0m \033[0;35m[ARGUMENTS]\033[0m\n\n"; printf "Targets:\n"}; {printf " \033[33m%-25s\033[0m \033[0;32m%s\033[0m\n", $$1, $$2}'
.PHONY: requirements
requirements: ## Check if the requirements are satisfied
ifndef NPM
@echo "π¦π§© npm is not available. Please install npm."
@exit 1
endif
@echo "π The necessary dependencies are already installed!"
.PHONY: setup
setup: ## π¦ Installing global dependencies (mise)
@echo "πΏ Installing dependencies for mac with homebrew (https://brew.sh)... "
@brew install mise
@echo "π° ......................."
@echo "Add to your shell config (~/.zshrc or ~/.bashrc):"
@echo " eval \"\$$(mise activate zsh)\" # or 'bash' for bash users"
@echo " alias mr=\"mise run\""
@echo "π° ......................."
.PHONY: install
install: requirements ## π¦ Install project dependencies
@echo "π¦ Installing project dependencies..."
@npm install
@echo "β
Dependencies installed!"
.PHONY: build
build: ## π¨ Build the project
@echo "π¨ Building project..."
@npm run build
@echo "β
Build completed!"
.PHONY: test
test: ## π§ͺ Run tests with coverage
@echo "π§ͺ Running tests..."
@npm run test
.PHONY: test-types
test-types: ## π§ͺ Run type tests
@echo "π§ͺ Running type tests..."
@npm run test:types
.PHONY: coverage
coverage: ## π Run tests with coverage report
@echo "π Running tests with coverage..."
@npm run coverage
.PHONY: bench
bench: ## β‘ Run benchmarks
@echo "β‘ Running benchmarks..."
@npm run bench
.PHONY: lint
lint: ## π Lint the code
@echo "π Linting code..."
@npm run lint
.PHONY: format
format: ## π¨ Format the code
@echo "π¨ Formatting code..."
@npm run format
.PHONY: check
check: ## β
Type check and lint
@echo "β
Running type check and lint..."
@npm run check
.PHONY: clean
clean: ## π§Ή Clean build artifacts
@echo "π§Ή Cleaning build artifacts..."
@npm run clean
@echo "β
Clean completed!"
.PHONY: maintenance
maintenance: ## π§ Full maintenance (clean all)
@echo "π§ Running full maintenance..."
@npm run maintenance
@echo "β
Maintenance completed!"
.PHONY: docs
docs: ## π Generate documentation
@echo "π Generating documentation..."
@npm run docs
@echo "β
Documentation generated in ./docs"
.PHONY: deps-update
deps-update: ## π¦ Update dependencies
@echo "π¦ Checking for dependency updates..."
@npm run deps:update
.PHONY: deps-unused
deps-unused: ## π Check for unused dependencies
@echo "π Checking for unused dependencies..."
@npm run deps:unused
.PHONY: docker-up
docker-up: ## π³ Start Docker containers
@echo "π³ Starting Docker containers..."
ifdef MISE
@mise run docker-compose-up
else
@docker compose -f compose.yml up -d
endif
@echo "β
Docker containers started!"
.PHONY: docker-down
docker-down: ## π³ Stop Docker containers
@echo "π³ Stopping Docker containers..."
ifdef MISE
@mise run docker-compose-down
else
@docker compose -f compose.yml down --rmi local --volumes --remove-orphans
endif
@echo "β
Docker containers stopped!"
.PHONY: docker-prune
docker-prune: ## π³ Prune Docker resources
@echo "π³ Pruning Docker resources..."
ifdef MISE
@mise run docker-builder-prune
else
@docker builder prune -a && docker image prune && docker network prune
endif
@echo "β
Docker resources pruned!"
.PHONY: tarball-check
tarball-check: ## π¦ Check npm package tarball
@echo "π¦ Checking npm package..."
@npm run tarball:check
.PHONY: publish-dry-run
publish-dry-run: ## π¦ Dry run npm publish
@echo "π¦ Dry run npm publish..."
@npm run publish:dry-run
.PHONY: dev
dev: docker-up ## π Start development environment
@echo "π Development environment ready!"
.PHONY: ci
ci: check test ## π€ Run CI checks (lint + type check + tests)
@echo "β
CI checks passed!"
.PHONY: all
all: clean install build test docs ## π― Run all: clean, install, build, test, docs
@echo "π― All tasks completed!"