-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
104 lines (87 loc) · 3 KB
/
Copy pathMakefile
File metadata and controls
104 lines (87 loc) · 3 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
.PHONY: build clean clean-all rebuild test typecheck bench
.PHONY: publish publish-dry help
.PHONY: release-tag release-push
.PHONY: wf-release wf-publish wf-ci wf-list wf-watch
help:
@echo "Targets:"
@echo " make build - Build project (bun build)"
@echo " make clean - Clean build artifacts (dist/)"
@echo " make clean-all - Clean everything (dist/, node_modules/, *.tgz)"
@echo " make rebuild - Clean and rebuild"
@echo " make test - Run tests"
@echo " make typecheck - Run TypeScript type checking"
@echo " make bench - Run benchmarks"
@echo " make publish - Publish to npm"
@echo " make publish-dry - Dry-run publish (preview)"
@echo ""
@echo "Release:"
@echo " make release-tag - Create signed git tag (requires VERSION=X.Y.Z)"
@echo " make release-push - Push commits and tags to remote"
@echo ""
@echo "Workflows (requires gh cli + fzf):"
@echo " make wf-release - Trigger release PR workflow (interactive)"
@echo " make wf-publish - Re-run failed publish workflow"
@echo " make wf-ci - Trigger CI workflow on current branch"
@echo " make wf-list - List recent workflow runs"
@echo " make wf-watch - Watch latest workflow run"
# Build
build:
bun build src/index.ts --outdir dist --target bun
clean:
rm -rf dist
clean-all: clean
rm -rf node_modules/
rm -f *.tgz
rebuild: clean build
# Test
test:
bun test
typecheck:
tsc --noEmit
# Benchmarks
bench:
bun run bench/init.bench.ts
# Publishing
publish:
npm publish
publish-dry:
npm publish --dry-run
# Release helpers (see RELEASE.md for full process)
release-tag:
@test -n "$(VERSION)" || (echo "VERSION required: make release-tag VERSION=X.Y.Z" && exit 1)
git tag -s -m "Release v$(VERSION)" v$(VERSION)
release-push:
git push --follow-tags
# Workflows (requires gh cli + fzf)
# Trigger release PR workflow with interactive prompts
wf-release:
@TYPE=$$(echo -e "auto\npatch\nminor\nmajor" | fzf --prompt="Version type: " --height=6 --reverse); \
if [ "$$TYPE" = "auto" ]; then \
read -p "Custom version (leave empty for auto): " VERSION; \
fi; \
echo "→ Triggering release: type=$$TYPE version=$${VERSION:-auto}"; \
gh workflow run release-pr.yml \
-f version_type=$$TYPE \
$${VERSION:+-f custom_version=$$VERSION}; \
sleep 2; \
$(MAKE) wf-watch W=release-pr.yml
# Re-run failed publish workflow: make wf-publish [RUN=<run-id>]
wf-publish:
$(if $(RUN),\
gh run rerun $(RUN),\
gh run rerun --failed -w release-publish.yml)
@sleep 2
@$(MAKE) wf-watch W=release-publish.yml
# Trigger CI workflow on current branch
wf-ci:
gh workflow run ci.yml --ref $(shell git branch --show-current)
@sleep 2
@$(MAKE) wf-watch W=ci.yml
# List recent workflow runs: make wf-list [W=<workflow>] [N=10]
wf-list:
gh run list $(if $(W),-w $(W)) -L $(or $(N),10)
# Watch latest workflow run: make wf-watch [W=<workflow>] [RUN=<run-id>]
wf-watch:
$(if $(RUN),\
gh run watch $(RUN),\
gh run watch $(shell gh run list $(if $(W),-w $(W)) -L 1 --json databaseId -q '.[0].databaseId'))