Skip to content

Commit 8dde4d7

Browse files
committed
Update Makefile for AI SDK project
- Renamed the Makefile to reflect the AI SDK project. - Added support for multi-module structure, including root and integrations modules. - Updated help messages and commands to indicate operations for all modules. - Enhanced test, lint, format, tidy, and check commands to operate on both root and integrations modules, ensuring comprehensive coverage.
1 parent 77ff378 commit 8dde4d7

File tree

1 file changed

+60
-29
lines changed

1 file changed

+60
-29
lines changed

Makefile

Lines changed: 60 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Vessel Makefile
2-
# Development workflow for Vessel project
1+
# AI SDK Makefile
2+
# Development workflow for AI SDK project
33

44
# ==============================================================================
55
# Variables
@@ -9,6 +9,11 @@
99
COVERAGE_DIR := coverage
1010
LINT_CONFIG := .golangci.yml
1111

12+
# Modules (root and integrations)
13+
ROOT_MODULE := .
14+
INTEGRATIONS_MODULE := ./integrations
15+
ALL_MODULES := $(ROOT_MODULE) $(INTEGRATIONS_MODULE)
16+
1217
# Version and metadata
1318
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
1419
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
@@ -53,7 +58,9 @@ all: fmt lint test
5358
.PHONY: help
5459
## help: Show this help message
5560
help:
56-
@echo "$(COLOR_BLUE)Vessel Makefile$(COLOR_RESET)"
61+
@echo "$(COLOR_BLUE)AI SDK Makefile$(COLOR_RESET)"
62+
@echo ""
63+
@echo "$(COLOR_YELLOW)Multi-module project: root + integrations$(COLOR_RESET)"
5764
@echo ""
5865
@echo "$(COLOR_GREEN)Usage:$(COLOR_RESET)"
5966
@echo " make [target]"
@@ -66,10 +73,12 @@ help:
6673
# ==============================================================================
6774

6875
.PHONY: test
69-
## test: Run all tests with race detector
76+
## test: Run all tests with race detector (all modules)
7077
test:
71-
@echo "$(COLOR_GREEN)Running tests...$(COLOR_RESET)"
72-
@$(GOTEST) $(TEST_FLAGS) $(TEST_DIRS)
78+
@echo "$(COLOR_GREEN)Running tests on root module...$(COLOR_RESET)"
79+
@$(GOTEST) $(TEST_FLAGS) ./...
80+
@echo "$(COLOR_GREEN)Running tests on integrations module...$(COLOR_RESET)"
81+
@cd $(INTEGRATIONS_MODULE) && $(GOTEST) $(TEST_FLAGS) ./...
7382
@echo "$(COLOR_GREEN)✓ All tests passed$(COLOR_RESET)"
7483

7584
.PHONY: test-short
@@ -125,40 +134,55 @@ bench-compare:
125134
# ==============================================================================
126135

127136
.PHONY: lint
128-
## lint: Run golangci-lint
137+
## lint: Run golangci-lint (all modules)
129138
lint:
130-
@echo "$(COLOR_GREEN)Running linter...$(COLOR_RESET)"
139+
@echo "$(COLOR_GREEN)Linting root module...$(COLOR_RESET)"
131140
@if command -v $(GOLANGCI_LINT) >/dev/null 2>&1; then \
132141
$(GOLANGCI_LINT) run $(LINT_DIRS) --timeout=5m; \
133-
echo "$(COLOR_GREEN)✓ Linting passed$(COLOR_RESET)"; \
142+
echo "$(COLOR_GREEN)Linting integrations module...$(COLOR_RESET)"; \
143+
cd $(INTEGRATIONS_MODULE) && $(GOLANGCI_LINT) run ./... --timeout=5m; \
144+
echo "$(COLOR_GREEN)✓ All modules linted$(COLOR_RESET)"; \
134145
else \
135146
echo "$(COLOR_RED)Error: golangci-lint not found. Run 'make install-tools' to install$(COLOR_RESET)"; \
136147
exit 1; \
137148
fi
138149

