-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
110 lines (86 loc) · 2.2 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
NODE_MODULES_PATH := $(shell pwd)/node_modules
PATH := $(NODE_MODULES_PATH)/.bin:$(PATH)
SHELL := /bin/bash
LINT := tslint
LINT_FLAGS := --config ./.tslintrc.json
CC := tsc
FLAGS := --module commonjs --target ES5 --noImplicitAny --noEmitOnError --suppressImplicitAnyIndexErrors --removeComments
TESTER := _mocha
TEST_FLAGS := --reporter spec --timeout 1000 --ui bdd
COVER := istanbul
COVER_FLAGS := --statements 100 --functions 100 --branches 100 --lines 100
DOC := tsdoc
SOURCE_NAMES := future
TEST_NAMES := andThen \
apply \
collect \
denodify \
failed \
fallbackTo \
filter \
find \
firstCompletedOf \
flatMap \
fold \
foreach \
fromTry \
map \
nodify \
onComplete \
onFailure \
onSuccess \
recover \
recoverWith \
reduce \
sequence \
should \
successful \
transform \
traverse \
withFilter \
zip
LIB_NAMES := es6-promise \
mocha \
node
SOURCES := $(patsubst %, ./src/%.ts, $(SOURCE_NAMES))
DECLARES := $(patsubst %, ./src/%.d.ts, $(SOURCE_NAMES))
TESTS := $(patsubst %, ./test/%.ts, $(TEST_NAMES))
LIBS := $(foreach LIB, $(LIB_NAMES), ./lib.d/$(LIB)/$(LIB).d.ts)
JS := $(patsubst %.ts, %.js, $(SOURCES) $(TESTS))
LAST_BUILD_ALL := ./.last_build_all
LAST_BUILD := ./.last_build
COVERAGE_RESULT := ./coverage/coverage-final.json
DOC_CONFIG := ./tsdoc.json
DOC_RESULT := ./docs/index.html
LAST_DOC_CONFIG := ./.last_doc_config
.PHONY: lint build all clean test cover modules doc
.DEFAULT: build
build: modules $(LAST_BUILD)
$(LAST_BUILD): $(SOURCES)
$(CC) $(FLAGS) -d $? $(LIBS)
@touch $@
all: modules $(LAST_BUILD_ALL)
$(LAST_BUILD_ALL): $(SOURCES) $(TESTS)
$(CC) $(FLAGS) $? $(LIBS)
@touch $@
lint: modules lint-internal
lint-internal: $(SOURCES) $(TESTS)
$(LINT) $(LINT_FLAGS) $^
test: modules $(LAST_BUILD_ALL)
$(TESTER) $(TEST_FLAGS)
cover: modules $(COVERAGE_RESULT)
$(COVER) check-coverage $(COVER_FLAGS)
$(COVERAGE_RESULT): $(LAST_BUILD_ALL)
$(COVER) cover $(TESTER) -- $(TEST_FLAGS)
doc: modules $(LAST_DOC_CONFIG) $(DOC_RESULT)
$(LAST_DOC_CONFIG): $(DOC_CONFIG)
$(DOC) -i
@touch $@
$(DOC_RESULT): $(SOURCES)
$(DOC)
clean:
rm -f $(JS) $(DECLARES)
@rm -f $(LAST_BUILD_ALL) $(LAST_BUILD) $(LAST_DOC_CONFIG)
modules: $(NODE_MODULES_PATH)
$(NODE_MODULES_PATH):
npm install