forked from Netflix-Skunkworks/spectator-js-nodejsmetrics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (46 loc) · 1.13 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
ROOT := $(shell pwd)
NODE_MODULES := $(ROOT)/node_modules
NODE_BIN := $(NODE_MODULES)/.bin
NODE_VERSION := $(shell node --version | sed 's/\..*//')
ALL_FILES := src/*.js
ESLINT := $(NODE_BIN)/eslint
JSCS := $(NODE_BIN)/jscs
MOCHA := $(NODE_BIN)/mocha
_MOCHA := $(NODE_BIN)/_mocha
.PHONY: all
all: clean lint codestyle testOrCoverage
.PHONY: lint
lint:
@$(ESLINT) $(ALL_FILES)
.PHONY: codestyle
codestyle:
@$(JSCS) $(ALL_FILES)
.PHONY: codestyle-fix
codestyle-fix:
@$(JSCS) $(ALL_FILES) --fix
.PHONY: test
test:
@npm test
.PHONY: coverage
coverage: node_modules $(ALL_FILES)
@npm run cover
# Run a coverage report if running under node 10, otherwise just run our tests
.PHONY: testOrCoverage
testOrCoverage: $(ALL_FILES)
ifeq ($(NODE_VERSION),v10)
@echo Doing code coverage
@npm run cover
else
@echo Running under $(NODE_VERSION) - Just running tests
@npm test
endif
.PHONY: report-coverage
report-coverage:
ifeq ($(NODE_VERSION),v10)
curl -s https://codecov.io/bash | bash
else
@echo Not uploading code-coverage since running under $(NODE_VERSION)
endif
.PHONY: clean
clean:
@rm -rf $(COVERAGE_FILES)