139150
.PHONY: lint-fix
140-
## lint-fix: Run golangci-lint with auto-fix
151+
## lint-fix: Run golangci-lint with auto-fix (all modules)
141152
lint-fix:
142-
@echo "$(COLOR_GREEN)Running linter with auto-fix...$(COLOR_RESET)"
153+
@echo "$(COLOR_GREEN)Running linter with auto-fix on root module...$(COLOR_RESET)"
143154
@$(GOLANGCI_LINT) run $(LINT_DIRS) --fix --timeout=5m
155+
@echo "$(COLOR_GREEN)Running linter with auto-fix on integrations module...$(COLOR_RESET)"
156+
@cd $(INTEGRATIONS_MODULE) && $(GOLANGCI_LINT) run ./... --fix --timeout=5m
157+
@echo "$(COLOR_GREEN)✓ All modules auto-fixed$(COLOR_RESET)"
144158

145159
.PHONY: fmt
146-
## fmt: Format Go code
160+
## fmt: Format Go code (all modules)
147161
fmt:
148-
@echo "$(COLOR_GREEN)Formatting code...$(COLOR_RESET)"
149-
@$(GOFMT) $(TEST_DIRS)
150-
@echo "$(COLOR_GREEN)✓ Code formatted$(COLOR_RESET)"
162+
@echo "$(COLOR_GREEN)Formatting root module...$(COLOR_RESET)"
163+
@$(GOFMT) ./...
164+
@echo "$(COLOR_GREEN)Formatting integrations module...$(COLOR_RESET)"
165+
@cd $(INTEGRATIONS_MODULE) && $(GOFMT) ./...
166+
@echo "$(COLOR_GREEN)✓ All modules formatted$(COLOR_RESET)"
151167

152168
.PHONY: fmt-check
153-
## fmt-check: Check if code is formatted
169+
## fmt-check: Check if code is formatted (all modules)
154170
fmt-check:
155-
@echo "$(COLOR_GREEN)Checking code format...$(COLOR_RESET)"
156-
@UNFORMATTED=$$(gofmt -l .); \
171+
@echo "$(COLOR_GREEN)Checking root module format...$(COLOR_RESET)"
172+
@UNFORMATTED=$$(gofmt -l . 2>/dev/null | grep -v '^integrations/'); \
173+
if [ -n "$$UNFORMATTED" ]; then \
174+
echo "$(COLOR_RED)Root module code is not formatted. Run 'make fmt'$(COLOR_RESET)"; \
175+
echo "$$UNFORMATTED"; \
176+
exit 1; \
177+
fi
178+
@echo "$(COLOR_GREEN)Checking integrations module format...$(COLOR_RESET)"
179+
@cd $(INTEGRATIONS_MODULE) && UNFORMATTED=$$(gofmt -l .); \
157180
if [ -n "$$UNFORMATTED" ]; then \
158-
echo "$(COLOR_RED)Code is not formatted. Run 'make fmt'$(COLOR_RESET)"; \
181+
echo "$(COLOR_RED)Integrations module code is not formatted. Run 'make fmt'$(COLOR_RESET)"; \
159182
echo "$$UNFORMATTED"; \
160183
exit 1; \
161184
fi
185+
@echo "$(COLOR_GREEN)✓ All modules properly formatted$(COLOR_RESET)"
162186

163187
.PHONY: vet
164188
## vet: Run go vet
@@ -168,19 +192,26 @@ vet:
168192
@echo "$(COLOR_GREEN)✓ Vet passed$(COLOR_RESET)"
169193

170194
.PHONY: tidy
171-
## tidy: Tidy go modules
195+
## tidy: Tidy go modules (all modules)
172196
tidy:
173-
@echo "$(COLOR_GREEN)Tidying modules...$(COLOR_RESET)"
197+
@echo "$(COLOR_GREEN)Tidying root module...$(COLOR_RESET)"
174198
@$(GOMOD) tidy
175-
@echo "$(COLOR_GREEN)✓ Modules tidied$(COLOR_RESET)"
199+
@echo "$(COLOR_GREEN)Tidying integrations module...$(COLOR_RESET)"
200+
@cd $(INTEGRATIONS_MODULE) && $(GOMOD) tidy
201+
@echo "$(COLOR_GREEN)✓ All modules tidied$(COLOR_RESET)"
176202

