-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (56 loc) · 2.23 KB
/
Makefile
File metadata and controls
68 lines (56 loc) · 2.23 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
.PHONY: build build-all clean clean-compare-output test test-go test-js compare-output install info install-pdf-tool public/index.html
# Build record-tui binary
build:
go build -o bin/record-tui ./cmd/record-tui
# Build for multiple platforms
build-all: build
GOOS=darwin GOARCH=arm64 go build -o bin/record-tui-darwin-arm64 ./cmd/record-tui
GOOS=darwin GOARCH=amd64 go build -o bin/record-tui-darwin-amd64 ./cmd/record-tui
GOOS=linux GOARCH=amd64 go build -o bin/record-tui-linux-amd64 ./cmd/record-tui
# Clean comparison output files (ensures fresh comparison)
clean-compare-output:
rm -rf ./recordings-output/
# Run all tests (clean, Go tests, JS output generation, then compare)
test: clean-compare-output test-go test-js compare-output
# Run Go tests (generates .go.output files in recordings-output/)
test-go:
go test ./internal/... -v
# Run JS output generation (generates .js.output files in recordings-output/)
test-js:
node internal/js/generate_output.js
# Compare Go and JS outputs (fails if any differ)
compare-output:
go test ./internal/session -run TestCompareGoAndJsOutput -v
# Install binary to ~/bin
install: build
rm -f ~/bin/record-tui
cp bin/record-tui ~/bin/record-tui
chmod +x ~/bin/record-tui
@echo "✓ Installed to ~/bin/record-tui"
# Install PDF conversion tool dependencies
install-pdf-tool:
@command -v node >/dev/null 2>&1 || { echo "Error: Node.js is not installed. Please install Node.js 18 or higher."; exit 1; }
@NODE_VERSION=$$(node -v | sed 's/v//' | cut -d. -f1); \
if [ "$$NODE_VERSION" -lt 18 ]; then \
echo "Error: Node.js 18 or higher is required for PDF export."; \
echo "Current version: $$(node -v)"; \
echo "Please upgrade Node.js: https://nodejs.org/"; \
exit 1; \
fi
cd cmd/to-pdf && npm install
cd cmd/to-pdf && npx playwright install chromium
sed 's|@REPO_DIR@|'$(PWD)'|g' cmd/to-pdf/to-pdf.sh > ~/bin/to-pdf
chmod +x ~/bin/to-pdf
@echo "✓ PDF conversion tool installed to ~/bin/to-pdf"
# Generate public/index.html from public/session.log
public/index.html: build
./bin/record-tui -convert public/session.log
cp public/session.log.html public/index.html
# Clean build artifacts
clean:
rm -rf bin/
go clean
# Display binary info
info: build
@echo "Binary size:"
@ls -lh bin/record-tui