-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
77 lines (53 loc) · 1.37 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
66
67
68
69
70
71
72
73
74
75
76
77
PACKAGE_NAME = grommunio-admin-web
# Tools
YARN ?= yarn
# Variables
VERSION ?= $(shell git describe --tags --always 2>/dev/null || \
cat $(CURDIR)/.version 2> /dev/null || echo 0.0.0-unreleased)
ifneq (,$(findstring 69,$(VERSION)))
NICE ?= nice
endif
# Build
.PHONY: all
all: build
.PHONY: build
build: vendor | src ; $(info building ...) @
@rm -rf build
REACT_APP_BUILD_VERSION="${VERSION}" $(YARN) run build
.PHONY: src
src:
@$(MAKE) -C src build
# Checks
.PHONY: lint
lint: vendor ; $(info running eslint ...) @
$(YARN) eslint .
# Tests
.PHONY: test
test: vendor ; $(info running jest tests ...) @
REACT_APP_BUILD_VERSION="${VERSION}" CI=true $(YARN) test -- --verbose
# Yarn
.PHONY: vendor
vendor: .yarninstall
.yarninstall: package.json ; $(info getting dependencies with yarn ...) @
@$(YARN) install
@touch $@
# Dist
.PHONY: dist
dist: ; $(info building dist tarball ...) @
@mkdir -p "dist/${PACKAGE_NAME}-${VERSION}"
@cd dist && \
cp -avf ../README.md "${PACKAGE_NAME}-${VERSION}" && \
cp -avr ../build "${PACKAGE_NAME}-${VERSION}/webapp" && \
tar --owner=0 --group=0 -czvf ${PACKAGE_NAME}-${VERSION}.tar.gz "${PACKAGE_NAME}-${VERSION}" && \
cd ..
.PHONY: clean ; $(info cleaning ...) @
clean:
$(YARN) cache clean
@rm -rf build
@rm -rf node_modules
@rm -f .yarninstall
@$(MAKE) -C src clean
.PHONY: version
version:
@echo $(VERSION)
@echo $(NICE)