-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
129 lines (98 loc) · 2.8 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
.DEFAULT_GOAL := build
.PHONY: build
PATH := node_modules/.bin:$(PATH)
SHELL := /bin/bash
####################################
## MAIN
info:
@echo "Available make commands:"
@echo
@echo " $$ make Compile JS/Jade files into 'public'"
@echo " $$ make dev Compile, watch and hot reload"
@echo " $$ make run Start the server for production"
@echo
@echo " $$ make start Start the app server (pm2)"
@echo " $$ make stop Stop the app server (pm2)"
@echo " $$ make reload Restart the app server with no service disruption (pm2)"
@echo " $$ make restart Stop and start the app server (pm2)"
@echo
@echo " $$ make todo"
@echo " $$ make security"
@echo
@echo " $$ make install Install the NPM packages"
@echo " $$ make info What you are reading"
@echo
clean:
@echo
@echo "# Cleaning ./public"
@rm -Rf ./public
####################################
## BUILD TARGETS
build: media
@echo
@echo "# Running webpack"
NODE_ENV='production' NODE_PATH=$NODE_PATH:./app MYAPP_DEBUG= webpack --progress --colors -p --config webpack.prod.config.js
media:
@mkdir -p public
@if [ "`node -e \"var config = require('./app/config'); console.log(config.DEBUG ? 'debug' : '')\"`" ]; then \
make mediacopy; \
else \
make mediamin; \
fi
mediamin:
@echo
@echo "Minifying media files to public/media"
@find ./app/media -type d | while read dir; do \
mkdir -p $${dir/.\/app\//./public/}; \
done
@find ./app/media -type f | while read f; do \
imagemin --plugin=pngquant $$f > $${f/.\/app\//./public/}; \
done
mediacopy:
@echo
@echo "# Copying media files to public/media"
cp -a ./app/media ./public
####################################
## DEVELOPMENT TARGETS
dev: media
@echo
@echo "# Running Webpack Watch + Nodemon"
@make launch &
webpack-dev-server --progress --colors &
NODE_PATH=$NODE_PATH:./app nodemon --watch app/api --watch app/models --watch app/lib --watch app/reducers .
launch:
@sleep 3
@echo "# Launching http://localhost:8080"
@node -e "require('open')('http://localhost:8080');"
install:
npm install
test:
mocha --require ./app/tests/starter.js --require ./app/tests/helper.js ./app --recursive
po-extract:
gulp --gulpfile gulp.lang.js extract
po-compile:
gulp --gulpfile gulp.lang.js compile
####################################
## SERVER TARGETS
run:
@echo
@echo "# Starting server"
NODE_ENV='production' NODE_PATH=$NODE_PATH:./app MYAPP_DEBUG= node .
start:
NODE_ENV='production' NODE_PATH=$NODE_PATH:./app MYAPP_DEBUG= pm2 start process.yml
pm2 dump
stop:
pm2 stop process.yml
reload:
pm2 reload process.yml
restart:
@make stop
@make start
####################################
## TOOLS
todo:
@notes api lib models push test|| echo 'Install notes with npm install -g'
depcheck:
depcheck
security:
snyk wizard