-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
152 lines (103 loc) · 3.95 KB
/
Copy pathMakefile
File metadata and controls
152 lines (103 loc) · 3.95 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
.PHONY: *
.DEFAULT_GOAL := help
SHELL := /bin/bash
CLI_BIN = node cli/dist/index.js
DESTINATION ?= platform=iOS Simulator,name=iPhone 16
help:
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_\-\/]+:.*?##/ { printf " \033[36m%-25s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
##@ Global
deps: kit/deps cli/deps sdk/deps ## Install all dependencies
can-release: kit/can-release cli/can-release sdk/can-release ## Run all CI gates
clean: kit/clean cli/clean sdk/clean ## Clean all build artifacts
pack: kit/pack cli/pack sdk/pack ## Pack all release artifacts
##@ Kit (iOS)
kit/deps: ## Install Kit dependencies (SwiftFormat, SwiftLint)
@brew install swiftformat swiftlint 2>/dev/null || brew upgrade swiftformat swiftlint 2>/dev/null || true
kit/can-release: kit/fmt/check kit/lint kit/build ## All kit checks
kit/setup: cli/build ## Interactive setup wizard
@$(CLI_BIN) init
kit/sync: cli/build ## Sync pwa-config.json to Xcode project
@$(CLI_BIN) sync
kit/open: ## Open Xcode project
@open kit/PWAKitApp.xcodeproj
kit/build: ## Build iOS app
@xcodebuild build \
-project kit/PWAKitApp.xcodeproj \
-scheme PWAKitApp \
-destination '$(DESTINATION)' \
-quiet
kit/test: ## Run Swift tests
@xcodebuild test \
-project kit/PWAKitApp.xcodeproj \
-scheme PWAKitApp \
-destination '$(DESTINATION)' \
-quiet
kit/lint: ## Run SwiftLint
@./kit/scripts/lint.sh
kit/lint/fix: ## Auto-fix lint issues
@./kit/scripts/lint.sh --fix
kit/fmt: ## Format Swift code
@./kit/scripts/format.sh
kit/fmt/check: ## Check Swift formatting
@./kit/scripts/format.sh --check
kit/clean: ## Clean Xcode derived data
@rm -rf ~/Library/Developer/Xcode/DerivedData/PWAKitApp-*
kit/pack: ## Pack Kit as release template tarball
$(eval VERSION := $(shell sed -n 's/.*public static let version = "\(.*\)"/\1/p' kit/src/PWAKitCore/PWAKitCore.swift))
@tar -czf pwakit-template-$(VERSION).tar.gz \
kit/PWAKitApp.xcodeproj/ \
kit/src/PWAKit/ \
kit/src/PWAKitCore/ \
--exclude='kit/src/PWAKit/Resources/pwa-config.json' \
--exclude='kit/src/PWAKit/Resources/AppIcon-source.png'
@echo "Created pwakit-template-$(VERSION).tar.gz"
##@ CLI
cli/deps: ## Install CLI dependencies
@cd cli && npm ci
cli/can-release: cli/build cli/typecheck cli/test ## All CLI checks
cli/build: ## Build CLI
@cd cli && npm run build
cli/test: ## Run CLI tests
@cd cli && npm test
cli/typecheck: ## Type check CLI
@cd cli && npm run typecheck
cli/clean: ## Remove CLI dist
@rm -rf cli/dist
cli/link: cli/build ## Link CLI globally for local dev
@cd cli && npm link
cli/pack: cli/build ## Pack CLI as installable tarball
@cd cli && npm pack
##@ SDK
sdk/deps: ## Install SDK dependencies
@cd sdk && npm ci
sdk/can-release: sdk/build sdk/typecheck sdk/test ## All SDK checks
sdk/build: ## Build SDK
@cd sdk && npm run build
sdk/test: ## Run SDK tests
@cd sdk && npm test
sdk/typecheck: ## Type check SDK
@cd sdk && npm run typecheck
sdk/clean: ## Remove SDK dist
@rm -rf sdk/dist
sdk/pack: sdk/build ## Pack SDK as installable tarball
@cd sdk && npm pack
##@ Docs Site
docs/deps: ## Install docs site dependencies
@cd docs-site && bun install
docs/dev: ## Run docs site locally
@cd docs-site && bun run dev
docs/build: ## Build docs site static output
@cd docs-site && bun run build
docs/preview: docs/build ## Preview built docs site
@cd docs-site && bun run preview
##@ Example
example/deps: ## Install example dependencies
@cd example && npm install
example/serve: ## Run kitchen sink demo server
@./example/run-example.sh --server-only
example/build: sdk/build ## Build example for deployment
@cd example && rm -rf dist && mkdir -p dist
@cp example/index.html example/app.js example/styles.css example/manifest.json example/icon-1024.png example/dist/
@cp sdk/dist/index.global.js example/dist/pwakit.js
example/deploy: example/build ## Deploy to Cloudflare Workers
@cd example && npx wrangler deploy