This repository has been archived by the owner on Nov 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
87 lines (72 loc) · 2.64 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
ISTANBUL = ./node_modules/istanbul/lib/cli.js
MOCHA = ./node_modules/mocha/bin/_mocha
PLATO = ./node_modules/es6-plato/bin/plato
JSDOC = ./node_modules/jsdoc/jsdoc.js
CROSSENV = ./node_modules/cross-env/dist/bin/cross-env.js
ESLINT = ./node_modules/eslint/bin/eslint.js
DOCSDIR = ./documents/documentation
REPORTSDIR = ./documents/analysis
COVERAGEDIR = ./documents/coverage
UNFORMAT = \033[0m
BOLD = \033[1m
BLUE = \033[34m
GREEN = \033[32m
TEST_START = @printf "$(BOLD)$(BLUE)Running Unit Tests...$(UNFORMAT)\n"
TEST_END = @printf "$(BOLD)$(GREEN)Unit Tests Complete!$(UNFORMAT)\n"
ANALYZE_START = @printf "$(BOLD)$(BLUE)Analyzing Code...$(UNFORMAT)\n"
ANALYZE_END = @printf "$(BOLD)$(GREEN)Analyze Code Complete!$(UNFORMAT)\n"
DOC_START = @printf "$(BOLD)$(BLUE)Generating Documentation...$(UNFORMAT)\n"
DOC_END = @printf "$(BOLD)$(GREEN)Documentation Generated!$(UNFORMAT)\n"
LINT_START = @printf "$(BOLD)$(BLUE)Linting Files...$(UNFORMAT)\n"
LINT_END = @printf "$(BOLD)$(GREEN)Linting Complte!$(UNFORMAT)\n"
COMPLETE = @printf "$(BOLD)$(GREEN)Project was successfully built!$(UNFORMAT)\n"
#target: dependencies
#[tab] system command
# Default command. Runs unit tests, analyzes code and generate documentation
all: test analyze docs complete
# Runs unit tests, analyzes code, generate documentation and lints code.
dev: test analyze docs lint
# Run the unit tests for this project
test:
$(TEST_START)
node $(ISTANBUL) cover --dir=$(COVERAGEDIR) --print=detail $(MOCHA) -- -R spec --ui tdd --recursive tests
$(TEST_END)
# Run Plato code analyzer
analyze:
$(ANALYZE_START)
node $(PLATO) -r -l .eslintrc -d $(REPORTSDIR) index.js
$(ANALYZE_END)
# Run ESLint (Show only errors)
lint_error:
$(LINT_START)
node $(ESLINT) -c .eslintrc --color --quiet --ignore-path .eslintignore "index.js"
$(LINT_END)
# Run ESLint
lint:
$(LINT_START)
node $(ESLINT) -c .eslintrc --color --ignore-path .eslintignore "index.js"
$(LINT_END)
# Generate code documentation
docs:
$(DOC_START)
node $(JSDOC) -r index.js --readme README.md --destination $(DOCSDIR) --package package.json
$(DOC_END)
# Completion message
complete:
$(COMPLETE)
# Help menu
help:
@ echo
@ echo ' Usage:'
@ echo ''
@ echo ' make <target> [flags...]'
@ echo ''
@ echo ' Targets:'
@ echo ''
@ awk '/^#/{ comment = substr($$0,3) } comment && /^[a-zA-Z][a-zA-Z0-9_-]+ ?:/{ print " ", $$1, comment }' $(MAKEFILE_LIST) | column -t -s ':' | sort
@ echo ''
@ echo ' Flags:'
@ echo ''
@ awk '/^#/{ comment = substr($$0,3) } comment && /^[a-zA-Z][a-zA-Z0-9_-]+ ?\?=/{ print " ", $$1, $$2, comment }' $(MAKEFILE_LIST) | column -t -s '?=' | sort
@ echo ''
.PHONY: all dev test analyze docs complete help