This repository has been archived by the owner on Sep 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
94 lines (72 loc) · 1.81 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
.DEFAULT_GOAL := all
# Paths
DEPS = ./node_modules
BIN = $(DEPS)/.bin
SRC = ./src
BUILD = ./build
DOCS = ./docs
PKG = ./package.json
# Tests
TESTS = ./test/src/
SPACE :=
SPACE +=
# Default to recursive, can override on run
FILE = $(SPACE)--recursive
# ARGS
T_ARGS = --compilers js:babel/register $(TESTS)$(FILE)
# Deploy
TAG = 0
TAG_CMD = npm version $(TAG) && \
git push origin master && \
git push --tags
# Make things more readable
define colorecho
@tput setaf 2
@tput bold
@printf "\n"
@echo $1
@echo ==========================================
@tput sgr0
endef
# Tasks
clean:
$(call colorecho, "Cleaning $(BUILD) and $(DEPS)")
rm -rf $(DEPS)
install: $(PKG)
$(call colorecho, "Installing")
npm i .
lint:
$(call colorecho, "Linting $(SRC)")
$(BIN)/eslint $(SRC)
test:
# Need to prebuild runner for integration tests
$(call colorecho, "Building runner for integration tests")
$(BIN)/babel $(SRC)/runner.js --out-file $(BUILD)/runner.js
$(call colorecho, "Testing $(TESTS)$(FILE)")
$(BIN)/mocha $(T_ARGS)
cover:
$(call colorecho, "Running coverage report")
$(BIN)/istanbul cover $(BIN)/_mocha -- $(T_ARGS)
build:
$(call colorecho, "Building $(SRC) to $(BUILD)")
$(BIN)/babel $(SRC) --out-dir $(BUILD)
start:
$(call colorecho, "Starting...")
node test/index.js
doc:
$(call colorecho, "Building Docs")
$(BIN)/esdoc -c esdoc.json
report:
$(call colorecho, "Running Static Analysis")
$(BIN)/plato -r -d report $(BUILD)
tag:
$(call colorecho, "Deploying to Git")
$(TAG_CMD)
deploy: lint test build doc tag
dev: lint test build start
watch:
$(call colorecho, "Starting watch")
$(BIN)/nodemon --exec "make dev" --watch $(SRC)
all: clean install lint test build doc report
# Phonies
.PHONY: lint test doc build start report deploy