-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
170 lines (119 loc) · 4.96 KB
/
Copy pathmakefile
File metadata and controls
170 lines (119 loc) · 4.96 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
167
168
169
170
.PHONY: build help
# Run silently, show output on failure
run-silent = $1 >/tmp/atomic-crm-$2.log 2>&1 || (cat /tmp/atomic-crm-$2.log && false)
# Same but captures TTY output (for docker/supabase)
ifeq ($(shell uname),Darwin)
run-silent-tty = script -q /tmp/atomic-crm-$2.log $1 >/dev/null 2>&1 || (cat /tmp/atomic-crm-$2.log && false)
else
run-silent-tty = script -eq /dev/null -c "$1" >/tmp/atomic-crm-$2.log 2>&1 || (cat /tmp/atomic-crm-$2.log && false)
endif
help:
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
install: package.json ## install dependencies
npm install;
start-supabase: ## start supabase locally
npx supabase start
start-supabase-functions: ## start the supabase Functions watcher
npx supabase functions serve
supabase-migrate-database: ## apply the migrations to the database
npx supabase migration up
supabase-reset-database: ## reset (and clear!) the database
npx supabase db reset
start-app: ## start the app locally
npm run dev
start-app-e2e: ## start the app pointing to the e2e supabase instance
npx vite --port 5175 --force --mode e2e &
stop-app-e2e:
kill $$(lsof -t -i:5175)
start-app-e2e-ci: build-e2e ## start the app pointing to the e2e supabase instance in CI mode (no open, no watch)
npx serve -l 5175 -L -s dist &
start: start-supabase start-app ## start the stack locally
start-demo: ## start the app locally in demo mode
npm run dev:demo
stop-supabase: ## stop local supabase
npx supabase stop
stop: stop-supabase ## stop the stack locally
start-supabase-e2e: ## start a separate supabase instance for e2e (fresh DB every run)
@npx supabase stop --workdir .supabase-e2e --no-backup 2>/dev/null || true
rm -rf .supabase-e2e/supabase
mkdir -p .supabase-e2e/supabase
cp supabase/config.e2e.toml .supabase-e2e/supabase/config.toml
cp -r supabase/migrations .supabase-e2e/supabase/migrations
cp -r supabase/schemas .supabase-e2e/supabase/schemas
cp -r supabase/functions .supabase-e2e/supabase/functions
cp -r supabase/templates .supabase-e2e/supabase/templates
cp supabase/seed.sql .supabase-e2e/supabase/seed.sql
cp supabase/signing_keys.json .supabase-e2e/supabase/signing_keys.json
@$(call run-silent-tty,npx supabase start --workdir .supabase-e2e,supabase-e2e)
stop-supabase-e2e: ## stop the e2e supabase instance
npx supabase stop --workdir .supabase-e2e --no-backup
start-e2e: start-supabase-e2e start-app-e2e ## start the stack in e2e mode (fresh supabase instance + app pointing to it)
start-e2e-ci: start-supabase-e2e start-app-e2e-ci ## start the stack in e2e mode in CI (fresh supabase instance + built app pointing to it)
stop-e2e: stop-supabase-e2e stop-app-e2e ## stop the stack in e2e mode
build: ## build the app
npm run build
build-e2e: ## build the app in e2e mode (with the e2e supabase config)
@$(call run-silent,npm run build:e2e,build-e2e)
build-demo: ## build the app in demo mode
npm run build:demo
prod-start: build supabase-deploy
open http://127.0.0.1:3000 && npx serve -l tcp://127.0.0.1:3000 dist
prod-deploy: build supabase-deploy
npm run ghpages:deploy
supabase-remote-init:
npm run supabase:remote:init
$(MAKE) supabase-deploy
supabase-deploy:
npx supabase db push
npx supabase functions deploy
test-unit: test-app test-functions
test: test-unit test-e2e-ci
test-app:
npm run test:unit:app
test-functions:
npm run test:unit:functions
test-e2e: start-e2e
npx playwright test --ui
test-e2e-ci: start-e2e-ci
npx wait-on http-get://localhost:54341/auth/v1/health http-get://localhost:5175
npx playwright test
lint:
npm run lint
npm run prettier
publish:
npm publish
typecheck:
npm run typecheck
doc-install:
@(cd doc && npm install)
doc: doc-dev
doc-dev:
@(cd doc && npm run dev)
doc-build:
@(cd doc && npm run build)
doc-preview: doc-build
@(cd doc && npm run preview)
doc-deploy:
@(cd doc && npx gh-pages -b gh-pages -d dist -e doc -m "Deploy docs" --remove doc)
registry-build: ## build the shadcn registry
npm run registry:build
registry-deploy: registry-build ## Deploy the shadcn registry (Automatically done by CI/CD pipeline)
@(cd public/r && npx gh-pages -b gh-pages -d ./ -s atomic-crm.json -e r -m "Deploy registry" --remove r)
registry-gen: ## Generate the shadcn registry (ran automatically by a pre-commit hook)
npm run registry:gen
npx prettier --config ./.prettierrc.json --write "registry.json"
storybook: ## start storybook
npm run storybook
TASK ?= $(error TASK is required)
NAME ?= $(error NAME is required)
spin: ## create worktree + branch + node_modules symlink
git worktree add worktrees/$(TASK) -b $(NAME)
cd worktrees/$(TASK) && ln -s ../../node_modules node_modules
merge: ## rebase onto main + push + open PR
cd worktrees/$(TASK) && \
git rebase main && \
git push origin HEAD && \
gh pr create --title "$(TITLE)" --body "" --base main
clean: ## delete worktree and branch after confirmed merge
git worktree remove worktrees/$(TASK) --force
git branch -D $(NAME) 2>/dev/null || true