-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
83 lines (60 loc) · 1.71 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
COMMIT_SHA := $(shell git rev-parse --short HEAD)
PROJECT_NAME := $(shell basename "$(PWD)")
BIN := node_modules/.bin
SRC_DIR := src
BUILD_DIR := dist
CACHE_DIR := .cache
.PHONY: help
## Display this help
help:
@awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
##@ Development
.PHONY: install
install: ## install all dependencies
@pnpm install
@$(BIN)/husky install
.PHONY: typecheck
typecheck: ## compile TS (no emit)
@$(BIN)/tsc --noEmit
##@ Build
.PHONY: build
build: ## build the project
@rm -rf $(BUILD_DIR)
@$(BIN)/tsup
##@ Test
.PHONY: test
test: ## run tests
@$(BIN)/vitest run
.PHONY: test-watch
test-watch: ## run tests and watch for changes
@$(BIN)/vitest watch
.PHONY: test-coverage
test-coverage: ## run tests and generate coverage report
@$(BIN)/vitest run --coverage
##@ Code quality
.PHONY: format
format: ## format the code
@$(BIN)/prettier --cache --cache-location=$(CACHE_DIR)/prettier --write .
.PHONY: lint
lint: ## lint the code
@$(BIN)/eslint --max-warnings 0 --cache --cache-location $(CACHE_DIR)/eslint --fix .
##@ CI
.PHONY: install-ci
install-ci: ## install all dependencies (CI)
@pnpm install --frozen-lockfile
.PHONY: build-ci
build-ci: build ## build the project (CI)
.PHONY: test-ci
test-ci: test ## run tests (CI)
.PHONY: format-ci
format-ci: ## format the code (CI)
@$(BIN)/prettier --check .
.PHONY: lint-ci
lint-ci: ## lint the code (CI)
@$(BIN)/publint
@$(BIN)/attw --pack .
@$(BIN)/eslint --max-warnings 0 .
##@ Release
.PHONY: release
release: ## create a new release
@$(BIN)/semantic-release