-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (42 loc) · 1.68 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
BIN = ./node_modules/.bin
package_name = jira_service
tarball_name = $(package_name).tar.gz
temp_directory = /tmp/builds/jobing
application_path = ~/www/jobing
project_path = .
src_path = $(project_path)/src
dist_path = $(project_path)/dist
server_name = $(env_server_name)
server_user = $(env_server_user)
ssh = ssh $(server_user)@$(server_name)
test:
npm test
install:
npm install
build:
mkdir -p $(dist_path)
rsync -av --progress $(src_path)/* $(dist_path)
NODE_ENV=production $(BIN)/node-sass ./src/public/scss -o ./dist/public/dist/css --output-style compressed
NODE_ENV=production $(BIN)/webpack
dev:
$(BIN)/pm2 kill
$(BIN)/pm2 flush
NODE_ENV=dev $(BIN)/pm2 startOrRestart ./services/pm2_dev_config.json
foreman start -f ./services/Procfile_dev
run_remote_server_install_and_run:
$(ssh) 'source ~/.profile; cd $(application_path)/$(package_name) && npm install --production'
$(ssh) 'source ~/.profile; cd $(application_path)/$(package_name) && NODE_ENV=production npm run prod'
deploy:
make install
make build
make test
mkdir -p $(temp_directory)
tar --exclude='.git' --exclude='Makefile' --exclude='./src' --exclude='./node_modules' -zcvf $(temp_directory)/$(tarball_name) $(project_path)/*
$(ssh) 'rm -rf $(application_path)/$(tarball_name) $(application_path)/$(package_name)'
scp -rp $(temp_directory)/$(tarball_name) $(server_user)@$(server_name):$(application_path)
$(ssh) 'mkdir -p $(application_path)/$(package_name)'
$(ssh) 'tar -C $(application_path)/$(package_name) -xvf $(application_path)/$(tarball_name)'
make run_remote_server_install_and_run
test_prod_build:
NODE_ENV=production $(BIN)/webpack
NODE_ENV=production $(BIN)/webpack --json | $(BIN)/analyze-bundle-size