-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
96 lines (70 loc) · 2.3 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
PACKAGE_NAME = kpop
# Tools
YARN ?= yarn
CHGLOG ?= git-chglog
# Variables
ARGS ?=
VERSION ?= $(shell git describe --tags --always --dirty --match=v* 2>/dev/null | sed 's/^v//' || \
cat $(CURDIR)/.version 2> /dev/null || echo 0.0.0-unreleased)
# Build
.PHONY: all
all: build i18n
.PHONY: build
build: vendor | src ; $(info building ...) @
@rm -rf ./es/
REACT_APP_KOPANO_BUILD="${VERSION}" BABEL_ENV=production $(YARN) run build
echo $(VERSION) > .version
.PHONY: i18n
i18n: vendor | src
@$(MAKE) -C i18n
.PHONY: src
src:
@$(MAKE) -C src
.PHONY: lint
lint: vendor ; $(info running eslint ...) @
@$(YARN) eslint . --cache && echo "eslint: no lint errors"
.PHONY: lint-checkstyle
lint-checkstyle: vendor ; $(info running eslint checkstyle ...) @
@mkdir -p ./test
@$(YARN) eslint -f checkstyle -o ./test/tests.eslint.xml . || true
# Tests
.PHONY: test
test: vendor | src ; $(info running jest tests ...) @
REACT_APP_KOPANO_BUILD="${VERSION}" BABEL_ENV=test $(YARN) jest --verbose
.PHONY: test-coverage
test-coverage: vendor | src ; $(info running jest tests with coverage ...) @
@mkdir -p ./test
REACT_APP_KOPANO_BUILD="${VERSION}" BABEL_ENV=test JEST_JUNIT_OUTPUT=./test/jest-test-results.xml $(YARN) jest --coverage --coverageDirectory=coverage --testResultsProcessor="jest-junit"
.PHONY: test-xml
test-xml: vendor | src ; $(info running jest tests ...) @
@mkdir -p ./test
REACT_APP_KOPANO_BUILD="${VERSION}" BABEL_ENV=test JEST_JUNIT_OUTPUT=./test/jest-test-results.xml $(YARN) jest --verbose --testResultsProcessor="jest-junit"
# Documentation
.PHONY: doc
doc: vendor | src ; $(info generating documentation ...) @
REACT_APP_KOPANO_BUILD="${VERSION}" $(YARN) styleguide:build
# Yarn
.PHONY: vendor
vendor: .yarninstall
.yarninstall: package.json ; $(info getting depdencies with yarn ...) @
@$(YARN) install --silent
@touch $@
# Dist
.PHONY: dist
dist: ; $(info building dist tarball ...)
@mkdir -p "dist/"
$(YARN) pack --filename="dist/${PACKAGE_NAME}-${VERSION}.tgz"
.PHONY: changelog
changelog: ; $(info updating changelog ...)
$(CHGLOG) --output CHANGELOG.md $(ARGS) v1.0.0..
.PHONY: clean ; $(info cleaning ...) @
clean:
@$(MAKE) -C src clean
@$(MAKE) -C i18n clean
$(YARN) cache clean
@rm -rf node_modules
@rm -rf coverage
@rm -f .yarninstall
.PHONY: version
version:
@echo $(VERSION)