177203
.PHONY: tidy-check
178-
## tidy-check: Check if go.mod is tidy
204+
## tidy-check: Check if go.mod is tidy (all modules)
179205
tidy-check:
180-
@echo "$(COLOR_GREEN)Checking if modules are tidy...$(COLOR_RESET)"
206+
@echo "$(COLOR_GREEN)Checking if root module is tidy...$(COLOR_RESET)"
181207
@$(GOMOD) tidy
182208
@git diff --exit-code go.mod go.sum || \
183-
(echo "$(COLOR_RED)go.mod or go.sum is not tidy. Run 'make tidy'$(COLOR_RESET)" && exit 1)
209+
(echo "$(COLOR_RED)Root go.mod or go.sum is not tidy. Run 'make tidy'$(COLOR_RESET)" && exit 1)
210+
@echo "$(COLOR_GREEN)Checking if integrations module is tidy...$(COLOR_RESET)"
211+
@cd $(INTEGRATIONS_MODULE) && $(GOMOD) tidy
212+
@cd $(INTEGRATIONS_MODULE) && git diff --exit-code go.mod go.sum || \
213+
(echo "$(COLOR_RED)Integrations go.mod or go.sum is not tidy. Run 'make tidy'$(COLOR_RESET)" && exit 1)
214+
@echo "$(COLOR_GREEN)✓ All modules are tidy$(COLOR_RESET)"
184215

185216
.PHONY: verify
186217
## verify: Run all verification checks (fmt-check, vet, tidy-check, lint)
@@ -422,7 +453,7 @@ changelog:
422453
github-workflows:
423454
@echo "$(COLOR_BLUE)GitHub Workflows:$(COLOR_RESET)"
424455
@echo ""
425-
@echo "$(COLOR_GREEN)Expected workflows for go-utils:$(COLOR_RESET)"
456+
@echo "$(COLOR_GREEN)Expected workflows for AI SDK:$(COLOR_RESET)"
426457
@echo " 1. ci.yml - Run tests and linters on PRs and pushes"
427458
@echo " 2. release.yml - Automatically create releases on version tags"
428459
@echo " 3. codeql.yml - Security analysis (CodeQL)"
@@ -464,14 +495,14 @@ f: fmt
464495
.PHONY: info
465496
## info: Display project information
466497
info:
467-
@echo "$(COLOR_BLUE)go-utils Project Information$(COLOR_RESET)"
498+
@echo "$(COLOR_BLUE)AI SDK Project Information$(COLOR_RESET)"
468499
@echo ""
469500
@echo "$(COLOR_GREEN)Version:$(COLOR_RESET) $(VERSION)"
470501
@echo "$(COLOR_GREEN)Commit:$(COLOR_RESET) $(COMMIT)"
471502
@echo "$(COLOR_GREEN)Go Version:$(COLOR_RESET) $(GO_VERSION)"
472503
@echo ""
473-
@echo "$(COLOR_GREEN)Module:$(COLOR_RESET) $$(head -1 go.mod | cut -d' ' -f2)"
474-
@echo "$(COLOR_GREEN)Packages:$(COLOR_RESET) errs, log"
504+
@echo "$(COLOR_GREEN)Root Module:$(COLOR_RESET) $$(head -1 go.mod | cut -d' ' -f2)"
505+
@echo "$(COLOR_GREEN)Integrations Module:$(COLOR_RESET) $$(cd $(INTEGRATIONS_MODULE) && head -1 go.mod | cut -d' ' -f2)"
475506
@echo ""
476507
@echo "$(COLOR_GREEN)Latest Tag:$(COLOR_RESET) $$(git describe --tags --abbrev=0 2>/dev/null || echo 'none')"
477508

0 commit comments

Comments
 (0)