-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
199 lines (158 loc) · 6.11 KB
/
Makefile
File metadata and controls
199 lines (158 loc) · 6.11 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
# ironhtml - Makefile
# =============================================================================
# Configuration
# =============================================================================
CARGO := cargo
# =============================================================================
# Default target
# =============================================================================
.PHONY: all
all: build ## Build the entire project
# =============================================================================
# Building
# =============================================================================
.PHONY: build
build: ## Build all crates
@echo "Building..."
$(CARGO) build --all-targets
.PHONY: build-release
build-release: ## Build in release mode
@echo "Building release..."
$(CARGO) build --all-targets --release
.PHONY: build-wasm
build-wasm: ## Build for WebAssembly target
@echo "Building for WebAssembly..."
$(CARGO) build --target wasm32-unknown-unknown
.PHONY: build-examples
build-examples: ## Build and run all examples
@echo "Building examples..."
$(CARGO) build --examples
@echo "Running ironhtml-bootstrap examples..."
$(CARGO) run --example landing_page > /dev/null
$(CARGO) run --example wallet_dashboard > /dev/null
$(CARGO) run --example bootstrap_docs > /dev/null
@echo "All examples built successfully"
# =============================================================================
# Formatting
# =============================================================================
.PHONY: format
format: format-rust format-toml format-md ## Format all code
@echo "Formatting complete"
.PHONY: format-rust
format-rust: ## Format Rust code with cargo fmt
@echo "Formatting Rust code..."
$(CARGO) fmt --all
.PHONY: format-toml
format-toml: ## Format TOML files with taplo
@echo "Formatting TOML files..."
taplo format
.PHONY: format-md
format-md: ## Format Markdown files with Prettier
@echo "Formatting Markdown files..."
npx prettier --write "*.md"
# =============================================================================
# Format Checking (for CI)
# =============================================================================
.PHONY: format-check
format-check: format-check-rust format-check-toml format-check-md ## Check formatting without modifying files
@echo "Format check complete"
.PHONY: format-check-rust
format-check-rust: ## Check Rust formatting
@echo "Checking Rust formatting..."
$(CARGO) fmt --all --check
.PHONY: format-check-toml
format-check-toml: ## Check TOML formatting with taplo
@echo "Checking TOML formatting..."
taplo format --check
.PHONY: format-check-md
format-check-md: ## Check Markdown formatting with Prettier
@echo "Checking Markdown formatting..."
npx prettier --check "*.md"
# =============================================================================
# Linting
# =============================================================================
.PHONY: lint
lint: ## Lint all code with clippy
@echo "Linting..."
$(CARGO) clippy --all-targets -- -D warnings
.PHONY: lint-shell
lint-shell: ## Lint shell scripts using shellcheck
shellcheck .github/scripts/*.sh
# =============================================================================
# Testing
# =============================================================================
.PHONY: test
test: ## Run all tests
@echo "Running tests..."
$(CARGO) test --all-targets
@echo "All tests passed"
.PHONY: test-doc
test-doc: ## Run documentation tests
@echo "Running doc tests..."
$(CARGO) test --doc --features macros
.PHONY: test-parse5
test-parse5: ## Run parse5 integration tests
@echo "Running parse5 integration tests..."
@cd tests/parse5 && npm install --silent && npm test
# =============================================================================
# Benchmarks
# =============================================================================
.PHONY: bench
bench: ## Run benchmarks
@echo "Running benchmarks..."
$(CARGO) bench -p ironhtml --features macros
# =============================================================================
# Documentation
# =============================================================================
.PHONY: doc
doc: ## Generate documentation
@echo "Generating documentation..."
$(CARGO) doc --no-deps
.PHONY: doc-open
doc-open: ## Generate and open documentation
@echo "Generating and opening documentation..."
$(CARGO) doc --no-deps --open
# =============================================================================
# Cleaning
# =============================================================================
.PHONY: clean
clean: ## Clean build artifacts
@echo "Cleaning..."
rm -rf target
# =============================================================================
# Publishing
# =============================================================================
# Crates must be published in dependency order.
# Sleep between publishes to let the crates.io index update.
PUBLISH_CRATES := \
ironhtml-elements \
ironhtml-attributes \
ironhtml-macro \
ironhtml-parser \
ironhtml \
ironhtml-bootstrap
.PHONY: publish
publish: ## Publish all crates to crates.io
@for crate in $(PUBLISH_CRATES); do \
echo "Publishing $$crate..."; \
$(CARGO) publish -p $$crate || exit 1; \
echo "Waiting for crates.io index to update..."; \
sleep 30; \
done
@echo "All crates published successfully"
.PHONY: publish-dry-run
publish-dry-run: ## Dry-run publish for all crates
$(CARGO) package --workspace --allow-dirty
@echo "Dry-run complete — all crates are ready to publish"
# =============================================================================
# CI
# =============================================================================
.PHONY: ci
ci: format-check lint test build-examples test-parse5 ## Run all CI checks
@echo "CI checks passed"
# =============================================================================
# Help
# =============================================================================
.PHONY: help
help: ## Show this help message
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'