-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
96 lines (78 loc) · 2.18 KB
/
Makefile
File metadata and controls
96 lines (78 loc) · 2.18 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
# Define color codes
YELLOW = \033[0;33m
NC = \033[0m # No Color
# Define echo function
define echo_status
echo "${YELLOW}$(1)${NC}"
endef
.PHONY: all dev build lint preview clean init cert pnpm add env
all: dev
init: env cert pnpm install
dev:
@$(call echo_status,Running dev server...)
@pnpm run dev
build:
@$(call echo_status,Building...)
@pnpm run build
test:
@$(call echo_status,Running tests...)
@pnpm run test
test-ci:
@$(call echo_status,Running tests...)
@pnpm run test:ci
lint:
@$(call echo_status,Running typecheck...)
@pnpm run typecheck
@$(call echo_status,Running lint:fix...)
@pnpm run lint:fix
@$(call echo_status,Running lint...)
@pnpm run lint
precommit: lint test-ci build
preview: build
@$(call echo_status,Running preview...)
@pnpm run preview
add:
@$(call echo_status,Adding shadcn component: $(filter-out $@,$(MAKECMDGOALS)))
@pnpm dlx shadcn@latest add $(filter-out $@,$(MAKECMDGOALS))
clean:
rm -rf dist
rm -rf node_modules
cert:
@$(call echo_status,Checking for mkcert and localhost certificates...)
@if ! command -v mkcert >/dev/null 2>&1; then \
$(call echo_status,mkcert not found, installing...); \
brew install mkcert nss; \
else \
$(call echo_status,mkcert is already installed.); \
fi
@$(call echo_status,Installing mkcert root CA...)
@mkcert -install
@if [ ! -f "./localhost.pem" ] || [ ! -f "./localhost-key.pem" ]; then \
$(call echo_status,Generating localhost certificates...); \
mkcert localhost; \
else \
$(call echo_status,Localhost certificates already exist.); \
fi
env:
@$(call echo_status,Checking for .env file...)
@if [ ! -f ".env" ]; then \
$(call echo_status,.env file not found, copying from .env.example...); \
cp .env.example .env; \
$(call echo_status,.env file created.); \
else \
$(call echo_status,.env file already exists.); \
fi
pnpm:
@$(call echo_status,Checking for pnpm...)
@if ! command -v pnpm >/dev/null 2>&1; then \
$(call echo_status,pnpm not found, installing...); \
npm install -g pnpm; \
else \
$(call echo_status,pnpm is already installed.); \
fi
install:
@$(call echo_status,Installing dependencies...)
@pnpm install
# Allow for passing arguments to the add command
%:
@: