-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
49 lines (41 loc) · 1.52 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
# command to list available commands with a preceeding comment (requires "#:")
help:
@ echo ' Usage:'
@ echo ' make <target>'
@ echo ''
@ echo ' Targets:'
@grep -B1 -E "^[a-zA-Z0-9_-]+\:([^\=]|$$)" Makefile \
| grep -v -- -- \
| sed 'N;s/\n/###/' \
| sed -n 's/^#: \(.*\)###\(.*\):.*/\2:###\1/p' \
| column -t -s '###'
#: installs dependencies (backend and frontend)
install:
cd backend && npm install
cd frontend && npm install
npm install
#: start the backend
start-backend:
cd backend && npm run dev
#: start the frontend
start-frontend:
cd frontend && npm run dev
#: build all assets for production mode
build:
cd backend && rm -rf dist && npm run build
cd frontend && npm run build
#: start server in production mode (serving both the API and frontend)
run-server-production:
cd backend && STATIC_FILE_ROOT=dist/static CONFIG_PATH=../.env.development npm run start:server
#: run all tests
test-all:
cd backend && npm run test
cd frontend && npm run test
npm run test
#: Deploy the application to the raspberry pi
deploy: build test-all
ssh -p $${PI_SSH_PORT} pi@$${PI_SSH_ADDRESS} 'mkdir -p /home/pi/apps/next-scaffolding'
scp -P $${PI_SSH_PORT} -r ./backend/dist pi@$${PI_SSH_ADDRESS}:/home/pi/apps/next-scaffolding
scp -P $${PI_SSH_PORT} ./backend/package*.json pi@$${PI_SSH_ADDRESS}:/home/pi/apps/next-scaffolding
scp -P $${PI_SSH_PORT} -r ./deployment pi@$${PI_SSH_ADDRESS}:/home/pi/apps
@echo "To replace the old version you should run 'cd /home/pi/apps/deployment && make update' on the raspberry"