-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (47 loc) · 1.71 KB
/
Makefile
File metadata and controls
62 lines (47 loc) · 1.71 KB
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
TESTS = $(shell find test -type f -name "*.test.js")
BIN_MOCHA = ./node_modules/.bin/mocha
BIN_NYC = ./node_modules/.bin/nyc
RELEASE_DIR = out/release/
RELEASE_COPY = bin common config controller middleware model router schema service
PROJECT_NAME = $(shell cat package.json | awk -F '"' '/name" *: *"/{print $$4}')
VERSION = $(shell cat package.json | awk -F '"' '/version" *: *"/{print $$4}')
install:
@npm i --registry http://r.dtwave-inc.com
production:
@npm i --production --registry http://r.dtwave-inc.com
test:
NODE_ENV=test $(BIN_MOCHA) -R spec -t 60000 --exit -r ./test/env.js $(TESTS);
test-file:
NODE_ENV=test $(BIN_MOCHA) -R spec -t 60000 ./test/model/user.test.js;
cov test-cov:
$(BIN_NYC) --reporter=lcov --reporter=text-summary $(BIN_MOCHA) -R list -t 60000 --exit -r ./test/env.js $(TESTS);
release: production
@./bin/build.sh prd
package: clean
@echo 'Copy files...'
@mkdir -p $(RELEASE_DIR)
@if [ `echo $$OSTYPE | grep -c 'darwin'` -eq 1 ]; then \
cp -r $(RELEASE_COPY) $(RELEASE_DIR); \
else \
cp -rL $(RELEASE_COPY) $(RELEASE_DIR); \
fi
@cp package-lock.json $(RELEASE_DIR)
@cp package.json $(RELEASE_DIR)
@cp app.js $(RELEASE_DIR)
@cp pm2.json $(RELEASE_DIR)
@cp config/config.prd.js $(RELEASE_DIR)/config/config.js
@cd $(RELEASE_DIR) && npm install --production --registry http://r.dtwave-inc.com
@echo "all codes are in \"$(RELEASE_DIR)\""
@mv $(RELEASE_DIR) out/${PROJECT_NAME}
@cd out && tar czf ${PROJECT_NAME}_${VERSION}.tgz ${PROJECT_NAME}
eslint:
@eslint .
tag:
@cat package.json | xargs -0 node -p 'JSON.parse(process.argv[1]).version' | xargs git tag
@git push origin --tags
clean:
@echo 'Clean files...'
@rm -rf ./out
start:
@./bin/start.sh
.PHONY: install test