-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (46 loc) · 1.6 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
SHELL := /bin/bash
PATH := ./node_modules/.bin:$(PATH)
SRC_FILES := $(shell find src -name '*.ts')
all: lib
lib: $(SRC_FILES) node_modules tsconfig.json
tsc -p tsconfig.json --outDir lib
VERSION="$$(node -p 'require("./package.json").version')"; \
BUILD="$$(git rev-parse --short HEAD)-$$(date +%s)"; \
echo "module.exports = '$${VERSION}-$${BUILD}';" > lib/version.js
touch lib
reports:
mkdir reports
.PHONY: coverage
coverage: node_modules reports
NODE_ENV=test nyc -r html -r text -e .ts -i ts-node/register \
--report-dir reports/coverage \
mocha --reporter nyan --require ts-node/register test/*.ts
.PHONY: devserver
devserver: node_modules
@NODE_CONFIG_ENV=blacklist onchange -i 'src/**/*.ts' 'config/*' -- ts-node src/app.ts | bunyan -o short
.PHONY: test
test: node_modules
@NODE_ENV=test NODE_CONFIG_ENV=blacklist,test mocha --require ts-node/register test/*.ts --grep '$(grep)'
.PHONY: ci-test
ci-test: node_modules reports
tslint -p tsconfig.json -c tslint.json
# NODE_CONFIG_ENV=blacklist,test NODE_ENV=test nyc -r lcov -e .ts -i ts-node/register \
# --report-dir reports/coverage \
# mocha --require ts-node/register \
# --timeout 30000 \
# --reporter $$([ -n "$$CI" ] && echo "mocha-junit-reporter" || echo "tap") \
# --reporter-options mochaFile=./reports/unit-tests/junit.xml \
# test/*.ts
.PHONY: lint
lint: node_modules
tslint -p tsconfig.json -c tslint.json -t stylish --fix
node_modules: package.json
yarn install --non-interactive --frozen-lockfile
.PHONY: clean
clean:
rm -rf .nyc_output/
rm -rf lib/
rm -rf reports/
.PHONY: distclean
distclean: clean
rm -rf node_modules/