-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
78 lines (65 loc) · 1.77 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
#
# Makefile: basic Makefile for template API service
#
# This Makefile is a template for new repos. It contains only repo-specific
# logic and uses included makefiles to supply common targets (javascriptlint,
# jsstyle, restdown, etc.), which are used by other repos as well. You may well
# need to rewrite most of this file, but you shouldn't need to touch the
# included makefiles.
#
# If you find yourself adding support for new targets that could be useful for
# other projects too, you should add these to the original versions of the
# included Makefiles (in eng.git) so that other teams can use them too.
#
#
# Tools
#
TOP := $(shell pwd)
NODE_MODULES := $(TOP)/node_modules
NODE_BIN := $(NODE_MODULES)/.bin
ESLINT = $(NODE_BIN)/eslint
JSCS = $(NODE_BIN)/jscs
MOCHA = $(NODE_BIN)/mocha
IMOCHA = $(NODE_BIN)/_mocha
ISTANBUL = $(NODE_BIN)/istanbul
NPM := npm
#
# Files
#
LIB_DIR := lib
TEST_DIR := test
TEST_FILES := $(shell find $(TEST_DIR) -name '*.js')
JS_FILES := $(TEST_FILES) index.js
PRIMER_SCRIPTS := $(TOP)/edge/**/*.groovy
SHRINKWRAP := npm-shrinkwrap.json
CLEAN_FILES += node_modules $(SHRINKWRAP)
#
# Repo-specific targets
#
.PHONY: all
all: node_modules lint style cover
.PHONY: lint
lint: node_modules $(ESLINT) $(JS_FILES)
$(ESLINT) $(JS_FILES)
.PHONY: style
style: node_modules $(JSCS) $(JS_FILES)
$(JSCS) $(JS_FILES)
.PHONY: cover
cover: node_modules $(ISTANBUL) $(IMOCHA)
@rm -rf ./coverage
$(ISTANBUL) cover --report html $(IMOCHA) -- $(TEST_FILES)
node_modules: package.json
$(NPM) install -d
@touch node_modules
.PHONY: test
test: node_modules $(MOCHA)
$(MOCHA) $(TEST_FILES)
.PHONY: check
check: lint style cover
.PHONY: distclean
distclean:
@rm -rf ./node_modules
#
# Debug -- print out a a variable via `make print-FOO`
#
print-% : ; @echo $* = $($*)