-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (39 loc) · 1.21 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
IMAGE_PATH := docker/base/node/10:c-jose
DOCKER_REGISTRY := registry.delite.ca
IMAGE := $(DOCKER_REGISTRY)/$(IMAGE_PATH)
DOCKER_RUN := docker run --user node -it \
-e "NODE_ENV=test" \
-v "$(CURDIR)/tmp/node-gyp:/home/node/.node-gyp" \
-v "$(CURDIR):/deploy" \
$(IMAGE)
NODE_MODULE_PATH := node_modules/.bin
MOCHA_BIN := $(NODE_MODULE_PATH)/mocha
NODEMON_BIN := $(NODE_MODULE_PATH)/nodemon
NODEGYP_BIN := $(NODE_MODULE_PATH)/node-gyp
NODEPREGYP_BIN := $(NODE_MODULE_PATH)/node-pre-gyp
WATCH_EXTS := js,json
.PHONY: test watch pull build debug config install clean
pull:
docker pull $(IMAGE)
node_modules:
$(DOCKER_RUN) npm install
$(DOCKER_RUN) $(NODEPREGYP_BIN) configure
debug: pull node_modules
$(DOCKER_RUN) $(NODEPREGYP_BIN) build --debug
build: pull node_modules
$(DOCKER_RUN) $(NODEPREGYP_BIN) build
local-build:
npm install
$(NODEPREGYP_BIN) configure
$(NODEPREGYP_BIN) build
$(NODEPREGYP_BIN) package
watch: pull
$(DOCKER_RUN) $(NODEMON_BIN) -e $(WATCH_EXTS) --watch app --watch test \
$(MOCHA_BIN) --watch --recursive \
--watch-extensions $(WATCH_EXTS) "test/**/*.test.js"
test: debug
$(DOCKER_RUN) $(MOCHA_BIN) --timeout 100 "test/**/*.test.js"
clean:
@RM -rf tmp
@RM -rf node_modules
@RM -rf build