generated from materya/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
65 lines (51 loc) · 1.11 KB
/
Makefile
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
#!make
ifneq (,$(wildcard .env))
include .env
export $(shell sed 's/=.*//' .env)
endif
PM = npm
RM = rm
PRERELEASE_TAG ?= beta
PUBLISH_FLAGS = publish --access public
MODULES = node_modules
DIST = dist
COVERAGE = .nyc_output coverage
.PHONY: all
all: $(DIST)
$(ENVFILE):
cp $(ENVFILE).defaults $(ENVFILE)
$(MODULES):
$(PM) ci
$(DIST): $(ENV) $(MODULES)
$(PM) run build
.PHONY: clean
clean:
$(RM) -rf $(DIST) $(COVERAGE)
.PHONY: clean-all
clean-all:
$(RM) -rf $(MODULES)
.PHONY: test
test: $(MODULES)
$(PM) t
coverage:
$(PM) run coverage
.PHONY: release
release: clean all
ifneq (,$(findstring n,$(MAKEFLAGS)))
+$(PM) run release -- --dry-run
+$(PM) $(PUBLISH_FLAGS) --dry-run
else
$(PM) run release
git push --follow-tags origin main
$(PM) $(PUBLISH_FLAGS)
endif
.PHONY: prerelease
prerelease: clean all
ifneq (,$(findstring n,$(MAKEFLAGS)))
+$(PM) run release -- --prerelease $(PRERELEASE_TAG) --dry-run
+$(PM) $(PUBLISH_FLAGS) --tag $(PRERELEASE_TAG) --dry-run
else
$(PM) run release -- --prerelease $(PRERELEASE_TAG)
git push --follow-tags origin main
$(PM) $(PUBLISH_FLAGS) --tag $(PRERELEASE_TAG)
endif