-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathMakefile
More file actions
267 lines (194 loc) · 9.97 KB
/
Copy pathMakefile
File metadata and controls
267 lines (194 loc) · 9.97 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
.ONESHELL:
SHELL := bash
.SHELLFLAGS := -e -u -c -o pipefail
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
MAC_APP_DIR := apps/mac
IOS_APP_DIR := apps/ios
WORKSPACE_DIR := apps
WORKSPACE_PATH := $(WORKSPACE_DIR)/supaterm.xcworkspace
TUIST_CACHE_PROFILE ?= only-external
WEB_APP_DIR := apps/supaterm.com
WEB_INSTALL_PREREQS := $(WEB_APP_DIR)/package.json $(WEB_APP_DIR)/pnpm-lock.yaml
WEB_NODE_MODULES_STAMP := $(WEB_APP_DIR)/node_modules/.modules.yaml
DOCS_APP_DIR := apps/docs.supaterm.com
DOCS_INSTALL_PREREQS := $(DOCS_APP_DIR)/package.json $(DOCS_APP_DIR)/pnpm-lock.yaml $(DOCS_APP_DIR)/.npmrc
DOCS_NODE_MODULES_STAMP := $(DOCS_APP_DIR)/node_modules/.modules.yaml
WT_INSTALL_URL := https://raw.githubusercontent.com/khoi/git-wt/main/install.sh
WORKTREE ?=
LOGO_OUTPUT ?= /tmp/supaterm-lightning-logo.svg
.DEFAULT_GOAL := help
.PHONY: help install-git-hooks tuist-login tuist-cache-setup bump-and-release worktree-create workspace-generate workspace-open workspace-format workspace-check mac-tuist-install mac-generate mac-tuist-generate mac-generate-sources mac-tuist-generate-release mac-tuist-generate-release-cached mac-build-ghostty mac-build-zmx mac-build-ap mac-build mac-build-snapshot-catalog mac-run mac-run-demo mac-run-snapshot-catalog mac-generate-lightning-logo-svg mac-xcode-open mac-install-tip mac-archive mac-archive-xcodebuild mac-export-archive mac-format swiftlint mac-check mac-test mac-test-xcodebuild mac-test-e2e mac-test-snapshots mac-record-snapshots mac-scan-dead-code mac-inspect-dependencies mac-warm-cache ios-tuist-install ios-generate ios-generate-sources ios-build ios-format ios-lint ios-check ios-inspect-dependencies ios-warm-cache ios-xcode-open web-help web-install web-dev web-worker-dev web-check web-lint web-fmt web-test web-build web-preview web-deploy docs-install docs-dev docs-check docs-validate docs-build docs-preview docs-deploy
help: # Display this help.
@-+echo "Run make with one of the following targets:"
@-+echo
@-+grep -Eh "^[a-z-]+:.*#" $(lastword $(MAKEFILE_LIST)) | sed -E 's/^(.*:)(.*#+)(.*)/ \1 @@@ \3 /' | column -t -s "@@@"
install-git-hooks: # Install repo-local Git hooks.
@mise exec -- hk install --mise
tuist-login: # Log in to Tuist and start the shared Xcode cache service.
@mise exec -- tuist auth login
@$(MAKE) tuist-cache-setup
tuist-cache-setup:
@$(MAKE) -f "$(WORKSPACE_DIR)/Tuist.mk" tuist-cache-setup
bump-and-release: # Compute the next CalVer version, then push an annotated release tag for the stable build.
@python3 .github/scripts/bump_and_release.py
worktree-create: install-git-hooks # Create a worktree and copy ignored and untracked files. Example: make worktree-create WORKTREE=my-branch
@test -n "$(WORKTREE)" || { echo "error: WORKTREE is required, example: make worktree-create WORKTREE=my-branch" >&2; exit 1; }; \
export PATH="$$HOME/.local/bin:/usr/local/bin:/opt/homebrew/bin:$$PATH"; \
wt_bin="$$(command -v wt || true)"; \
if [ -z "$$wt_bin" ]; then \
tmp="$$(mktemp)"; \
trap 'rm -f "$$tmp"' EXIT; \
if command -v curl >/dev/null 2>&1; then \
curl -fsSL "$(WT_INSTALL_URL)" -o "$$tmp"; \
elif command -v wget >/dev/null 2>&1; then \
wget -qO "$$tmp" "$(WT_INSTALL_URL)"; \
else \
echo "error: curl or wget is required to install wt" >&2; \
exit 1; \
fi; \
sh "$$tmp"; \
export PATH="$$HOME/.local/bin:/usr/local/bin:/opt/homebrew/bin:$$PATH"; \
wt_bin="$$(command -v wt || true)"; \
fi; \
test -n "$$wt_bin" || { echo "error: failed to install wt" >&2; exit 1; }; \
"$$wt_bin" switch "$(WORKTREE)" --from "$$(git rev-parse HEAD)" --copy-ignored --copy-untracked
workspace-generate: tuist-cache-setup
@$(MAKE) -f "$(WORKSPACE_DIR)/Tuist.mk" tuist-install
@mise exec -- tuist generate --path "$(WORKSPACE_DIR)" --no-open --cache-profile "$(TUIST_CACHE_PROFILE)" --configuration Debug
workspace-open: workspace-generate
@open "$(WORKSPACE_PATH)"
workspace-format: # Format Apple app and shared Swift code.
@$(MAKE) mac-format
@$(MAKE) ios-format
@swift format -p --in-place --recursive --configuration "$(WORKSPACE_DIR)/.swift-format.json" "$(WORKSPACE_DIR)/shared/SupaTheme"
workspace-check: # Format and lint Apple app and shared Swift code.
@$(MAKE) workspace-format
@$(MAKE) swiftlint
mac-tuist-install:
@$(MAKE) -C "$(MAC_APP_DIR)" tuist-install
mac-generate: # Resolve packages and generate the macOS Xcode workspace.
@$(MAKE) -C "$(MAC_APP_DIR)" generate-project
mac-tuist-generate:
@$(MAKE) -C "$(MAC_APP_DIR)" tuist-generate
mac-generate-sources: # Generate the source-only macOS Xcode workspace.
@$(MAKE) -C "$(MAC_APP_DIR)" generate-project-sources
mac-tuist-generate-release:
@$(MAKE) -C "$(MAC_APP_DIR)" tuist-generate-release
mac-tuist-generate-release-cached:
@$(MAKE) -C "$(MAC_APP_DIR)" tuist-generate-release-cached
mac-build-ghostty:
@$(MAKE) -C "$(MAC_APP_DIR)" build-ghostty
mac-build-zmx:
@$(MAKE) -C "$(MAC_APP_DIR)" build-zmx
mac-build-ap:
@$(MAKE) -C "$(MAC_APP_DIR)" build-ap
mac-build: # Build the macOS app in Debug.
@$(MAKE) -C "$(MAC_APP_DIR)" build-app
mac-build-snapshot-catalog: # Build the macOS snapshot catalog app in Debug.
@$(MAKE) -C "$(MAC_APP_DIR)" build-snapshot-catalog
mac-run: # Build and run the macOS app in Debug.
@$(MAKE) -C "$(MAC_APP_DIR)" run-app
mac-run-demo: # Build and run the macOS app in demo mode.
@$(MAKE) -C "$(MAC_APP_DIR)" run-app-demo
mac-run-snapshot-catalog: # Build and run the macOS snapshot catalog app.
@$(MAKE) -C "$(MAC_APP_DIR)" run-snapshot-catalog
mac-generate-lightning-logo-svg: # Generate the Icon Composer-ready SVG logo.
@$(MAKE) -C "$(MAC_APP_DIR)" generate-lightning-logo-svg LOGO_OUTPUT="$(LOGO_OUTPUT)"
mac-xcode-open: # Open the macOS Xcode workspace.
@open "$(MAC_APP_DIR)/supaterm.xcworkspace"
mac-install-tip: # Install the latest tip release for the macOS app.
@$(MAKE) -C "$(MAC_APP_DIR)" install-tip
mac-archive: # Archive the macOS app for distribution.
@release_day="$$(/usr/bin/python3 .github/scripts/bump_and_release.py release-day HEAD)"; \
$(MAKE) -C "$(MAC_APP_DIR)" archive XCODEBUILD_FLAGS="SUPATERM_RELEASE_DATE=$$release_day"
mac-archive-xcodebuild:
@$(MAKE) -C "$(MAC_APP_DIR)" archive-xcodebuild XCODEBUILD_FLAGS='$(XCODEBUILD_FLAGS)'
mac-export-archive: # Export the archived macOS app for distribution.
@$(MAKE) -C "$(MAC_APP_DIR)" export-archive
mac-format: # Format macOS app code.
@$(MAKE) -C "$(MAC_APP_DIR)" format
swiftlint: # Lint Apple app Swift code.
@cd "$(WORKSPACE_DIR)" && "$$(mise which swiftlint)" lint --quiet --config .swiftlint.yml
mac-check: # Run local formatting and linting for the macOS app.
@$(MAKE) -C "$(MAC_APP_DIR)" check
mac-test: # Run the macOS test suite.
@$(MAKE) -C "$(MAC_APP_DIR)" test
mac-test-xcodebuild:
@$(MAKE) -C "$(MAC_APP_DIR)" test-xcodebuild
mac-test-e2e: # Run the macOS end-to-end tests.
@$(MAKE) -C "$(MAC_APP_DIR)" test-e2e
mac-test-snapshots: # Run the macOS snapshot tests.
@$(MAKE) -C "$(MAC_APP_DIR)" test-snapshots
mac-record-snapshots: # Record macOS snapshot references.
@$(MAKE) -C "$(MAC_APP_DIR)" record-snapshots
mac-scan-dead-code:
@$(MAKE) -C "$(MAC_APP_DIR)" scan-dead-code
mac-inspect-dependencies: # Check the macOS Tuist graph for implicit dependencies.
@$(MAKE) -C "$(MAC_APP_DIR)" inspect-dependencies
mac-warm-cache: # Warm the macOS external Tuist cache.
@$(MAKE) -C "$(MAC_APP_DIR)" warm-cache
ios-tuist-install:
@$(MAKE) -C "$(IOS_APP_DIR)" tuist-install
ios-generate:
@$(MAKE) -C "$(IOS_APP_DIR)" generate-project
ios-generate-sources:
@$(MAKE) -C "$(IOS_APP_DIR)" generate-project-sources
ios-build:
@$(MAKE) -C "$(IOS_APP_DIR)" build-app
ios-format:
@$(MAKE) -C "$(IOS_APP_DIR)" format
ios-lint:
@$(MAKE) -C "$(IOS_APP_DIR)" lint
ios-check:
@$(MAKE) -C "$(IOS_APP_DIR)" check
ios-inspect-dependencies:
@$(MAKE) -C "$(IOS_APP_DIR)" inspect-dependencies
ios-warm-cache:
@$(MAKE) -C "$(IOS_APP_DIR)" warm-cache
ios-xcode-open:
@$(MAKE) -C "$(IOS_APP_DIR)" xcode-open
web-help: # Show available Vite+ commands for the web app.
@cd "$(WEB_APP_DIR)" && vp help
$(WEB_NODE_MODULES_STAMP): $(WEB_INSTALL_PREREQS)
@cd "$(WEB_APP_DIR)" && vp install
web-install: $(WEB_NODE_MODULES_STAMP) # Install web app dependencies.
@:
web-dev: $(WEB_NODE_MODULES_STAMP) # Run the web development server.
@cd "$(WEB_APP_DIR)" && vp dev
web-worker-dev: $(WEB_NODE_MODULES_STAMP) # Run the Cloudflare Worker with built assets.
@cd "$(WEB_APP_DIR)" && vp exec wrangler dev
web-check: $(WEB_NODE_MODULES_STAMP) # Run formatting, linting, and type checks for the web app.
@cd "$(WEB_APP_DIR)" && vp check
web-lint: $(WEB_NODE_MODULES_STAMP) # Lint the web app.
@cd "$(WEB_APP_DIR)" && vp lint
web-fmt: $(WEB_NODE_MODULES_STAMP) # Format web app files.
@cd "$(WEB_APP_DIR)" && vp fmt
web-test: $(WEB_NODE_MODULES_STAMP) # Run the web app test suite.
@cd "$(WEB_APP_DIR)" && pnpm exec vp test
web-build: $(WEB_NODE_MODULES_STAMP) # Build the web app for production.
@cd "$(WEB_APP_DIR)" && vp build
web-preview: $(WEB_NODE_MODULES_STAMP) # Preview the built web app.
@cd "$(WEB_APP_DIR)" && vp preview
web-deploy: web-build # Build and deploy the web app to Cloudflare Workers.
@cd "$(WEB_APP_DIR)" && vp exec wrangler deploy
$(DOCS_NODE_MODULES_STAMP): $(DOCS_INSTALL_PREREQS)
@cd "$(DOCS_APP_DIR)" && vp install
docs-install: $(DOCS_NODE_MODULES_STAMP) # Install documentation site dependencies.
@:
define run-docs
@cd "$(DOCS_APP_DIR)" && vp run $(1)
endef
docs-dev: $(DOCS_NODE_MODULES_STAMP) # Run the documentation development server.
$(call run-docs,dev)
docs-check: $(DOCS_NODE_MODULES_STAMP) # Type-check the documentation site.
$(call run-docs,check)
docs-validate: $(DOCS_NODE_MODULES_STAMP) # Validate documentation links.
$(call run-docs,validate)
docs-build: $(DOCS_NODE_MODULES_STAMP) # Build the documentation site for production.
$(call run-docs,build)
docs-preview: docs-build # Build and preview the documentation site.
$(call run-docs,preview)
docs-deploy: docs-build # Build and deploy the documentation site to Cloudflare Workers.
$(call run-docs,deploy)