forked from SeamlessDocsDev/microservice-helper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
76 lines (57 loc) · 2.11 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
NODE_MODULES_BINARIES = ./node_modules/.bin
BUILD_DIR = ./build
DEV_DIR = ./src
DIST_DIR = ./dist
JS_FILES=$(shell find lib -type f -name '*.js' | tail -r)
BABEL = $(NODE_MODULES_BINARIES)/babel
MOCHA = $(NODE_MODULES_BINARIES)/mocha
SEMVER = $(NODE_MODULES_BINARIES)/semver
JSON_TOOL = $(NODE_MODULES_BINARIES)/json
STANDARD = $(NODE_MODULES_BINARIES)/standard
SNAZZY = $(NODE_MODULES_BINARIES)/snazzy
JSDOC2MD = $(NODE_MODULES_BINARIES)/jsdoc2md
NSP = $(NODE_MODULES_BINARIES)/nsp
MAINJS_SERVER_FILE = index.js
HELPER_VERSION = $(shell cat package.json | $(JSON_TOOL) version)
all:
make clean build
build:
mkdir -p $(BUILD_DIR)
$(BABEL) ./lib/ -s -D -d $(BUILD_DIR)/lib
clean:
rm -rf $(BUILD_DIR)
prerelease:
ifndef VERSION_TYPE
$(error VERSION_TYPE is not set)
endif
rm -rf $(DIST_DIR)
mkdir -p $(DIST_DIR)
$(BABEL) ./lib/ -s -D -d $(DIST_DIR)
ifeq ($(VERSION_TYPE), br)
$(eval NEW_VERSION := $(shell $(SEMVER) --increment major $(HELPER_VERSION)))
endif
ifeq ($(VERSION_TYPE), fe)
$(eval NEW_VERSION := $(shell $(SEMVER) --increment minor $(HELPER_VERSION)))
endif
ifeq ($(VERSION_TYPE), fx)
$(eval NEW_VERSION := $(shell $(SEMVER) --increment patch $(HELPER_VERSION)))
endif
cat package.json | $(JSON_TOOL) -e 'this.version="$(NEW_VERSION)"' > package.json.tmp
mv package.json.tmp package.json
code-style:
$(STANDARD) --fix --verbose | $(SNAZZY)
security:
$(NSP) check --output summary
test:
make security && make code-style && $(MOCHA) --compilers js:babel-core/register ./tests/*.spec.js
test-db:
make security && make code-style && $(MOCHA) --compilers js:babel-core/register ./tests/db.spec.js
test-microservice:
make security && make code-style && $(MOCHA) --compilers js:babel-core/register ./tests/microservice.spec.js
test-errors:
make security && make code-style && $(MOCHA) --compilers js:babel-core/register ./tests/errors.spec.js
test-cache:
make security && make code-style && $(MOCHA) --compilers js:babel-core/register ./tests/cache.spec.js
generate-docs:
$(JSDOC2MD) $(JS_FILES) > API.md
.PHONY: build clean prerelease test test-db test-microservice test-handler code-style generate-docs test-cache