-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
82 lines (63 loc) · 2.04 KB
/
Copy pathMakefile
File metadata and controls
82 lines (63 loc) · 2.04 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
.PHONY: help install build test lint typecheck check clean version-patch version-minor version-major publish deploy release release-patch release-minor release-major
PKG_VERSION := $(shell node -p "require('./package.json').version")
help:
@echo "Available targets:"
@echo " install Install dependencies"
@echo " build Build the project"
@echo " test Run tests"
@echo " lint Run linter"
@echo " typecheck Run TypeScript type checker"
@echo " check Run lint + typecheck + test"
@echo " clean Remove build artifacts"
@echo " version-patch Bump patch version (x.y.Z)"
@echo " version-minor Bump minor version (x.Y.0)"
@echo " version-major Bump major version (X.0.0)"
@echo " publish Publish current version to npm"
@echo " deploy Bump patch, tag, push, and publish to npm"
@echo " release-patch Bump patch, tag, push, and publish"
@echo " release-minor Bump minor, tag, push, and publish"
@echo " release-major Bump major, tag, push, and publish"
@echo ""
@echo "Current version: $(PKG_VERSION)"
install:
npm install
build:
npm run build
test:
npm test
lint:
npm run lint
typecheck:
npm run typecheck
check: lint typecheck test
clean:
rm -rf dist coverage
define bump-version
npm version $(1) --no-git-tag-version
git add package.json package-lock.json
git commit -m "chore: bump version to v$$(node -p "require('./package.json').version")"
git tag "v$$(node -p "require('./package.json').version")"
endef
version-patch:
$(call bump-version,patch)
version-minor:
$(call bump-version,minor)
version-major:
$(call bump-version,major)
publish: build
npm publish --access public
deploy: check version-patch
git push --follow-tags
$(MAKE) publish
release: check
git push --follow-tags
$(MAKE) publish
release-patch: check version-patch
git push --follow-tags
$(MAKE) publish
release-minor: check version-minor
git push --follow-tags
$(MAKE) publish
release-major: check version-major
git push --follow-tags
$(MAKE) publish