-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathMakefile
More file actions
164 lines (136 loc) · 4.17 KB
/
Makefile
File metadata and controls
164 lines (136 loc) · 4.17 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
.PHONY: all build ios android js clean test lint install-tools install help
# Go module
MODULE := github.com/stukennedy/irgo
# Output directories
BUILD_DIR := build
IOS_OUT := $(BUILD_DIR)/ios/Irgo.xcframework
ANDROID_OUT := $(BUILD_DIR)/android/irgo.aar
# Default target
all: build
# Build Go packages
build:
go build ./...
# Run tests
test:
go test -v ./...
# Run linter
lint:
golangci-lint run ./...
# Install the irgo CLI
install:
go install ./cmd/irgo
@echo "irgo CLI installed. Run 'irgo new myapp' to create a new project."
# Install required tools
install-tools:
go install github.com/a-h/templ/cmd/templ@latest
go install golang.org/x/mobile/cmd/gomobile@latest
go install github.com/air-verse/air@latest
gomobile init
@echo "Also install: brew install entr (for file watching)"
# Generate templ files
templ:
templ generate
# Build iOS framework (requires Xcode)
ios: build
@mkdir -p $(BUILD_DIR)/ios
gomobile bind -target ios -o $(IOS_OUT) $(MODULE)/mobile
@echo ""
@echo "iOS framework built: $(IOS_OUT)"
@echo ""
@echo "To use in Xcode:"
@echo " 1. Drag $(IOS_OUT) into your Xcode project"
@echo " 2. Add to 'Frameworks, Libraries, and Embedded Content'"
@echo " 3. Copy ios/Irgo/*.swift into your project"
@echo " 4. Use IrgoWebViewController as your root view controller"
# Build Android AAR (requires Android SDK)
android: build
@mkdir -p $(BUILD_DIR)/android
gomobile bind -target android -o $(ANDROID_OUT) $(MODULE)/mobile
@echo ""
@echo "Android AAR built: $(ANDROID_OUT)"
@echo ""
@echo "To use in Android Studio:"
@echo " 1. Copy $(ANDROID_OUT) to app/libs/"
@echo " 2. Add to build.gradle: implementation files('libs/irgo.aar')"
@echo " 3. Copy android/app/src/main/kotlin/com/irgo/*.kt to your project"
@echo " 4. Extend IrgoActivity in your MainActivity"
# Bundle JavaScript
js:
@mkdir -p $(BUILD_DIR)/js
cp js/irgo-bridge.js $(BUILD_DIR)/js/
@echo "JavaScript bundled: $(BUILD_DIR)/js/irgo-bridge.js"
# Build all platforms
mobile: ios android js
@echo "All platforms built successfully"
# Clean build artifacts
clean:
rm -rf $(BUILD_DIR)
go clean -cache
# Initialize a new irgo project
init-project:
@echo "Creating project structure..."
mkdir -p templates/{layouts,pages,fragments,components}
mkdir -p assets/{css,js,images}
mkdir -p handlers
@echo "Copying Tailwind config..."
@echo '$(shell cat pkg/render/tailwind.go | grep -A 100 "TailwindConfig =" | head -60)' > tailwind.config.js || true
@echo "Project structure created. Run 'npm install' and 'npm run build:css' to set up Tailwind."
# Development server with hot reload (for desktop testing)
dev:
./dev.sh
# Quick dev server (no watching, just run)
serve:
go run ./examples/todo serve
# Format code
fmt:
go fmt ./...
gofmt -s -w .
# Tidy dependencies
tidy:
go mod tidy
# Check for vulnerabilities
vuln:
govulncheck ./...
# Generate documentation
docs:
godoc -http=:6060 &
@echo "Documentation server running at http://localhost:6060/pkg/$(MODULE)/"
# Version info
version:
@echo "irgo framework"
@go version
@echo "Module: $(MODULE)"
# Release targets
release: release-patch
release-patch:
@./scripts/release.sh patch
release-minor:
@./scripts/release.sh minor
release-major:
@./scripts/release.sh major
.PHONY: release release-patch release-minor release-major
# Help
help:
@echo "Irgo Framework - Build Targets"
@echo ""
@echo "Development:"
@echo " make dev - Run example app with hot reload"
@echo " make serve - Quick run example (no watching)"
@echo " make test - Run tests"
@echo ""
@echo "Mobile Builds:"
@echo " make ios - Build iOS framework (.xcframework)"
@echo " make android - Build Android library (.aar)"
@echo " make mobile - Build all mobile platforms"
@echo ""
@echo "CLI:"
@echo " make install - Install irgo CLI"
@echo " irgo new myapp - Create new project"
@echo ""
@echo "Setup:"
@echo " make install-tools - Install dev tools (templ, gomobile, air)"
@echo ""
@echo "Release:"
@echo " make release - Release patch version (0.2.2 -> 0.2.3)"
@echo " make release-minor - Release minor version (0.2.2 -> 0.3.0)"
@echo " make release-major - Release major version (0.2.2 -> 1.0.0)"